mq: add --git option to qimport -r
authorBrendan Cully <brendan@kublai.com>
Mon, 20 Nov 2006 13:03:52 -0800
changeset 3691 79151c94c3b4
parent 3688 d92dad355000
child 3692 49136e90517b
mq: add --git option to qimport -r
hgext/mq.py
--- a/hgext/mq.py	Mon Nov 20 19:55:59 2006 +0100
+++ b/hgext/mq.py	Mon Nov 20 13:03:52 2006 -0800
@@ -1262,7 +1262,7 @@
         return p
 
     def qimport(self, repo, files, patchname=None, rev=None, existing=None,
-                force=None):
+                force=None, git=False):
         def checkseries(patchname):
             if patchname in self.series:
                 raise util.Abort(_('patch %s is already in the series file')
@@ -1307,6 +1307,9 @@
                                      % rev[0])
                 lastparent = None
 
+            if git:
+                self.diffopts().git = True
+
             for r in rev:
                 p1, p2 = repo.changelog.parentrevs(r)
                 n = repo.changelog.node(r)
@@ -1424,10 +1427,13 @@
 
     An existing changeset may be placed under mq control with --rev
     (e.g. qimport --rev tip -n patch will place tip under mq control).
+    With --git, patches imported with --rev will use the git diff
+    format.
     """
     q = repo.mq
     q.qimport(repo, filename, patchname=opts['name'],
-              existing=opts['existing'], force=opts['force'], rev=opts['rev'])
+              existing=opts['existing'], force=opts['force'], rev=opts['rev'],
+              git=opts['git'])
     q.save_dirty()
     return 0
 
@@ -2090,8 +2096,9 @@
          [('e', 'existing', None, 'import file in patch dir'),
           ('n', 'name', '', 'patch file name'),
           ('f', 'force', None, 'overwrite existing files'),
-          ('r', 'rev', [], 'place existing revisions under mq control')],
-         'hg qimport [-e] [-n NAME] [-f] [-r REV]... FILE...'),
+          ('r', 'rev', [], 'place existing revisions under mq control'),
+          ('g', 'git', None, _('use git extended diff format'))],
+         'hg qimport [-e] [-n NAME] [-f] [-g] [-r REV]... FILE...'),
     "^qinit":
         (init,
          [('c', 'create-repo', None, 'create queue repository')],