[PATCH 02 of 12] localrepo: introduce destroying function
Idan Kamara
idankk86 at gmail.com
Mon Dec 17 09:35:27 CST 2012
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1355594893 -7200
# Branch stable
# Node ID 4a0fc140180ba30fb37073e8b721b8a092e4541a
# Parent de2d114accfcda2d867c65ef9bfc068d5614a8f7
localrepo: introduce destroying function
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -995,6 +995,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'),
@@ -1475,6 +1476,19 @@
tr.release()
lock.release()
+ 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
+
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
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -60,6 +60,7 @@
# have to consider the effect of the stripped revisions and not revisions
# missing because the cache is out-of-date.
repo.updatebranchcache()
+ repo.destroying()
cl = repo.changelog
# TODO handle undo of merge sets
More information about the Mercurial-devel
mailing list