# HG changeset patch # User Thomas Arendsen Hein # Date 1340204563 -7200 # Node ID 55e7f352b1d35a1ab65e714e736cb2fa8286d945 # Parent 1aae34f109fd5ba5e7317d38c5da3d69a6a02d98 graft: allow -r to specify revisions diff -r 1aae34f109fd -r 55e7f352b1d3 mercurial/commands.py --- a/mercurial/commands.py Wed Jun 20 16:49:04 2012 +0200 +++ b/mercurial/commands.py Wed Jun 20 17:02:43 2012 +0200 @@ -2600,7 +2600,8 @@ @command( 'graft', - [('c', 'continue', False, _('resume interrupted graft')), + [('r', 'rev', [], _('revisions to graft'), _('REV')), + ('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, @@ -2608,7 +2609,7 @@ ('U', 'currentuser', False, _('record the current user as committer'), _('DATE'))] + commitopts2 + mergetoolopts + dryrunopts, - _('[OPTION]... REV...')) + _('[OPTION]... [-r] REV...')) def graft(ui, repo, *revs, **opts): '''copy changes from other branches onto the current branch @@ -2658,6 +2659,9 @@ Returns 0 on successful completion. ''' + revs = list(revs) + revs.extend(opts['rev']) + if not opts.get('user') and opts.get('currentuser'): opts['user'] = ui.username() if not opts.get('date') and opts.get('currentdate'): diff -r 1aae34f109fd -r 55e7f352b1d3 tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t Wed Jun 20 16:49:04 2012 +0200 +++ b/tests/test-debugcomplete.t Wed Jun 20 17:02:43 2012 +0200 @@ -247,7 +247,7 @@ debugsub: rev debugwalk: include, exclude debugwireargs: three, four, five, ssh, remotecmd, insecure - graft: continue, edit, log, currentdate, currentuser, date, user, tool, dry-run + graft: rev, 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, keyword diff -r 1aae34f109fd -r 55e7f352b1d3 tests/test-graft.t --- a/tests/test-graft.t Wed Jun 20 16:49:04 2012 +0200 +++ b/tests/test-graft.t Wed Jun 20 17:02:43 2012 +0200 @@ -54,6 +54,18 @@ skipping ancestor revision 2 [255] +Specify revisions with -r: + + $ hg graft -r 1 -r 2 + skipping ancestor revision 1 + skipping ancestor revision 2 + [255] + + $ hg graft -r 1 2 + skipping ancestor revision 2 + skipping ancestor revision 1 + [255] + Can't graft with dirty wd: $ hg up -q 0 @@ -179,6 +191,10 @@ abort: can't specify --continue and revisions [255] + $ hg graft -c -r 6 + abort: can't specify --continue and revisions + [255] + Continue for real, clobber usernames $ hg graft -c -U