diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -288,10 +288,10 @@ class localrepository(repo.repository): warn(_("tag '%s' refers to unknown node") % key) continue - h = {} + h = [] if key in filetags: n, h = filetags[key] - h[n] = True + h.append(n) filetags[key] = (bin_n, h) for k,nh in filetags.items(): @@ -307,7 +307,7 @@ class localrepository(repo.repository): if bn != an and an in bh and \ (bn not in ah or len(bh) > len(ah)): an = bn - ah.update(bh) + ah.append([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 diff --git a/tests/test-tags b/tests/test-tags --- a/tests/test-tags +++ b/tests/test-tags @@ -80,6 +80,25 @@ echo >> foo hg ci -m 'change foo 2' -d '1000000 0' # rev 4 hg tags +# test tag removal hg tag --remove -d '1000000 0' bar hg tip hg tags + +# test tag rank +cd .. +hg init t3 +cd t3 +echo foo > foo +hg add foo +hg ci -m 'add foo' -d '1000000 0' # rev 0 +hg tag -d '1000000 0' bar # rev 1 bar -> 0 +hg tag -d '1000000 0' bar # rev 2 bar -> 1 +hg tag -d '1000000 0' -r 0 bar # rev 3 bar -> 0 +hg tag -d '1000000 0' -r 1 bar # rev 3 bar -> 1 +hg tag -d '1000000 0' -r 0 bar # rev 4 bar -> 0 +hg tags +hg co 3 +echo barbar > foo +hg ci -m 'change foo' -d '1000000 0' # rev 0 +hg tags diff --git a/tests/test-tags.out b/tests/test-tags.out --- a/tests/test-tags.out +++ b/tests/test-tags.out @@ -49,3 +49,8 @@ date: Mon Jan 12 13:46:40 1970 +0 summary: Removed tag bar tip 5:57e1983b4a60 +tip 5:d8bb4d1eff25 +bar 0:b409d9da318e +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +tip 6:b5ff9d142648 +bar 0:b409d9da318e