[meld] Rework some conflict list logic



commit 46acc76e0438a2f84ca7616701172c2efee12772
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Mar 12 07:18:10 2013 +1000

    Rework some conflict list logic

 meld/vcview.py |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/meld/vcview.py b/meld/vcview.py
index 48d0bf9..21361e7 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -471,29 +471,25 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                     # We use auto merge, so we create a new temp file
                     # for other, base and this, then set the output to
                     # the current file.
-                    file1 = self.vc.get_path_for_conflict(
-                                path, conflict=tree.CONFLICT_OTHER)
-                    file2 = self.vc.get_path_for_conflict(
-                                path, conflict=tree.CONFLICT_BASE)
-                    file3 = self.vc.get_path_for_conflict(
-                                path, conflict=tree.CONFLICT_THIS)
-                    os.chmod(file1, 0o444)
-                    os.chmod(file2, 0o444)
-                    os.chmod(file3, 0o444)
-                    _temp_files.append(file1)
-                    _temp_files.append(file2)
-                    _temp_files.append(file3)
-
-                    diffs = [file1, file2, file3]
+
+                    conflicts = (tree.CONFLICT_OTHER, tree.CONFLICT_BASE,
+                                 tree.CONFLICT_THIS)
+                    diffs = [self.vc.get_path_for_conflict(path, conflict=c)
+                             for c in conflicts]
+
+                    for conflict_path in diffs:
+                        os.chmod(conflict_path, 0o444)
+                        _temp_files.append(conflict_path)
+
                     # If we want to use auto-merge or use the merged
                     # output given by the VCS
                     kwargs['auto_merge'] = False
                     kwargs['merge_output'] = path
                 else:
-                    file1 = self.vc.get_path_for_repo_file(path)
-                    os.chmod(file1, 0o444)
-                    _temp_files.append(file1)
-                    diffs = [file1, path]
+                    comp_path = self.vc.get_path_for_repo_file(path)
+                    os.chmod(comp_path, 0o444)
+                    _temp_files.append(comp_path)
+                    diffs = [comp_path, path]
                 self.emit("create-diff", diffs, kwargs)
         except NotImplementedError:
             for path in path_list:


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