Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 3479
5ff8124c73aa
parent 3475
852dc7d65ff0
child 3515
1b8381afe38f
diff -r beec1d9c1851 -r 5ff8124c73aa Plugins/VcsPlugins/vcsMercurial/hg.py
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Apr 04 18:07:19 2014 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Apr 04 18:21:47 2014 +0200
@@ -2105,6 +2105,36 @@
             dia.exec_()
         self.checkVCSStatus()
     
+    def hgCancelMerge(self, name):
+        """
+        Public method to cancel an uncommitted merge.
+        
+        @param name file/directory name (string)
+        @return flag indicating, that the cancellation contained an add
+            or delete (boolean)
+        """
+        dname, fname = self.splitPath(name)
+        
+        # find the root of the repo
+        repodir = dname
+        while not os.path.isdir(os.path.join(repodir, self.adminDir)):
+            repodir = os.path.dirname(repodir)
+            if os.path.splitdrive(repodir)[1] == os.sep:
+                return
+        
+        args = self.initCommand("update")
+        args.append("--clean")
+        
+        dia = HgDialog(
+            self.tr('Cancelling uncommitted merge'),
+            self)
+        res = dia.startProcess(args, repodir, False)
+        if res:
+            dia.exec_()
+            res = dia.hasAddOrDelete()
+        self.checkVCSStatus()
+        return res
+    
     def hgBranch(self, name):
         """
         Public method used to create a branch in the Mercurial repository.
@@ -2768,8 +2798,6 @@
             if res:
                 dia.exec_()
 
-    # TODO: add support for hg update --clean to revert a failed/aborted merge
-    
     def hgServe(self, name):
         """
         Public method used to serve the project.

eric ide

mercurial