use .extend instead of .append in readtags
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Mon, 04 Jun 2007 00:24:48 -0300
changeset 4482 99f411ba0380
parent 4481 50a46ae14efb
child 4483 769cc8ef5b72
use .extend instead of .append in readtags
mercurial/localrepo.py
tests/test-tags
tests/test-tags.out
--- a/mercurial/localrepo.py	Fri Apr 20 16:17:42 2007 -0500
+++ b/mercurial/localrepo.py	Mon Jun 04 00:24:48 2007 -0300
@@ -307,7 +307,7 @@
                 if bn != an and an in bh and \
                    (bn not in ah or len(bh) > len(ah)):
                     an = bn
-                ah.append([n for n in bh if n not in ah])
+                ah.extend([n for n in bh if n not in ah])
                 globaltags[k] = an, ah
 
         # read the tags file from each head, ending with the tip
--- a/tests/test-tags	Fri Apr 20 16:17:42 2007 -0500
+++ b/tests/test-tags	Mon Jun 04 00:24:48 2007 -0300
@@ -104,4 +104,21 @@
 hg tags
 
 hg tag -d '1000000 0' -r 3 bar         # should complain
-hg tags
\ No newline at end of file
+hg tags
+
+# test tag rank with 3 heads
+cd ..
+hg init t4
+cd t4
+echo foo > foo
+hg add
+hg ci -m 'add foo' -d '0 0'                # rev 0
+hg tag -d '0 0' bar                        # rev 1 bar -> 0
+hg tag -d '0 0' -f bar                     # rev 2 bar -> 1
+hg up -qC 0
+hg tag -d '0 0' -fr 2 bar                  # rev 3 bar -> 2
+hg tags
+hg up -qC 0
+hg tag -d '0 0' -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
+echo % bar should still point to rev 2
+hg tags
--- a/tests/test-tags.out	Fri Apr 20 16:17:42 2007 -0500
+++ b/tests/test-tags.out	Mon Jun 04 00:24:48 2007 -0300
@@ -57,3 +57,9 @@
 abort: a tag named bar already exists (use -f to force)
 tip                                6:b5ff9d142648
 bar                                0:b409d9da318e
+adding foo
+tip                                3:ca8479b4351c
+bar                                2:72b852876a42
+% bar should still point to rev 2
+tip                                4:40af5d225513
+bar                                2:72b852876a42