[meld/VersionControlRework: 65/123] vc._vc: Handle both missing and deleted folders in traversal



commit c739ecd18bea5f2e6d19314584a55f03f09bbf09
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Mar 29 14:11:30 2015 +1000

    vc._vc: Handle both missing and deleted folders in traversal

 meld/vc/_vc.py |    4 ++++
 meld/vcview.py |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index b69a4cb..e4d455a 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -97,6 +97,10 @@ class Entry(object):
     def get_status(self):
         return self.state_names[self.state]
 
+    def is_present(self):
+        """Should this Entry actually be present on the file system"""
+        return self.state not in (STATE_REMOVED, STATE_MISSING)
+
 
 class Vc(object):
 
diff --git a/meld/vcview.py b/meld/vcview.py
index 66850b9..86d17e0 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -432,7 +432,7 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             entries = self.vc.get_entries(path)
             entries = [e for e in entries if any(f(e) for f in filters)]
             for e in entries:
-                if e.isdir and e.state != tree.STATE_REMOVED:
+                if e.isdir and e.is_present():
                     try:
                         st = os.lstat(e.path)
                     # Covers certain unreadable symlink cases; see bgo#585895


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]