graft: show hashes in user-facing messages
Graft was in various places just showing the revision number in status
messges. Instead, also show the stable and more useful short hash.
--- a/mercurial/commands.py Tue Dec 09 03:38:23 2014 +0100
+++ b/mercurial/commands.py Tue Dec 09 03:38:23 2014 +0100
@@ -3396,7 +3396,8 @@
# don't mutate while iterating, create a copy
for rev in list(revs):
if rev in ancestors:
- ui.warn(_('skipping ancestor revision %s\n') % rev)
+ ui.warn(_('skipping ancestor revision %d:%s\n') %
+ (rev, repo[rev]))
# XXX remove on list is slow
revs.remove(rev)
if not revs:
@@ -3422,23 +3423,25 @@
except error.RepoLookupError:
r = None
if r in revs:
- ui.warn(_('skipping revision %s (already grafted to %s)\n')
- % (r, rev))
+ ui.warn(_('skipping revision %d:%s '
+ '(already grafted to %d:%s)\n')
+ % (r, repo[r], rev, ctx))
revs.remove(r)
elif ids[n] in revs:
if r is None:
- ui.warn(_('skipping already grafted revision %s '
- '(%s also has unknown origin %s)\n')
- % (ids[n], rev, n))
+ ui.warn(_('skipping already grafted revision %d:%s '
+ '(%d:%s also has unknown origin %s)\n')
+ % (ids[n], repo[ids[n]], rev, ctx, n[:12]))
else:
- ui.warn(_('skipping already grafted revision %s '
- '(%s also has origin %d)\n')
- % (ids[n], rev, r))
+ ui.warn(_('skipping already grafted revision %d:%s '
+ '(%d:%s also has origin %d:%s)\n')
+ % (ids[n], repo[ids[n]], rev, ctx, r, n[:12]))
revs.remove(ids[n])
elif ctx.hex() in ids:
r = ids[ctx.hex()]
- ui.warn(_('skipping already grafted revision %s '
- '(was grafted from %d)\n') % (r, rev))
+ ui.warn(_('skipping already grafted revision %d:%s '
+ '(was grafted from %d:%s)\n') %
+ (r, repo[r], rev, ctx))
revs.remove(r)
if not revs:
return -1
--- a/tests/test-graft.t Tue Dec 09 03:38:23 2014 +0100
+++ b/tests/test-graft.t Tue Dec 09 03:38:23 2014 +0100
@@ -50,20 +50,20 @@
Can't graft ancestor:
$ hg graft 1 2
- skipping ancestor revision 1
- skipping ancestor revision 2
+ skipping ancestor revision 1:5d205f8b35b6
+ skipping ancestor revision 2:5c095ad7e90f
[255]
Specify revisions with -r:
$ hg graft -r 1 -r 2
- skipping ancestor revision 1
- skipping ancestor revision 2
+ skipping ancestor revision 1:5d205f8b35b6
+ skipping ancestor revision 2:5c095ad7e90f
[255]
$ hg graft -r 1 2
- skipping ancestor revision 2
- skipping ancestor revision 1
+ skipping ancestor revision 2:5c095ad7e90f
+ skipping ancestor revision 1:5d205f8b35b6
[255]
Can't graft with dirty wd:
@@ -132,7 +132,7 @@
$ hg graft 1 5 4 3 'merge()' 2 -n
skipping ungraftable merge revision 6
- skipping revision 2 (already grafted to 7)
+ skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
grafting 1:5d205f8b35b6 "1"
grafting 5:97f8bfe72746 "5"
grafting 4:9c233e8e184d "4"
@@ -141,7 +141,7 @@
$ HGEDITOR=cat hg graft 1 5 4 3 'merge()' 2 --debug
skipping ungraftable merge revision 6
scanning for duplicate grafts
- skipping revision 2 (already grafted to 7)
+ skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
grafting 1:5d205f8b35b6 "1"
searching for copies back to rev 1
unmatched files in local:
@@ -213,9 +213,9 @@
$ hg graft 1 5 4 3 'merge()' 2
skipping ungraftable merge revision 6
- skipping revision 2 (already grafted to 7)
- skipping revision 1 (already grafted to 8)
- skipping revision 5 (already grafted to 9)
+ skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
+ skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
+ skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
grafting 4:9c233e8e184d "4"
merging e
warning: conflicts during merge.
@@ -326,24 +326,24 @@
Disallow grafting an already grafted cset onto its original branch
$ hg up -q 6
$ hg graft 7
- skipping already grafted revision 7 (was grafted from 2)
+ skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
[255]
Disallow grafting already grafted csets with the same origin onto each other
$ hg up -q 13
$ hg graft 2
- skipping revision 2 (already grafted to 13)
+ skipping revision 2:5c095ad7e90f (already grafted to 13:9db0f28fd374)
[255]
$ hg graft 7
- skipping already grafted revision 7 (13 also has origin 2)
+ skipping already grafted revision 7:ef0ef43d49e7 (13:9db0f28fd374 also has origin 2:5c095ad7e90f)
[255]
$ hg up -q 7
$ hg graft 2
- skipping revision 2 (already grafted to 7)
+ skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
[255]
$ hg graft tip
- skipping already grafted revision 13 (7 also has origin 2)
+ skipping already grafted revision 13:9db0f28fd374 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
[255]
Graft with --log
@@ -641,9 +641,9 @@
graft works on complex revset
$ hg graft 'origin(13) or destination(origin(13))'
- skipping ancestor revision 21
- skipping ancestor revision 22
- skipping revision 2 (already grafted to 22)
+ skipping ancestor revision 21:7e61b508e709
+ skipping ancestor revision 22:1313d0a825e2
+ skipping revision 2:5c095ad7e90f (already grafted to 22:1313d0a825e2)
grafting 7:ef0ef43d49e7 "2"
grafting 13:9db0f28fd374 "2"
grafting 19:9627f653b421 "2"
@@ -653,8 +653,8 @@
$ hg graft 19 0 6
skipping ungraftable merge revision 6
- skipping ancestor revision 0
- skipping already grafted revision 19 (22 also has origin 2)
+ skipping ancestor revision 0:68795b066622
+ skipping already grafted revision 19:9627f653b421 (22:1313d0a825e2 also has origin 2:5c095ad7e90f)
[255]
$ hg graft 19 0 6 --force
skipping ungraftable merge revision 6
@@ -670,7 +670,7 @@
reverting a
changeset 29:484c03b8dfa4 backs out changeset 28:6c56f0f7f033
$ hg graft 28
- skipping ancestor revision 28
+ skipping ancestor revision 28:6c56f0f7f033
[255]
$ hg graft 28 --force
grafting 28:6c56f0f7f033 "28"
@@ -708,7 +708,7 @@
$ hg --config extensions.mq= strip 2
saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-backup.hg (glob)
$ hg graft tmp
- skipping already grafted revision 8 (2 also has unknown origin 5c095ad7e90f871700f02dd1fa5012cb4498a2d4)
+ skipping already grafted revision 8:9db0f28fd374 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
[255]
Empty graft