# HG changeset patch # User Mads Kiilerich # Date 2013-10-03 16:01:21 # Node ID dc4edca39e41de9f1b16f256954b192b762cc9b9 # Parent 77872b002e73fcea7c69612544acee36137fdc70 graft: make skip messages more helpful This makes it possible for the user to understand and accept or work around what is happening. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3021,11 +3021,12 @@ def graft(ui, repo, *revs, **opts): if n in ids: r = repo[n].rev() if r in revs: - ui.warn(_('skipping already grafted revision %s\n') % r) + 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 ' - '(same origin %d)\n') % (ids[n], r)) + '(%s also has origin %d)\n') % (ids[n], rev, r)) revs.remove(ids[n]) elif ctx.hex() in ids: r = ids[ctx.hex()] diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -117,7 +117,7 @@ Graft out of order, skipping a merge and $ hg graft 1 5 4 3 'merge()' 2 -n skipping ungraftable merge revision 6 - skipping already grafted revision 2 + skipping revision 2 (already grafted to 7) grafting revision 1 grafting revision 5 grafting revision 4 @@ -126,7 +126,7 @@ Graft out of order, skipping a merge and $ hg graft 1 5 4 3 'merge()' 2 --debug skipping ungraftable merge revision 6 scanning for duplicate grafts - skipping already grafted revision 2 + skipping revision 2 (already grafted to 7) grafting revision 1 searching for copies back to rev 1 unmatched files in local: @@ -196,9 +196,9 @@ Graft again: $ hg graft 1 5 4 3 'merge()' 2 skipping ungraftable merge revision 6 - skipping already grafted revision 2 - skipping already grafted revision 1 - skipping already grafted revision 5 + skipping revision 2 (already grafted to 7) + skipping revision 1 (already grafted to 8) + skipping revision 5 (already grafted to 9) grafting revision 4 merging e warning: conflicts during merge. @@ -314,18 +314,18 @@ Disallow grafting an already grafted cse Disallow grafting already grafted csets with the same origin onto each other $ hg up -q 13 $ hg graft 2 - skipping already grafted revision 2 + skipping revision 2 (already grafted to 13) [255] $ hg graft 7 - skipping already grafted revision 7 (same origin 2) + skipping already grafted revision 7 (13 also has origin 2) [255] $ hg up -q 7 $ hg graft 2 - skipping already grafted revision 2 + skipping revision 2 (already grafted to 7) [255] $ hg graft tip - skipping already grafted revision 13 (same origin 2) + skipping already grafted revision 13 (7 also has origin 2) [255] Graft with --log