graft: allow -r to specify revisions
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 20 Jun 2012 17:02:43 +0200
changeset 16992 55e7f352b1d3
parent 16991 1aae34f109fd
child 16993 0a0395bfd3ef
graft: allow -r to specify revisions
mercurial/commands.py
tests/test-debugcomplete.t
tests/test-graft.t
--- 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'):
--- 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
--- 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