Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 6461
48bf6c3f084f
parent 6460
af9e529d0fb6
child 6462
58259e234dc9
diff -r af9e529d0fb6 -r 48bf6c3f084f Plugins/VcsPlugins/vcsMercurial/hg.py
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Aug 04 14:05:07 2018 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Aug 04 14:48:27 2018 +0200
@@ -3038,12 +3038,18 @@
                 self.checkVCSStatus()
         return res
     
-    def hgGraftContinue(self, path):
+    def __hgGraftSubCommand(self, path, subcommand, title):
         """
-        Public method to continue copying changesets from another branch.
-        
-        @param path directory name of the project (string)
-        @return flag indicating that the project should be reread (boolean)
+        Private method to perform a Mercurial graft subcommand.
+        
+        @param path directory name of the project
+        @type str
+        @param subcommand subcommand flag
+        @type str
+        @param title tirle of the dialog
+        @type str
+        @return flag indicating that the project should be reread
+        @rtype bool
         """
         # find the root of the repo
         repodir = self.splitPath(path)[0]
@@ -3053,18 +3059,53 @@
                 return
         
         args = self.initCommand("graft")
-        args.append("--continue")
+        args.append(subcommand)
         args.append("--verbose")
         
-        dia = HgDialog(self.tr('Copy Changesets (Continue)'), self)
+        dia = HgDialog(title, self)
         res = dia.startProcess(args, repodir)
         if res:
             dia.exec_()
             res = dia.hasAddOrDelete()
             self.checkVCSStatus()
         return res
-    # TODO: Mercurial 4.7: add action for graft --stop
-    # TODO: Mercurial 4.7: add action for graft --abort
+    
+    def hgGraftContinue(self, path):
+        """
+        Public method to continue copying changesets from another branch.
+        
+        @param path directory name of the project
+        @type str
+        @return flag indicating that the project should be reread
+        @rtype bool
+        """
+        return self.__hgGraftSubCommand(
+            path, "--continue", self.tr('Copy Changesets (Continue)'))
+    
+    def hgGraftStop(self, path):
+        """
+        Public method to stop an interrupted copying session.
+        
+        @param path directory name of the project
+        @type str
+        @return flag indicating that the project should be reread
+        @rtype bool
+        """
+        return self.__hgGraftSubCommand(
+            path, "--stop", self.tr('Copy Changesets (Stop)'))
+    
+    def hgGraftAbort(self, path):
+        """
+        Public method to abort an interrupted copying session and perform
+        a rollback.
+        
+        @param path directory name of the project
+        @type str
+        @return flag indicating that the project should be reread
+        @rtype bool
+        """
+        return self.__hgGraftSubCommand(
+            path, "--abort", self.tr('Copy Changesets (Abort)'))
     
     def hgArchive(self):
         """

eric ide

mercurial