changeset 19646:335a558f81dc stable 2.7.1

tags: write tag overwriting history also into tag cache file (issue3911) Before this patch, tag overwriting history is not written into tag cache file ".hg/cache/tags". This may give higher priority to local tag than global one, even if the former is overwritten by the latter, because tag overwriting history is used to compare priorities of them (as "rank"). In such cases, "hg tags" invocations using tag cache file shows incorrect tag information. This patch writes tag overwriting history also into tag cache file.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 28 Aug 2013 22:09:53 +0900
parents bd5c1b49d106
children 3d2e07c863d4
files mercurial/tags.py tests/test-tags.t
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/tags.py	Mon Aug 26 16:11:21 2013 +0900
+++ b/mercurial/tags.py	Wed Aug 28 22:09:53 2013 +0900
@@ -290,6 +290,8 @@
     # the cache.
     cachefile.write('\n')
     for (name, (node, hist)) in cachetags.iteritems():
+        for n in hist:
+            cachefile.write("%s %s\n" % (hex(n), name))
         cachefile.write("%s %s\n" % (hex(node), name))
 
     try:
--- a/tests/test-tags.t	Mon Aug 26 16:11:21 2013 +0900
+++ b/tests/test-tags.t	Wed Aug 28 22:09:53 2013 +0900
@@ -221,6 +221,8 @@
   3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
   2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
   
+  bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
+  bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
   78391a272241d70354aa14c874552cad6b51bb42 bar
 
 Test tag removal:
@@ -396,6 +398,11 @@
   localtag                           1:a0b6fe111088
   globaltag                          0:bbd179dfa0a7
 
+  $ hg tags -v
+  tip                                2:5c70a037bb37
+  localtag                           1:a0b6fe111088
+  globaltag                          0:bbd179dfa0a7
+
   $ hg tag -r 1 localtag2
   $ hg tags -v
   tip                                3:bbfb8cd42be2
@@ -403,4 +410,10 @@
   localtag                           1:a0b6fe111088
   globaltag                          0:bbd179dfa0a7
 
+  $ hg tags -v
+  tip                                3:bbfb8cd42be2
+  localtag2                          1:a0b6fe111088
+  localtag                           1:a0b6fe111088
+  globaltag                          0:bbd179dfa0a7
+
   $ cd ..