# HG changeset patch # User Mads Kiilerich <mads@kiilerich.com> # Date 1326935646 -3600 # Thu Jan 19 02:14:06 2012 +0100 # Node ID 4091660dc130f4c20699c47855f17b7310eca555 # Parent 3a51eb88046aaecb22cb7d3ee970670502dda783 tag: invalidate tag cache immediately after adding new tag (issue3210) New tags were written to .hgtags / .hglocaltags without updating or invalidating the localrepo cache. Before afd459933d5f a lock was acquired soon after the new tags had been written, and that invalidated the cache so the new tags for example could be seen in pretxncommit hooks. With afd459933d5f the lock had already been acquired at this point and the missing cache invalidation was exposed. The tag caches will now explicitly and immediately be invalidated when new tags are added. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -326,6 +326,8 @@ fp.close() + self.invalidatecaches() + if '.hgtags' not in self.dirstate: self[None].add(['.hgtags']) diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -353,6 +353,9 @@ > def verbosehook(ui, **args): > ui.note('verbose output from hook\n') > + > def printtags(ui, repo, **args): + > print repo.tags().keys() + > > class container: > unreachable = 1 > EOF @@ -569,3 +572,10 @@ calling hook pre-identify.c: hooktests.verbosehook verbose output from hook cb9a9f314b8b + +new tags must be visible in pretxncommit (issue3210) + + $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc + $ hg tag -f foo + ['a', 'foo', 'tip'] +