Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

changeset 5496
d157a2319073
parent 5494
fdc53cc1e2fb
child 5501
59ed7b2dd952
diff -r 9584e91c9857 -r d157a2319073 Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Wed Feb 08 19:12:36 2017 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Wed Feb 08 19:24:21 2017 +0100
@@ -238,12 +238,19 @@
         Private method to initialize the actions menu.
         """
         self.__actionsMenu = QMenu()
+        
         self.__graftAct = self.__actionsMenu.addAction(
             UI.PixmapCache.getIcon("vcsGraft.png"),
             self.tr("Copy Changesets"), self.__graftActTriggered)
         self.__graftAct.setToolTip(self.tr(
             "Copy the selected changesets to the current branch"))
         
+        self.__mergeAct = self.__actionsMenu.addAction(
+            UI.PixmapCache.getIcon("vcsMerge.png"),
+            self.tr("Merge with Changeset"), self.__mergeActTriggered)
+        self.__mergeAct.setToolTip(self.tr(
+            "Merge the working directory with the selected changeset"))
+        
         self.__phaseAct = self.__actionsMenu.addAction(
             self.tr("Change Phase"), self.__phaseActTriggered)
         self.__phaseAct.setToolTip(self.tr(
@@ -319,7 +326,6 @@
             UI.PixmapCache.getIcon("actionsToolButton.png"))
         self.actionsButton.setMenu(self.__actionsMenu)
     
-    # TODO: add action "Merge" (1 revision selected)
     # TODO: add action "Create Changegroup" (>=2 revs, lowest rev is base)
     # TODO: add action "Sign Revision" (>= 1 revs) (GPG extension)
     # TODO: add action "Verify Signature" (1 rev) (GPG extension)
@@ -1417,6 +1423,7 @@
                 # step 2: set the status of the graft action
                 self.__graftAct.setEnabled(otherBranches > 0)
             
+            self.__mergeAct.setEnabled(len(self.logTree.selectedItems()) == 1)
             self.__tagAct.setEnabled(len(self.logTree.selectedItems()) == 1)
             self.__switchAct.setEnabled(len(self.logTree.selectedItems()) == 1)
             self.__bookmarkAct.setEnabled(
@@ -2116,6 +2123,17 @@
         
         self.on_refreshButton_clicked()
     
+    @pyqtSlot()
+    def __mergeActTriggered(self):
+        """
+        Private slot to merge the working directory with the selected
+        changeset.
+        """
+        itm = self.logTree.selectedItems()[0]
+        rev = "rev({0})".format(
+            itm.text(self.RevisionColumn).strip().split(":", 1)[0])
+        self.vcs.vcsMerge(self.repodir, rev=rev)
+    
     def __actionMode(self):
         """
         Private method to get the selected action mode.

eric ide

mercurial