[PATCH 2 of 3] patchbomb: make --git-format-patch imply --git

Henning Schild henning at hennsch.de
Thu Nov 17 20:47:57 UTC 2016


# HG changeset patch
# User Henning Schild <henning at hennsch.de>
# Date 1479415556 -3600
#      Thu Nov 17 21:45:56 2016 +0100
# Node ID a9be53e26cb1ac19d1c0156062e8ae23f8366d8b
# Parent  7885eea6837bbb30c12e0833b71a6691008b489e
patchbomb: make --git-format-patch imply --git

--git-format-patch should not be used without --git, enforce that so the user
does not have to specify both.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -417,7 +417,8 @@
 
 @command('email',
     [('g', 'git', None, _('use git extended diff format')),
-    ('', 'git-format-patch', None, _('use git-format-patch email format')),
+    ('', 'git-format-patch', None, _('use git-format-patch email format '
+       '(implies --git)')),
     ('', 'plain', None, _('omit hg patch header')),
     ('o', 'outgoing', None,
      _('send changes not found in the target repository')),
@@ -524,6 +525,9 @@
     # internal option used by pbranches
     patches = opts.get('patches')
 
+    if (opts.get('git_format_patch')):
+        opts['git'] = True
+
     if not (opts.get('test') or mbox):
         # really sending
         mail.validateconfig(ui)
diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -723,8 +723,8 @@
   
 
 test diffstat for single patch for git:
-  $ hg email --git-format-patch --git --date '1970-1-1 0:1' -n -f quux -t foo \
-  >  -c bar -s test -d -y -r 2
+  $ hg email --git-format-patch --date '1970-1-1 0:1' -n -f quux -t foo -c bar \
+  >  -s test -d -y -r 2
   this patch series consists of 1 patches.
   
   
@@ -892,8 +892,8 @@
   
 
 test diffstat for multiple patches for git:
-  $ hg email --git-format-patch --git --date '1970-1-1 0:1' -n -f quux -t foo \
-  >  -c bar -s test -d -y -r 0:1
+  $ hg email --git-format-patch --date '1970-1-1 0:1' -n -f quux -t foo -c bar \
+  >  -s test -d -y -r 0:1
   this patch series consists of 2 patches.
   
   


More information about the Mercurial-devel mailing list