[PATCH] convert: properly pass null ids through .hgtags (issue4678)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed May 27 18:16:26 CDT 2015



On 05/27/2015 03:17 PM, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1432754909 18000
> #      Wed May 27 14:28:29 2015 -0500
> # Branch stable
> # Node ID a50dbbf2c38b83872a4a5d6d1f2b649f93dac261
> # Parent  b1b89a0a606d74bfb48dfad239a352c55d3499b3
> convert: properly pass null ids through .hgtags (issue4678)

Sure, pushed to the clowncopter.

>
> 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.
>
> diff -r b1b89a0a606d -r a50dbbf2c38b hgext/convert/hg.py
> --- 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()
>
> diff -r b1b89a0a606d -r a50dbbf2c38b tests/test-convert-hg-source.t
> --- 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 ..
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list