[meld] dirdiff: Fix support for missing folders in folder comparison



commit 472d099a9b54244682d6354f5ed7376e4f2c5895
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 b2f6e302..e04d0408 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -720,7 +720,7 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
         # 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
@@ -1469,7 +1469,7 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
         ]
 
         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 87825b7c..abc6a202 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -540,7 +540,7 @@ class MeldWindow(Gtk.ApplicationWindow):
         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]