diff options
-rw-r--r-- | ranger/container/directory.py | 9 | ||||
-rw-r--r-- | ranger/ext/vcs/git.py | 4 | ||||
-rw-r--r-- | ranger/ext/vcs/vcs.py | 85 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 11 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 21 |
5 files changed, 63 insertions, 67 deletions
diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 2c3c9f02..95dbd730 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -306,8 +306,10 @@ class Directory(FileSystemObject, Accumulator, Loadable): files = [] disk_usage = 0 - if self.vcs and self.vcs.track: - self.vcs.update(self) + if self.vcs: + self.vcs.check() + if self.vcs.track: + self.vcs.update() for name in filenames: try: @@ -334,9 +336,10 @@ class Directory(FileSystemObject, Accumulator, Loadable): item = Directory(name, preload=stats, path_is_abs=True) item.load() if item.vcs and item.vcs.track: - item.vcs.update(item, child=True) if item.vcs.is_root: self.has_vcschild = True + else: + item.vcspathstatus = self.vcs.get_status_subpath(item.path) else: item = File(name, preload=stats, path_is_abs=True, basename_is_rel_to=basename_is_rel_to) diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py index ee0eb698..0a091064 100644 --- a/ranger/ext/vcs/git.py +++ b/ranger/ext/vcs/git.py @@ -155,8 +155,8 @@ class Git(Vcs): # Data Interface #--------------------------- - def get_status_root_child(self): - """Returns the status of a child root, very cheap""" + def get_status_root_cheap(self): + """Returns the status of root, very cheap""" statuses = set() # Paths with status skip = False diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py index 0ff3fe03..1bd101ed 100644 --- a/ranger/ext/vcs/vcs.py +++ b/ranger/ext/vcs/vcs.py @@ -69,33 +69,37 @@ class Vcs(object): # ) def __init__(self, directoryobject): + self.obj = directoryobject self.path = directoryobject.path self.repotypes_settings = set( repotype for repotype, values in self.REPOTYPES.items() if getattr(directoryobject.settings, values['setting']) in ('enabled', 'local') ) - - self.status_subpaths = {} - self.head = None - self.remotestatus = None - self.branch = None - self.root, self.repodir, self.repotype = self.find_root(self.path) self.is_root = True if self.path == self.root else False if self.root: - self.track = True - self.__class__ = getattr(getattr(ranger.ext.vcs, self.repotype), - self.REPOTYPES[self.repotype]['class']) - - if not os.access(self.repodir, os.R_OK): - self.track = False - if self.is_root: + if self.is_root: + self.__class__ = getattr(getattr(ranger.ext.vcs, self.repotype), + self.REPOTYPES[self.repotype]['class']) + self.status_subpaths = {} + self.track = True + self.initiated = False + self.head = self.get_info(self.HEAD) + self.branch = self.get_branch() + self.remotestatus = self.get_status_remote() + self.obj.vcspathstatus = self.get_status_root_cheap() + + if not os.access(self.repodir, os.R_OK): + self.track = False directoryobject.vcspathstatus = 'unknown' self.remotestatus = 'unknown' - # Do not track self.repodir or its subpaths - if self.path == self.repodir or self.path.startswith(self.repodir + '/'): - self.track = False + else: + # Do not track self.repodir or its subpaths + if self.path == self.repodir or self.path.startswith(self.repodir + '/'): + self.track = False + else: + self.track = directoryobject.fm.get_directory(self.root).vcs.track else: self.track = False @@ -138,31 +142,23 @@ class Vcs(object): path = os.path.dirname(path) return (None, None, None) |