comparison 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
comparison
equal deleted inserted replaced
161:0b4c5cb953d9 162:5dcbe4d9a30c
294 return filelog(self.opener, f) 294 return filelog(self.opener, f)
295 295
296 def transaction(self): 296 def transaction(self):
297 return transaction(self.opener, self.join("journal"), 297 return transaction(self.opener, self.join("journal"),
298 self.join("undo")) 298 self.join("undo"))
299
300 def recover(self, f = "journal"):
301 self.lock()
302 if os.path.exists(self.join(f)):
303 return rollback(self.opener, self.join(f))
299 304
300 def lock(self, wait = 1): 305 def lock(self, wait = 1):
301 try: 306 try:
302 return lock.lock(self.join("lock"), 0) 307 return lock.lock(self.join("lock"), 0)
303 except lock.LockHeld, inst: 308 except lock.LockHeld, inst: