--- a/mercurial/commands.py Sat May 12 00:24:07 2012 +0200
+++ b/mercurial/commands.py Fri May 11 18:51:35 2012 +0200
@@ -2581,6 +2581,7 @@
'graft',
[('c', 'continue', False, _('resume interrupted graft')),
('e', 'edit', False, _('invoke editor on commit messages')),
+ ('', 'log', None, _('append graft info to log message')),
('D', 'currentdate', False,
_('record the current date as commit date')),
('U', 'currentuser', False,
@@ -2599,6 +2600,11 @@
Changesets that are ancestors of the current revision, that have
already been grafted, or that are merges will be skipped.
+ If --log is specified, log messages will have a comment appended
+ of the form::
+
+ (grafted from CHANGESETHASH)
+
If a graft merge results in conflicts, the graft process is
interrupted so that the current merge can be manually resolved.
Once all conflicts are addressed, the graft process can be
@@ -2748,7 +2754,10 @@
date = ctx.date()
if opts.get('date'):
date = opts['date']
- node = repo.commit(text=ctx.description(), user=user,
+ message = ctx.description()
+ if opts.get('log'):
+ message += '\n(grafted from %s)' % ctx.hex()
+ node = repo.commit(text=message, user=user,
date=date, extra=extra, editor=editor)
if node is None:
ui.status(_('graft for revision %s is empty\n') % ctx.rev())
--- a/tests/test-debugcomplete.t Sat May 12 00:24:07 2012 +0200
+++ b/tests/test-debugcomplete.t Fri May 11 18:51:35 2012 +0200
@@ -247,7 +247,7 @@
debugsub: rev
debugwalk: include, exclude
debugwireargs: three, four, five, ssh, remotecmd, insecure
- graft: continue, edit, currentdate, currentuser, date, user, tool, dry-run
+ graft: continue, edit, log, currentdate, currentuser, date, user, tool, dry-run
grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude
heads: rev, topo, active, closed, style, template
help: extension, command
--- a/tests/test-graft.t Sat May 12 00:24:07 2012 +0200
+++ b/tests/test-graft.t Fri May 11 18:51:35 2012 +0200
@@ -277,3 +277,13 @@
$ hg graft tip
skipping already grafted revision 13 (same origin 2)
[255]
+
+Graft with --log
+
+ $ hg up -Cq 1
+ $ hg graft 3 --log -u foo
+ grafting revision 3
+ warning: can't find ancestor for 'c' copied from 'b'!
+ $ hg log --template '{rev} {parents} {desc}\n' -r tip
+ 14 1:5d205f8b35b6 3
+ (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)