Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
22301:f6371cc62d2a | 22302:9472284df4eb |
---|---|
3181 | 3181 |
3182 for rev in repo.changelog.findmissingrevs(revs, [crev]): | 3182 for rev in repo.changelog.findmissingrevs(revs, [crev]): |
3183 ctx = repo[rev] | 3183 ctx = repo[rev] |
3184 n = ctx.extra().get('source') | 3184 n = ctx.extra().get('source') |
3185 if n in ids: | 3185 if n in ids: |
3186 r = repo[n].rev() | 3186 try: |
3187 r = repo[n].rev() | |
3188 except error.RepoLookupError: | |
3189 r = None | |
3187 if r in revs: | 3190 if r in revs: |
3188 ui.warn(_('skipping revision %s (already grafted to %s)\n') | 3191 ui.warn(_('skipping revision %s (already grafted to %s)\n') |
3189 % (r, rev)) | 3192 % (r, rev)) |
3190 revs.remove(r) | 3193 revs.remove(r) |
3191 elif ids[n] in revs: | 3194 elif ids[n] in revs: |
3192 ui.warn(_('skipping already grafted revision %s ' | 3195 if r is None: |
3193 '(%s also has origin %d)\n') % (ids[n], rev, r)) | 3196 ui.warn(_('skipping already grafted revision %s ' |
3197 '(%s also has unknown origin %s)\n') | |
3198 % (ids[n], rev, n)) | |
3199 else: | |
3200 ui.warn(_('skipping already grafted revision %s ' | |
3201 '(%s also has origin %d)\n') | |
3202 % (ids[n], rev, r)) | |
3194 revs.remove(ids[n]) | 3203 revs.remove(ids[n]) |
3195 elif ctx.hex() in ids: | 3204 elif ctx.hex() in ids: |
3196 r = ids[ctx.hex()] | 3205 r = ids[ctx.hex()] |
3197 ui.warn(_('skipping already grafted revision %s ' | 3206 ui.warn(_('skipping already grafted revision %s ' |
3198 '(was grafted from %d)\n') % (r, rev)) | 3207 '(was grafted from %d)\n') % (r, rev)) |