changeset 50246:a6b497872b97 stable

patchbomb: respect the `--git` option I *think* this is the only diffopt exposed on the command line. TortoiseHg had a similar issue creating diffopts, and this was caught by type hints in the next commit.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 28 Feb 2023 18:14:11 -0500
parents dbe09fb038fc
children b8cac4e37100
files hgext/patchbomb.py tests/test-patchbomb.t
diffstat 2 files changed, 43 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Wed Mar 01 16:48:09 2023 +0100
+++ b/hgext/patchbomb.py	Tue Feb 28 18:14:11 2023 -0500
@@ -361,7 +361,12 @@
             ui.warn(_(b'warning: working directory has uncommitted changes\n'))
         output = stringio()
         cmdutil.exportfile(
-            repo, [r], output, opts=patch.difffeatureopts(ui, opts, git=True)
+            repo,
+            [r],
+            output,
+            opts=patch.difffeatureopts(
+                ui, pycompat.byteskwargs(opts), git=True
+            ),
         )
         yield output.getvalue().split(b'\n')
 
--- a/tests/test-patchbomb.t	Wed Mar 01 16:48:09 2023 +0100
+++ b/tests/test-patchbomb.t	Tue Feb 28 18:14:11 2023 -0500
@@ -183,6 +183,43 @@
   +a
   
 
+Test --git is respected
+  $ hg email --git --date '1970-1-1 0:1' -n -f quux -t foo -c bar -r tip
+  this patch series consists of 1 patches.
+  
+  
+  displaying [PATCH] a ...
+  MIME-Version: 1.0
+  Content-Type: text/plain; charset="us-ascii"
+  Content-Transfer-Encoding: 7bit
+  Subject: [PATCH] a
+  X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
+  X-Mercurial-Series-Index: 1
+  X-Mercurial-Series-Total: 1
+  Message-Id: <8580ff50825a50c8f716.60@test-hostname>
+  X-Mercurial-Series-Id: <8580ff50825a50c8f716.60@test-hostname>
+  User-Agent: Mercurial-patchbomb/* (glob)
+  Date: Thu, 01 Jan 1970 00:01:00 +0000
+  From: quux
+  To: foo
+  Cc: bar
+  
+  # HG changeset patch
+  # User test
+  # Date 1 0
+  #      Thu Jan 01 00:00:01 1970 +0000
+  # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab
+  # Parent  0000000000000000000000000000000000000000
+  a
+  
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +a
+  
+
 
 Test breaking format changes aren't
   $ hg --config diff.noprefix=True email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -r tip