mercurial/localrepo.py
changeset 2362 482d3fb47d80
parent 2354 16276b1c0658
child 2395 8ed45fb1053a
equal deleted inserted replaced
2361:d3adb454c5a9 2362:482d3fb47d80
   301     def transaction(self):
   301     def transaction(self):
   302         tr = self.transhandle
   302         tr = self.transhandle
   303         if tr != None and tr.running():
   303         if tr != None and tr.running():
   304             return tr.nest()
   304             return tr.nest()
   305 
   305 
   306         # save dirstate for undo
   306         # save dirstate for rollback
   307         try:
   307         try:
   308             ds = self.opener("dirstate").read()
   308             ds = self.opener("dirstate").read()
   309         except IOError:
   309         except IOError:
   310             ds = ""
   310             ds = ""
   311         self.opener("journal.dirstate", "w").write(ds)
   311         self.opener("journal.dirstate", "w").write(ds)
   325             return True
   325             return True
   326         else:
   326         else:
   327             self.ui.warn(_("no interrupted transaction available\n"))
   327             self.ui.warn(_("no interrupted transaction available\n"))
   328             return False
   328             return False
   329 
   329 
   330     def undo(self, wlock=None):
   330     def rollback(self, wlock=None):
   331         if not wlock:
   331         if not wlock:
   332             wlock = self.wlock()
   332             wlock = self.wlock()
   333         l = self.lock()
   333         l = self.lock()
   334         if os.path.exists(self.join("undo")):
   334         if os.path.exists(self.join("undo")):
   335             self.ui.status(_("rolling back last transaction\n"))
   335             self.ui.status(_("rolling back last transaction\n"))
   336             transaction.rollback(self.opener, self.join("undo"))
   336             transaction.rollback(self.opener, self.join("undo"))
   337             util.rename(self.join("undo.dirstate"), self.join("dirstate"))
   337             util.rename(self.join("undo.dirstate"), self.join("dirstate"))
   338             self.reload()
   338             self.reload()
   339             self.wreload()
   339             self.wreload()
   340         else:
   340         else:
   341             self.ui.warn(_("no undo information available\n"))
   341             self.ui.warn(_("no rollback information available\n"))
   342 
   342 
   343     def wreload(self):
   343     def wreload(self):
   344         self.dirstate.read()
   344         self.dirstate.read()
   345 
   345 
   346     def reload(self):
   346     def reload(self):