diff options
author | hut <hut@lavabit.com> | 2013-02-24 23:24:00 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-24 23:24:00 +0100 |
commit | 6e46fd77cc8674e3ea3603a66981ce1c6abc3d18 (patch) | |
tree | dbfc86b9c63f2717c0a8396cc55adfb68172fdae /ranger/fsobject/directory.py | |
parent | b108021d64010dbd4677dc24729680a8ab90fb04 (diff) | |
download | ranger-6e46fd77cc8674e3ea3603a66981ce1c6abc3d18.tar.gz |
vcs: move some code from load_bit_by_bit to load_vcs
Diffstat (limited to 'ranger/fsobject/directory.py')
-rw-r--r-- | ranger/fsobject/directory.py | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 9bd728c1..546fc6d0 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -16,7 +16,6 @@ from ranger.core.shared import SettingsAware from ranger.ext.accumulator import Accumulator from ranger.ext.lazy_property import lazy_property from ranger.ext.human_readable import human_readable -from ranger.ext.vcs import VcsError from ranger.container.settingobject import LocalSettingObject def sort_by_basename(path): @@ -71,7 +70,7 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware): content_outdated = False content_loaded = False - has_vcschild=False + has_vcschild = False _cumulative_size_calculated = False @@ -259,32 +258,8 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware): # Load vcs data if self.settings.vcs_aware: item.load_vcs() - if item.vcs: - if item.vcs.vcsname == 'git': backend_state = self.settings.vcs_backend_git - elif item.vcs.vcsname == 'hg': backend_state = self.settings.vcs_backend_hg - elif item.vcs.vcsname == 'bzr': backend_state = self.settings.vcs_backend_bzr - else: backend_state = 'disabled' - - if backend_state in set(['enabled', 'local']): - self.has_vcschild = True - try: - if self.vcs_outdated or item.vcs_outdated: - item.vcs_outdated = False - item.vcs.get_status() # caches the file status for get_file_status() - item.vcsbranch = item.vcs.get_branch() - item.vcshead = item.vcs.get_info(item.vcs.HEAD) - if item.path == item.vcs.root and backend_state == 'enabled': - item.vcsremotestatus = item.vcs.get_remote_status() - else: - item.vcsbranch = self.vcsbranch - item.vcshead = self.vcshead - item.vcsfilestatus = item.vcs.get_file_status(item.path) - except VcsError as err: - item.vcsbranch = None - item.vcshead = None - item.vcsremotestatus = 'unknown' - item.vcsfilestatus = 'unknown' - self.fm.notify("Can not load vcs data on %s: %s" % (item.path, err), bad=True) + if item.vcs_enabled: + self.has_vcschild = True files.append(item) self.percent = 100 * len(files) // len(filenames) |