Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 1005
6986db425aa2
parent 966
890ec4c04ffe
child 1011
0b118aefae5b
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Apr 29 18:34:40 2011 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Apr 30 12:48:38 2011 +0200
@@ -1951,7 +1951,7 @@
         """
         Public method used to backout an earlier changeset from the Mercurial repository.
         
-        @param name directory name (string or list of strings))
+        @param name directory name (string or list of strings)
         """
         dname, fname = self.splitPath(name)
         
@@ -1991,6 +1991,31 @@
             if res:
                 dia.exec_()
     
+    def hgRollback(self, name):
+        """
+        Public method used to rollback the last transaction.
+        
+        @param name directory name (string or list of strings)
+        """
+        dname, fname = self.splitPath(name)
+        
+        # find the root of the repo
+        repodir = str(dname)
+        while not os.path.isdir(os.path.join(repodir, self.adminDir)):
+            repodir = os.path.dirname(repodir)
+            if repodir == os.sep:
+                return
+        
+        res = E5MessageBox.yesNo(None,
+            self.trUtf8("Rollback last transaction"),
+            self.trUtf8("""Are you sure you want to rollback the last transaction?"""),
+            icon = E5MessageBox.Warning)
+        if res:
+            dia = HgDialog(self.trUtf8('Rollback last transaction'))
+            res = dia.startProcess(["rollback"], repodir)
+            if res:
+                dia.exec_()
+
     def hgServe(self, name):
         """
         Public method used to edit the repository config file.

eric ide

mercurial