changeset 21498:6b8daeea638a

convert: mercurial source: convert global tags only - not local tags Mercurial tags can be local (tag -l, stored in .hg/localtags) or global (normal tags, tracked in .hgtags) ... or extensions can add other kind of tags. Convert would take all tags (except "tip"), not just the ones from .hgtags, and put them into .hgtags. Instead, convert only the global tags that come from .hgtags.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 16 May 2014 02:30:27 +0200
parents 798c81e32b5e
children d22f4e72dcd5
files hgext/convert/hg.py tests/test-convert-hg-sink.t
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/hg.py	Sun Apr 20 18:15:38 2014 -0700
+++ b/hgext/convert/hg.py	Fri May 16 02:30:27 2014 +0200
@@ -394,7 +394,9 @@
                       sortkey=ctx.rev())
 
     def gettags(self):
-        tags = [t for t in self.repo.tagslist() if t[0] != 'tip']
+        # This will get written to .hgtags, filter non global tags out.
+        tags = [t for t in self.repo.tagslist()
+                if self.repo.tagtype(t[0]) == 'global']
         return dict([(name, hex(node)) for name, node in tags
                      if self.keep(node)])
 
--- a/tests/test-convert-hg-sink.t	Sun Apr 20 18:15:38 2014 -0700
+++ b/tests/test-convert-hg-sink.t	Fri May 16 02:30:27 2014 +0200
@@ -16,8 +16,10 @@
   $ echo file > foo/file
   $ hg ci -qAm 'add foo/file'
   $ hg tag some-tag
+  $ hg tag -l local-tag
   $ hg log
   changeset:   3:593cbf6fb2b4
+  tag:         local-tag
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000