changeset 16236:97efd26eb957

localrepo: refactor retrieving of journal/undo files paths We'd like to remove undo files after stripping
author Idan Kamara <idankk86@gmail.com>
date Tue, 06 Mar 2012 18:42:52 +0200
parents eb39bbda167b
children b5c0c7d0f83f
files mercurial/localrepo.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Mar 06 23:23:30 2012 +0100
+++ b/mercurial/localrepo.py	Tue Mar 06 18:42:52 2012 +0200
@@ -750,8 +750,8 @@
             raise error.RepoError(
                 _("abandoned transaction found - run hg recover"))
 
-        journalfiles = self._writejournal(desc)
-        renames = [(x, undoname(x)) for x in journalfiles]
+        self._writejournal(desc)
+        renames = [(x, undoname(x)) for x in self._journalfiles()]
 
         tr = transaction.transaction(self.ui.warn, self.sopener,
                                      self.sjoin("journal"),
@@ -760,6 +760,15 @@
         self._transref = weakref.ref(tr)
         return tr
 
+    def _journalfiles(self):
+        return (self.sjoin('journal'), self.join('journal.dirstate'),
+                self.join('journal.branch'), self.join('journal.desc'),
+                self.join('journal.bookmarks'),
+                self.sjoin('journal.phaseroots'))
+
+    def undofiles(self):
+        return [undoname(x) for x in self._journalfiles()]
+
     def _writejournal(self, desc):
         # save dirstate for rollback
         try:
@@ -783,11 +792,6 @@
         else:
             self.sopener.write('journal.phaseroots', '')
 
-        return (self.sjoin('journal'), self.join('journal.dirstate'),
-                self.join('journal.branch'), self.join('journal.desc'),
-                self.join('journal.bookmarks'),
-                self.sjoin('journal.phaseroots'))
-
     def recover(self):
         lock = self.lock()
         try: