# HG changeset patch # User Idan Kamara # Date 2012-03-06 16:42:52 # Node ID 97efd26eb9576f39590812ea9cb2bf809076283d # Parent eb39bbda167bc599ceb61c52d30674fa0be3870b localrepo: refactor retrieving of journal/undo files paths We'd like to remove undo files after stripping diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -750,8 +750,8 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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: