Patchwork [1,of,2] graft: make skip messages more helpful

login
register
mail settings
Submitter Mads Kiilerich
Date Oct. 10, 2013, 6:52 p.m.
Message ID <19c8e9f1869948ab5675.1381431146@mk-desktop>
Download mbox | patch
Permalink /patch/2748/
State Accepted
Commit dc4edca39e41de9f1b16f256954b192b762cc9b9
Headers show

Comments

Mads Kiilerich - Oct. 10, 2013, 6:52 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1380816081 -7200
#      Thu Oct 03 18:01:21 2013 +0200
# Node ID 19c8e9f1869948ab5675e625b4676768a991e1f1
# Parent  e828975722c8ff632f08cbeb84ec184da2952823
graft: make skip messages more helpful

This makes it possible for the user to understand and accept or work around
what is happening.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3021,11 +3021,12 @@ 
         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 @@ 
 
   $ 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 @@ 
   $ 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 @@ 
 
   $ 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 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