[meld: 1/6] Add error when comparing the same file




commit f7bd4f88cbb1e7f4003f86d10d1a7a65c3f9a1b7
Author: Jack <jack vanier16 outlook com>
Date:   Mon Dec 21 21:11:21 2020 -0500

    Add error when comparing the same file

 meld/filediff.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 66b815e7..9ee7e92f 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1809,7 +1809,15 @@ class FileDiff(Gtk.VBox, MeldDoc):
         self._cached_match.clean(self.linediffer.diff_count())
 
         self._set_merge_action_sensitivity()
-        if self.linediffer.sequences_identical():
+        paths = [tb.data.gfile.get_path() for tb in self.textbuffer if tb.data.gfile]
+        duplicate_files = list(set([p for p in paths if paths.count(p) > 1]))
+        if duplicate_files:
+            for index, mgr in enumerate(self.msgarea_mgr):
+                primary = _(
+                    "File %s was loaded more than once." % duplicate_files[0])
+                mgr.add_dismissable_msg(
+                    'dialog-error-symbolic', primary, "")
+        elif self.linediffer.sequences_identical():
             error_message = True in [m.has_message() for m in self.msgarea_mgr]
             if self.num_panes == 1 or error_message:
                 return


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