diff mercurial/hg.py @ 162:5dcbe4d9a30c

Implement recover and undo commands This adds an interface to transaction to rollback with a given journal file and commands to rollback an existing .hg/journal or .hg/undo.
author mpm@selenic.com
date Thu, 26 May 2005 09:04:54 -0800
parents 0b4c5cb953d9
children f38c90953c2c
line wrap: on
line diff
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -297,6 +297,11 @@ class localrepository:
         return transaction(self.opener, self.join("journal"),
                            self.join("undo"))
 
+    def recover(self, f = "journal"):
+        self.lock()
+        if os.path.exists(self.join(f)):
+            return rollback(self.opener, self.join(f))
+
     def lock(self, wait = 1):
         try:
             return lock.lock(self.join("lock"), 0)