Mercurial > hg
diff hgext/convert/hg.py @ 21765:44255f7ce886
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.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 11 Jun 2014 22:19:29 -0400 |
parents | 503bb3af70fe |
children | 650b5b6e75ed |
line wrap: on
line diff
--- a/hgext/convert/hg.py Wed Jun 18 20:59:36 2014 -0500 +++ b/hgext/convert/hg.py Wed Jun 11 22:19:29 2014 -0400 @@ -165,6 +165,24 @@ text = text.replace(sha1, newrev[:len(sha1)]) extra = commit.extra.copy() + + for label in ('source', 'transplant_source', 'rebase_source'): + node = extra.get(label) + + if node is None: + continue + + # Only transplant stores its reference in binary + if label == 'transplant_source': + node = hex(node) + + newrev = revmap.get(node) + if newrev is not None: + if label == 'transplant_source': + newrev = bin(newrev) + + extra[label] = newrev + if self.branchnames and commit.branch: extra['branch'] = commit.branch if commit.rev: