changeset 6671:938eddd76237

tag: record tag we're superseding, if any (issue 1102)
author Matt Mackall <mpm@selenic.com>
date Fri, 13 Jun 2008 17:29:10 -0500
parents be55b1a6d4b1
children 6004eedb13f4
files mercurial/localrepo.py tests/test-1102 tests/test-1102.out tests/test-tag.out tests/test-tags.out
diffstat 5 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Jun 13 12:34:23 2008 +0200
+++ b/mercurial/localrepo.py	Fri Jun 13 17:29:10 2008 -0500
@@ -147,7 +147,11 @@
             if prevtags and prevtags[-1] != '\n':
                 fp.write('\n')
             for name in names:
-                fp.write('%s %s\n' % (hex(node), munge and munge(name) or name))
+                m = munge and munge(name) or name
+                if self._tagstypecache and name in self._tagstypecache:
+                    old = self.tagscache.get(name, nullid)
+                    fp.write('%s %s\n' % (hex(old), m))
+                fp.write('%s %s\n' % (hex(node), m))
             fp.close()
 
         prevtags = ''
@@ -303,9 +307,8 @@
             n = nh[0]
             if n != nullid:
                 self.tagscache[k] = n
-                self._tagstypecache[k] = tagtypes[k]
+            self._tagstypecache[k] = tagtypes[k]
         self.tagscache['tip'] = self.changelog.tip()
-
         return self.tagscache
 
     def tagtype(self, tagname):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-1102	Fri Jun 13 17:29:10 2008 -0500
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+rm -rf a
+hg init a
+cd a
+echo a > a
+hg ci -Am0
+hg tag t1 # 1
+hg tag --remove t1 # 2
+
+hg co 1
+hg tag -r0 t1
+hg tags
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-1102.out	Fri Jun 13 17:29:10 2008 -0500
@@ -0,0 +1,4 @@
+adding a
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+tip                                3:a49829c4fc11
+t1                                 0:f7b1eb17ad24
--- a/tests/test-tag.out	Fri Jun 13 12:34:23 2008 +0200
+++ b/tests/test-tag.out	Fri Jun 13 17:29:10 2008 -0500
@@ -36,7 +36,9 @@
 868cc8fbb43b754ad09fa109885d243fc49adae7 gawk
 868cc8fbb43b754ad09fa109885d243fc49adae7 gorp
 3807bcf62c5614cb6c16436b514d7764ca5f1631 gack
+3807bcf62c5614cb6c16436b514d7764ca5f1631 gack
 0000000000000000000000000000000000000000 gack
+868cc8fbb43b754ad09fa109885d243fc49adae7 gorp
 0000000000000000000000000000000000000000 gorp
 3ecf002a1c572a2f3bb4e665417e60fca65bbd42 bleah1
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
--- a/tests/test-tags.out	Fri Jun 13 12:34:23 2008 +0200
+++ b/tests/test-tags.out	Fri Jun 13 17:29:10 2008 -0500
@@ -45,16 +45,16 @@
 created new head
 tip                                4:36195b728445
 bar                                1:b204a97e6e8d
-changeset:   5:57e1983b4a60
+changeset:   5:1f98c77278de
 tag:         tip
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000
 summary:     Removed tag bar
 
-tip                                5:57e1983b4a60
+tip                                5:1f98c77278de
 % remove nonexistent tag
 abort: tag 'foobar' does not exist
-changeset:   5:57e1983b4a60
+changeset:   5:1f98c77278de
 tag:         tip
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000