Show More
@@ -2547,15 +2547,32 b' def graft(ui, repo, *revs, **opts):' | |||
|
2547 | 2547 | if not revs: |
|
2548 | 2548 | return -1 |
|
2549 | 2549 | |
|
2550 | # analyze revs for earlier grafts | |
|
2551 | ids = {} | |
|
2552 | for ctx in repo.set("%ld", revs): | |
|
2553 | ids[ctx.hex()] = ctx.rev() | |
|
2554 | n = ctx.extra().get('source') | |
|
2555 | if n: | |
|
2556 | ids[n] = ctx.rev() | |
|
2557 | ||
|
2550 | 2558 | # check ancestors for earlier grafts |
|
2551 | 2559 | ui.debug('scanning for duplicate grafts\n') |
|
2552 | 2560 | for ctx in repo.set("::. - ::%ld", revs): |
|
2553 | 2561 | n = ctx.extra().get('source') |
|
2554 |
if n |
|
|
2562 | if n in ids: | |
|
2555 | 2563 | r = repo[n].rev() |
|
2556 | 2564 | if r in revs: |
|
2557 | 2565 | ui.warn(_('skipping already grafted revision %s\n') % r) |
|
2558 | 2566 | revs.remove(r) |
|
2567 | elif ids[n] in revs: | |
|
2568 | ui.warn(_('skipping already grafted revision %s ' | |
|
2569 | '(same origin %d)\n') % (ids[n], r)) | |
|
2570 | revs.remove(ids[n]) | |
|
2571 | elif ctx.hex() in ids: | |
|
2572 | r = ids[ctx.hex()] | |
|
2573 | ui.warn(_('skipping already grafted revision %s ' | |
|
2574 | '(was grafted from %d)\n') % (r, ctx.rev())) | |
|
2575 | revs.remove(r) | |
|
2559 | 2576 | if not revs: |
|
2560 | 2577 | return -1 |
|
2561 | 2578 |
@@ -255,3 +255,25 b' Graft again onto another branch should p' | |||
|
255 | 255 | 2 |
|
256 | 256 | |
|
257 | 257 | |
|
258 | Disallow grafting an already grafted cset onto its original branch | |
|
259 | $ hg up -q 6 | |
|
260 | $ hg graft 7 | |
|
261 | skipping already grafted revision 7 (was grafted from 2) | |
|
262 | [255] | |
|
263 | ||
|
264 | Disallow grafting already grafted csets with the same origin onto each other | |
|
265 | $ hg up -q 13 | |
|
266 | $ hg graft 2 | |
|
267 | skipping already grafted revision 2 | |
|
268 | [255] | |
|
269 | $ hg graft 7 | |
|
270 | skipping already grafted revision 7 (same origin 2) | |
|
271 | [255] | |
|
272 | ||
|
273 | $ hg up -q 7 | |
|
274 | $ hg graft 2 | |
|
275 | skipping already grafted revision 2 | |
|
276 | [255] | |
|
277 | $ hg graft tip | |
|
278 | skipping already grafted revision 13 (same origin 2) | |
|
279 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now