[meld/meld-3-20] dirdiff: Fix support for missing folders in folder comparison



commit c84da9b893a41b3b0fc8ecb4443c3b44d5e9f095
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 19 10:15:01 2019 +1000

    dirdiff: Fix support for missing folders in folder comparison

 meld/dirdiff.py    | 4 ++--
 meld/meldwindow.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 6fb8eb52..9ee22b85 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -669,7 +669,7 @@ class DirDiff(MeldDoc, Component):
         # the time we get this far. This is a fallback, and may be wrong!
         locations = list(locations)
         for i, l in enumerate(locations):
-            if not isinstance(l, str):
+            if l and not isinstance(l, str):
                 locations[i] = l.decode(sys.getfilesystemencoding())
         locations = [os.path.abspath(l) if l else '' for l in locations]
         self.current_path = None
@@ -1384,7 +1384,7 @@ class DirDiff(MeldDoc, Component):
         ]
 
         existing_times = [s.st_mtime for s in stats if s]
-        newest_time = max(existing_times)
+        newest_time = max(existing_times) if existing_times else 0
         if existing_times.count(newest_time) == len(existing_times):
             # If all actually-present files have the same mtime, don't
             # pretend that any are "newer", and do the same if e.g.,
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 4d66a281..409aca88 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -575,7 +575,7 @@ class MeldWindow(Component):
         return doc
 
     def append_dirdiff(self, gfiles, auto_compare=False):
-        dirs = [d.get_path() for d in gfiles if d]
+        dirs = [d.get_path() if d else None for d in gfiles]
         assert len(dirs) in (1, 2, 3)
         doc = DirDiff(len(dirs))
         self._append_page(doc, "folder")


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