[PATCH] convert: update the transplant, rebase and graft references in 'extra'

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Jun 11 23:15:28 CDT 2014


On Jun 11, 2014, at 10:53 PM, Matt Harbison <matt_harbison at yahoo.com> wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1402539569 14400
> #      Wed Jun 11 22:19:29 2014 -0400
> # Node ID 8c1d30924cc1a5ebbdc810565e1b73a4902653a7
> # Parent  0f73ed6293629f69aa2f01d8940e91faeded49ae
> convert: update the transplant, rebase and graft references in 'extra'
> 
> This change allows the origin() and destination() revsets to yield the same
> results in the new and old repos after a conversion.  Previously, nothing would
> be listed for queries in the new repo.
> 
> Like the SHA1 updates to the commit messages, this is only operational when the
> 'convert.hg.saverev=True' option is specified.  If the old reference cannot be
> found, it is left as-is.  It seems slightly better to leave stale evidence of
> the graft/transplant/rebase than to eliminate it entirely.
> 
> diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
> --- a/hgext/convert/hg.py
> +++ b/hgext/convert/hg.py
> @@ -165,6 +165,24 @@
>                 text = text.replace(sha1, newrev[:len(sha1)])
> 
>         extra = commit.extra.copy()
> +
> +        for label in ('source', 'transplant_source', 'rebase_source'):
> +            rev = extra.get(label)

Nit: it's a changeset ID, not a revision number. Call this 'node' or 'id'.

Other than that, looks straightforward.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list