741 |
741 |
742 def undofiles(self): |
742 def undofiles(self): |
743 return [undoname(x) for x in self._journalfiles()] |
743 return [undoname(x) for x in self._journalfiles()] |
744 |
744 |
745 def _writejournal(self, desc): |
745 def _writejournal(self, desc): |
746 # save dirstate for rollback |
746 self.opener.write("journal.dirstate", |
747 try: |
747 self.opener.tryread("dirstate")) |
748 ds = self.opener.read("dirstate") |
|
749 except IOError: |
|
750 ds = "" |
|
751 self.opener.write("journal.dirstate", ds) |
|
752 self.opener.write("journal.branch", |
748 self.opener.write("journal.branch", |
753 encoding.fromlocal(self.dirstate.branch())) |
749 encoding.fromlocal(self.dirstate.branch())) |
754 self.opener.write("journal.desc", |
750 self.opener.write("journal.desc", |
755 "%d\n%s\n" % (len(self), desc)) |
751 "%d\n%s\n" % (len(self), desc)) |
756 |
752 self.opener.write("journal.bookmarks", |
757 try: |
753 self.opener.tryread("bookmarks")) |
758 bk = self.opener.read("bookmarks") |
754 self.sopener.write("journal.phaseroots", |
759 except IOError: |
755 self.sopener.tryread("phaseroots")) |
760 bk = "" |
|
761 self.opener.write("journal.bookmarks", bk) |
|
762 |
|
763 phasesname = self.sjoin('phaseroots') |
|
764 if os.path.exists(phasesname): |
|
765 util.copyfile(phasesname, self.sjoin('journal.phaseroots')) |
|
766 else: |
|
767 self.sopener.write('journal.phaseroots', '') |
|
768 |
756 |
769 def recover(self): |
757 def recover(self): |
770 lock = self.lock() |
758 lock = self.lock() |
771 try: |
759 try: |
772 if os.path.exists(self.sjoin("journal")): |
760 if os.path.exists(self.sjoin("journal")): |