Tag caching, at last
Greg Ward
greg at gerg.ca
Wed Jul 15 13:14:26 UTC 2009
[quoth Matt]
> - taking your fast solution
> - writing out cache of final tag to node mapping
> - if NOTHING has changed on read by (tip revision/hash match), return
> cached tag list
[my foolish reply]
> I'll see what I can whip up!
Still working on it, but I wanted to see what you think of this
(pasting patch into gmail, so no guarantees about formatting...this is
just for design review):
# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1247625009 14400
# Node ID 3dfc90efa8a74a837a50c14702a35a8ed04616ec
# Parent cc6f04bd7d2511b91a3e54d3235575a8892f7a6a
localrepo: add destroyed() method for strip/rollback to use (issue548).
This is sort of like a hook: should we make it a hook instead?
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -612,6 +612,7 @@
% encoding.tolocal(self.dirstate.branch()))
self.invalidate()
self.dirstate.invalidate()
+ self.destroyed()
else:
self.ui.warn(_("no rollback information available\n"))
finally:
@@ -910,6 +911,16 @@
del tr
lock.release()
+ def destroyed(self):
+ '''Inform the repository that nodes have been destroyed.
+ Intended for use by strip and rollback, so there's a common
+ place for anything that has to be done after destroying history.'''
+ # Do nothing for now: this is a placeholder that will be used
+ # when we add tag caching.
+ # XXX it might be nice if we could take the list of destroyed
+ # nodes, but I don't see an easy way for rollback() to do that
+ pass
+
def walk(self, match, node=None):
'''
walk recursively through the directory tree or a given
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -142,3 +142,4 @@
if backup != "strip":
os.unlink(chgrpfile)
+ repo.destroyed()
In my patch series, this comes right before "implement persistent tag
caching", hence the no-op implementation. My main question is, is
this internal hook-like API appropriate, or should we bite the bullet
and add a new hook for node destruction?
Greg
More information about the Mercurial-devel
mailing list