[meld] filediff: Mark conflict as resolved from file comparison (bgo#698645)



commit 98e4c0943db0986fb2ab1aad38d573fc07306751
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Apr 22 07:41:00 2014 +1000

    filediff: Mark conflict as resolved from file comparison (bgo#698645)

 meld/filediff.py |   22 ++++++++++++++++++++++
 meld/vcview.py   |    5 +++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 55a3ffe..ffb6a72 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -893,6 +893,26 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                             return Gtk.ResponseType.CANCEL
             elif response == Gtk.ResponseType.DELETE_EVENT:
                 response = Gtk.ResponseType.CANCEL
+
+        if response == Gtk.ResponseType.OK and self.meta:
+            parent = self.meta.get('parent', None)
+            saved = self.meta.get('middle_saved', False)
+            prompt_resolve = self.meta.get('prompt_resolve', False)
+            if prompt_resolve and saved and parent.has_command('resolve'):
+                primary = _("Mark conflict as resolved?")
+                secondary = _(
+                    "If the conflict was resolved successfully, you may mark "
+                    "it as resolved now.")
+                buttons = ((_("Cancel"), Gtk.ResponseType.CANCEL),
+                           (_("Mark _Resolved"), Gtk.ResponseType.OK))
+                resolve_response = misc.modal_dialog(
+                    primary, secondary, buttons, parent=self.widget,
+                    messagetype=Gtk.MessageType.QUESTION)
+
+                if resolve_response == Gtk.ResponseType.OK:
+                    conflict_file = self.textbuffer[1].data.filename
+                    parent.command('resolve', [conflict_file])
+
         return response
 
     def on_delete_event(self, appquit=0):
@@ -1683,6 +1703,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
             self.emit("file-changed", save_to)
             self.undosequence.checkpoint(buf)
             bufdata.update_mtime()
+            if pane == 1 and self.num_panes == 3:
+                self.meta['middle_saved'] = True
             return True
         else:
             return False
diff --git a/meld/vcview.py b/meld/vcview.py
index 940f138..3a03638 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -496,9 +496,14 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
                      for c in conflicts]
             temps = [p for p, is_temp in diffs if is_temp]
             diffs = [p for p, is_temp in diffs]
+            meta = {
+                'parent': self,
+                'prompt_resolve': True,
+            }
             kwargs = {
                 'auto_merge': False,
                 'merge_output': path,
+                'meta': meta,
             }
         else:
             comp_path = self.vc.get_path_for_repo_file(path)


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