about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAbdo Roig-Maranges <abdo.roig@gmail.com>2013-02-25 18:34:49 +0100
committerAbdo Roig-Maranges <abdo.roig@gmail.com>2013-02-25 18:39:42 +0100
commit47bc59859328f8fa2c0446a13c3d25acdf946710 (patch)
treec10637bff1350813b228a2815719aa9e4ca88702
parentda7f543aecebb8ccb61031ebd422710ee7f8d0f5 (diff)
downloadranger-47bc59859328f8fa2c0446a13c3d25acdf946710.tar.gz
make vcs information display for subdirectories of a repo
This fixes the code move in commit 6e46fd77cc8674e3ea360.

The block of code that was moved needs to know about, the parent directory (when
there is one). This is fixed by passing parent to load_vcs.
-rw-r--r--ranger/fsobject/directory.py4
-rw-r--r--ranger/fsobject/fsobject.py12
2 files changed, 8 insertions, 8 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 3e5e4f84..c7c5150f 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -228,7 +228,7 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 
                 if self.settings.vcs_aware:
                     self.has_vcschild = False
-                    self.load_vcs()
+                    self.load_vcs(None)
 
                 for name in filenames:
                     try:
@@ -257,7 +257,7 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 
                     # Load vcs data
                     if self.settings.vcs_aware:
-                        item.load_vcs()
+                        item.load_vcs(self)
                         if item.vcs_enabled:
                             self.has_vcschild = True
 
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index 8dbf076f..c714cf24 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -193,7 +193,7 @@ class FileSystemObject(FileManagerAware):
                 return None  # it is impossible to get the link destination
         return self.path
 
-    def load_vcs(self):
+    def load_vcs(self, parent):
         """
         Reads data regarding the version control system the object is on.
         Does not load content specific data.
@@ -221,7 +221,7 @@ class FileSystemObject(FileManagerAware):
             rootdir.load_if_outdated()
 
             # Get the Vcs object from rootdir
-            rootdir.load_vcs()
+            rootdir.load_vcs(None)
             self.vcs = rootdir.vcs
             if rootdir.vcs_outdated:
                 self.vcs_outdated = True
@@ -239,7 +239,7 @@ class FileSystemObject(FileManagerAware):
             self.vcs_enabled = backend_state in set(['enabled', 'local'])
             if self.vcs_enabled:
                 try:
-                    if self.vcs_outdated or self.vcs_outdated:
+                    if self.vcs_outdated or (parent and parent.vcs_outdated):
                         self.vcs_outdated = False
                         # this caches the file status for get_file_status():
                         self.vcs.get_status()
@@ -249,9 +249,9 @@ class FileSystemObject(FileManagerAware):
                                 backend_state == 'enabled':
                             self.vcsremotestatus = \
                                     self.vcs.get_remote_status()
-                    else:
-                        self.vcsbranch = self.vcsbranch
-                        self.vcshead = self.vcshead
+                    elif parent:
+                        self.vcsbranch = parent.vcsbranch
+                        self.vcshead = parent.vcshead
                     self.vcsfilestatus = self.vcs.get_file_status(self.path)
                 except VcsError as err:
                     self.vcsbranch = None