Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 18310:4499ba5ac35c
localrepo: introduce destroying function
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Sat, 15 Dec 2012 20:08:13 +0200 |
parents | cfeab932cff7 |
children | 084074648755 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sun Dec 16 23:13:02 2012 +0200 +++ b/mercurial/localrepo.py Sat Dec 15 20:08:13 2012 +0200 @@ -895,6 +895,7 @@ return 0 parents = self.dirstate.parents() + self.destroying() transaction.rollback(self.sopener, self.sjoin('undo'), ui.warn) if os.path.exists(self.join('undo.bookmarks')): util.rename(self.join('undo.bookmarks'), @@ -1379,6 +1380,20 @@ lock.release() @unfilteredmethod + def destroying(self): + '''Inform the repository that nodes are about to be destroyed. + Intended for use by strip and rollback, so there's a common + place for anything that has to be done before destroying history. + + This is mostly useful for saving state that is in memory and waiting + to be flushed when the current lock is released. Because a call to + destroyed is imminent, the repo will be invalidated causing those + changes to stay in memory (waiting for the next unlock), or vanish + completely. + ''' + pass + + @unfilteredmethod def destroyed(self, newheadnodes=None): '''Inform the repository that nodes have been destroyed. Intended for use by strip and rollback, so there's a common