Plugins/VcsPlugins/vcsMercurial/hg.py

branch
Py2 comp.
changeset 3515
1b8381afe38f
parent 3484
645c12de6b0c
parent 3479
5ff8124c73aa
child 3562
ef3f13a2c599
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Sun Apr 13 15:45:57 2014 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Tue Apr 15 22:41:08 2014 +0200
@@ -2110,6 +2110,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.

eric ide

mercurial