Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 22302:9472284df4eb stable
graft: fix collision detection with origin revisions that are missing
When grafting something with a matching origin, it would normally be skipped:
skipping already grafted revision 123 (23 also has origin 12)
But after stripping a graft origin, graft could fail with a reference to the
origin that no longer exists:
abort: unknown revision '5c095ad7e90f871700f02dd1fa5012cb4498a2d4'!
Instead, detect that the origin is unknown and skip it anyway, like:
skipping already grafted revision 8 (2 also has unknown origin 5c095ad7e90f871700f02dd1fa5012cb4498a2d4)
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 27 Aug 2014 15:30:09 +0200 |
parents | 328efb5ca0b4 |
children | bdc0e04df243 6a8b8efb0641 |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Aug 23 17:03:08 2014 -0500 +++ b/mercurial/commands.py Wed Aug 27 15:30:09 2014 +0200 @@ -3183,14 +3183,23 @@ ctx = repo[rev] n = ctx.extra().get('source') if n in ids: - r = repo[n].rev() + try: + r = repo[n].rev() + except error.RepoLookupError: + r = None if r in revs: ui.warn(_('skipping revision %s (already grafted to %s)\n') % (r, rev)) revs.remove(r) elif ids[n] in revs: - ui.warn(_('skipping already grafted revision %s ' - '(%s also has origin %d)\n') % (ids[n], rev, r)) + if r is None: + ui.warn(_('skipping already grafted revision %s ' + '(%s also has unknown origin %s)\n') + % (ids[n], rev, n)) + else: + ui.warn(_('skipping already grafted revision %s ' + '(%s also has origin %d)\n') + % (ids[n], rev, r)) revs.remove(ids[n]) elif ctx.hex() in ids: r = ids[ctx.hex()]