tags: update tag type only if tag node is updated (issue3911) stable
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 30 Apr 2013 09:02:02 +0900
branchstable
changeset 19108 cb95716da5fe
parent 19107 fcf08023c011
child 19109 26c51e87e807
tags: update tag type only if tag node is updated (issue3911) Before this patch, tag type information is always updated, even if tag previously read in has higher priority than one newly read in. This causes that the tag type is displayed as "local", even if global tag overwrites existing local one successfully. This patch updates tag type only if tag node is updated. This patch tests overwriting local tags below: - visible one (normal case) - already removed one (recorded as null)
mercurial/tags.py
tests/test-tags.t
--- a/mercurial/tags.py	Tue Apr 30 01:04:35 2013 +0200
+++ b/mercurial/tags.py	Tue Apr 30 09:02:02 2013 +0900
@@ -132,9 +132,10 @@
         if (bnode != anode and anode in bhist and
             (bnode not in ahist or len(bhist) > len(ahist))):
             anode = bnode
+        else:
+            tagtypes[name] = tagtype
         ahist.extend([n for n in bhist if n not in ahist])
         alltags[name] = anode, ahist
-        tagtypes[name] = tagtype
 
 
 # The tag cache only stores info about heads, not the tag contents
--- a/tests/test-tags.t	Tue Apr 30 01:04:35 2013 +0200
+++ b/tests/test-tags.t	Tue Apr 30 09:02:02 2013 +0900
@@ -381,4 +381,26 @@
   localtag                           0:bbd179dfa0a7 local
   globaltag                          0:bbd179dfa0a7
 
+Test for issue3911
+
+  $ hg tag -r 0 -l localtag2
+  $ hg tag -l --remove localtag2
+  $ hg tags -v
+  tip                                1:a0b6fe111088
+  localtag                           0:bbd179dfa0a7 local
+  globaltag                          0:bbd179dfa0a7
+
+  $ hg tag -r 1 -f localtag
+  $ hg tags -v
+  tip                                2:5c70a037bb37
+  localtag                           1:a0b6fe111088
+  globaltag                          0:bbd179dfa0a7
+
+  $ hg tag -r 1 localtag2
+  $ hg tags -v
+  tip                                3:bbfb8cd42be2
+  localtag2                          1:a0b6fe111088
+  localtag                           1:a0b6fe111088
+  globaltag                          0:bbd179dfa0a7
+
   $ cd ..