changeset 25305:884ef09cf658 stable

convert: properly pass null ids through .hgtags (issue4678) Mercurial uses tags of null to mark deletions, but convert was silently discarding these because it had no mapping for them. Thus, it was resurrecting deleted tags.
author Matt Mackall <mpm@selenic.com>
date Wed, 27 May 2015 14:28:29 -0500
parents b1b89a0a606d
children a4acf019dd5b 8594d0b3018e
files hgext/convert/hg.py tests/test-convert-hg-source.t
diffstat 2 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/hg.py	Tue May 26 13:02:28 2015 -0700
+++ b/hgext/convert/hg.py	Wed May 27 14:28:29 2015 -0500
@@ -128,7 +128,10 @@
                 continue
             revid = revmap.get(source.lookuprev(s[0]))
             if not revid:
-                continue
+                if s[0] == hex(nullid):
+                    revid = s[0]
+                else:
+                    continue
             fp.write('%s %s\n' % (revid, s[1]))
         return fp.getvalue()
 
--- a/tests/test-convert-hg-source.t	Tue May 26 13:02:28 2015 -0700
+++ b/tests/test-convert-hg-source.t	Wed May 27 14:28:29 2015 -0500
@@ -38,6 +38,13 @@
   (branch merge, don't forget to commit)
   $ hg ci -m 'merge remote copy' -d '4 0'
   created new head
+
+Make and delete some tags
+
+  $ hg tag that
+  $ hg tag --remove that
+  $ hg tag this
+
 #if execbit
   $ chmod +x baz
 #else
@@ -50,11 +57,14 @@
   scanning source...
   sorting...
   converting...
-  5 add foo bar
-  4 change foo
-  3 make bar and baz copies of foo
-  2 merge local copy
-  1 merge remote copy
+  8 add foo bar
+  7 change foo
+  6 make bar and baz copies of foo
+  5 merge local copy
+  4 merge remote copy
+  3 Added tag that for changeset 88586c4e9f02
+  2 Removed tag that
+  1 Added tag this for changeset c56a7f387039
   0 mark baz executable
   updating bookmarks
   $ cd new
@@ -66,12 +76,12 @@
 #if execbit
   $ hg bookmarks
      premerge1                 3:973ef48a98a4
-     premerge2                 5:13d9b87cf8f8
+     premerge2                 8:91d107c423ba
 #else
 Different hash because no x bit
   $ hg bookmarks
      premerge1                 3:973ef48a98a4
-     premerge2                 5:df0779bcf33c
+     premerge2                 8:3537b15eaaca
 #endif
   $ cd ..