Commits

Anonymous committed d8916c2

resolve: add "diff to common ancestor" cmenu actions in resolve window (fixes #2201)

In the resolve window 2 contextmenu actions have been added for unresolved files
"Diff Local to Ancestor": shows the diff between local and the common ancestor
"Diff Other to Ancestor": shows the diff between other and the common ancestor

  • Participants
  • Parent commits ef9fb31
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/resolve.py

         cmother.triggered.connect(lambda: self.merge('internal:other'))
         cmres = self.utreecmenu.addAction(_('Mark as Resolved'))
         cmres.triggered.connect(self.markresolved)
-        self.umenuitems = (cmauto, cmmanual, cmlocal, cmother, cmres)
+        cmdiffLocToAnc = self.utreecmenu.addAction(_('Diff Local to Ancestor'))
+        cmdiffLocToAnc.triggered.connect(self.diffLocToAnc)
+        cmdiffOthToAnc = self.utreecmenu.addAction(_('Diff Other to Ancestor'))
+        cmdiffOthToAnc.triggered.connect(self.diffOthToAnc)
+        self.umenuitems = (cmauto, cmmanual, cmlocal, cmother, cmres,
+                           cmdiffLocToAnc, cmdiffOthToAnc)
         self.utree.customContextMenuRequested.connect(self.utreeMenuRequested)
 
         res = qtlib.LabeledSeparator(_('Resolved conflicts'))
             qtlib.editfiles(self.repo, abspaths, parent=self)
 
     def getVdiffFiles(self, tree):
-        paths = self.getSelectedPaths(self.rtree)
+        paths = self.getSelectedPaths(tree)
         if not paths:
             return []
         files, sub = [], False
             if dlg:
                 dlg.exec_()
 
+    def diffLocToAnc(self):
+        paths = self.getVdiffFiles(self.utree)
+        if paths:
+            opts = {}
+            opts['rev'] = ['ancestor(p1(),p2())..p1()']
+            opts['tool'] = self.tcombo.readValue()
+            dlg = visdiff.visualdiff(self.repo.ui, self.repo, paths, opts)
+            if dlg:
+                dlg.exec_()
+
+    def diffOthToAnc(self):
+        paths = self.getVdiffFiles(self.utree)
+        if paths:
+            opts = {}
+            opts['rev'] = ['ancestor(p1(),p2())..p2()']
+            opts['tool'] = self.tcombo.readValue()
+            dlg = visdiff.visualdiff(self.repo.ui, self.repo, paths, opts)
+            if dlg:
+                dlg.exec_()
+
     def configChanged(self):
         'repository has detected a change to config files'
         self.tcombo.reset()