[PATCH] patchbomb: allow specifying default --flag options via config(issue5354)

Pulkit Goyal 7895pulkit at gmail.com
Tue Feb 21 03:25:07 UTC 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1487593583 -19800
#      Mon Feb 20 17:56:23 2017 +0530
# Node ID 3c7e816697791c48de126c06c069af23c9e2bc3a
# Parent  2c9e619ba9ee8e72370cc0f27f59da39947773b6
patchbomb: allow specifying default --flag options via config(issue5354)

This patch adds support for specifying default flag to be added while sending
patches using patchbomb per repsoitory. After this patch one can add flag to
email section in hgrc like

[email]
to = mercurial-devel at mecurial-scm.org
flag = evolve-ext

diff -r 2c9e619ba9ee -r 3c7e81669779 hgext/patchbomb.py
--- a/hgext/patchbomb.py	Sat Feb 18 17:23:43 2017 -0800
+++ b/hgext/patchbomb.py	Mon Feb 20 17:56:23 2017 +0530
@@ -202,9 +202,13 @@
     else:
         msg = mail.mimetextpatch(body, display=opts.get('test'))
 
+    fl = "flag"     # to avoid test-check-config.t from failing
+    defaultflag = repo.ui.config('email', fl)
     flag = ' '.join(opts.get('flag'))
     if flag:
         flag = ' ' + flag
+    if defaultflag:
+        flag = ' ' + defaultflag + flag
 
     subj = desc[0].strip().rstrip('. ')
     if not numbered:
diff -r 2c9e619ba9ee -r 3c7e81669779 tests/test-patchbomb.t
--- a/tests/test-patchbomb.t	Sat Feb 18 17:23:43 2017 -0800
+++ b/tests/test-patchbomb.t	Mon Feb 20 17:56:23 2017 +0530
@@ -2689,6 +2689,7 @@
 
   $ echo "[email]" >> $HGRCPATH
   $ echo "cc=" >> $HGRCPATH
+  $ echo "flag=abc" >> $HGRCPATH
 
 dest#branch URIs:
   $ hg email --date '1980-1-1 0:1' -n -t foo -s test -o ../t#test
@@ -2697,11 +2698,11 @@
   this patch series consists of 1 patches.
   
   
-  displaying [PATCH] test ...
+  displaying [PATCH abc] test ...
   Content-Type: text/plain; charset="us-ascii"
   MIME-Version: 1.0
   Content-Transfer-Encoding: 7bit
-  Subject: [PATCH] test
+  Subject: [PATCH abc] test
   X-Mercurial-Node: 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
   X-Mercurial-Series-Index: 1
   X-Mercurial-Series-Total: 1
@@ -2825,7 +2826,7 @@
 
 single rev
 
-  $ hg email --date '1980-1-1 0:1' -v -t foo -s test -r '10'
+  $ hg email --date '1980-1-1 0:1' -v -t foo -s test -r '10' --flag V2
   From [test]: test
   this patch series consists of 1 patches.
   
@@ -2835,7 +2836,7 @@
   Content-Type: text/plain; charset="us-ascii"
   MIME-Version: 1.0
   Content-Transfer-Encoding: 7bit
-  Subject: [PATCH] test
+  Subject: [PATCH abc V2] test
   X-Mercurial-Node: 3b6f1ec9dde933a40a115a7990f8b320477231af
   X-Mercurial-Series-Index: 1
   X-Mercurial-Series-Total: 1
@@ -2862,7 +2863,7 @@
    d
   +d
   
-  sending [PATCH] test ...
+  sending [PATCH abc V2] test ...
   sending mail: $TESTTMP/t2/pretendmail.sh -f test foo
 
 Test pull url header


More information about the Mercurial-devel mailing list