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.
--- a/mercurial/localrepo.py Wed Jan 18 17:18:38 2012 +0100
+++ b/mercurial/localrepo.py Thu Jan 19 02:14:06 2012 +0100
@@ -326,6 +326,8 @@
fp.close()
+ self.invalidatecaches()
+
if '.hgtags' not in self.dirstate:
self[None].add(['.hgtags'])
--- a/tests/test-hook.t Wed Jan 18 17:18:38 2012 +0100
+++ b/tests/test-hook.t Thu Jan 19 02:14:06 2012 +0100
@@ -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']
+