Patchwork [5,of,5,RFC] patchbomb: add support for a file that configures default To and CC

login
register
mail settings
Submitter Denis Laxalde
Date June 14, 2017, 7:46 a.m.
Message ID <0975cf34-27f9-f3b0-ea4f-c198c92c6cef@laxalde.org>
Download mbox | patch
Permalink /patch/21370/
State Not Applicable
Headers show

Comments

Denis Laxalde - June 14, 2017, 7:46 a.m.
Augie Fackler a écrit :
> Durham had the idea of a tweak to patchbomb that would let us not do https://www.mercurial-scm.org/wiki/Herald.
>
> I implemented filesets for the RFC, but I think we should probably also allow reset-based subscriptions too (e.g. "histedit" as a keyword or similar). I'd appreciate any feedback people have, since this was a quick project and it feels like it might have some real utility.
>
>

I really like the idea!
Another thing that'd be useful to me would be to have a "default"
section in .hgemaildefaults so that one would not need to type "--to
devel". Not sure how this could be formatted though.


Having played with it locally, I noticed that with an "email.to" setting
in hgrc, the --to option is no longer taken into account.
To reproduce:

    From [test]: test
Augie Fackler - June 14, 2017, 3:12 p.m.
> On Jun 14, 2017, at 03:46, Denis Laxalde <denis@laxalde.org> wrote:
> 
> Augie Fackler a écrit :
>> Durham had the idea of a tweak to patchbomb that would let us not do https://www.mercurial-scm.org/wiki/Herald.
>> 
>> I implemented filesets for the RFC, but I think we should probably also allow reset-based subscriptions too (e.g. "histedit" as a keyword or similar). I'd appreciate any feedback people have, since this was a quick project and it feels like it might have some real utility.
>> 
>> 
> 
> I really like the idea!
> Another thing that'd be useful to me would be to have a "default"
> section in .hgemaildefaults so that one would not need to type "--to
> devel". Not sure how this could be formatted though.

Yeah, I dithered on that a bit. I think for now I'd like to avoid too much magic here (defaults that can be changed by other people are something we've intentionally steered clear of for trust reasons) and require people to specify an alias.

> 
> 
> Having played with it locally, I noticed that with an "email.to" setting
> in hgrc, the --to option is no longer taken into account.

That's not new in my patch, but it wasn't tested before. I'll add a new test in v2 before adding any new features.

(Specifically, for both email.to and email.cc, if the command line version is specified the config entry is ignored. This appears to be intentional, and it makes some amount of sense to me...)

> To reproduce:
> 
> diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
> --- a/tests/test-patchbomb.t
> +++ b/tests/test-patchbomb.t
> @@ -3080,6 +3080,45 @@ the To line because it has a setsubscrip
>    d
>   +d
> 
> +With an email.to configuration, the --to flag takes precedence:
> +  $ hg email --date '1970-1-1 0:2' --to=devel --to=foo --test -r 10 --config patchbomb.publicurl= --config email.to=bob@example.com
> +  From [test]: test
> +  this patch series consists of 1 patches.
> +
> +  Cc [c-or-d@example.com]: c-or-d@example.com
> +
> +  displaying [PATCH] dd ...
> +  Content-Type: text/plain; charset="us-ascii"
> +  MIME-Version: 1.0
> +  Content-Transfer-Encoding: 7bit
> +  Subject: [PATCH] dd
> +  X-Mercurial-Node: 3b6f1ec9dde933a40a115a7990f8b320477231af
> +  X-Mercurial-Series-Index: 1
> +  X-Mercurial-Series-Total: 1
> +  Message-Id: <3b6f1ec9dde933a40a11.*@*> (glob)
> +  X-Mercurial-Series-Id: <3b6f1ec9dde933a40a11.*@*> (glob)
> +  User-Agent: Mercurial-patchbomb/* (glob)
> +  Date: Thu, 01 Jan 1970 00:02:00 +0000
> +  From: test
> +  To: mercurial-devel@example.com
> +  Cc: c-or-d@example.com
> +
> +  # HG changeset patch
> +  # User test
> +  # Date 5 0
> +  #      Thu Jan 01 00:00:05 1970 +0000
> +  # Branch test
> +  # Node ID 3b6f1ec9dde933a40a115a7990f8b320477231af
> +  # Parent  2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
> +  dd
> +
> +  diff -r 2f9fa9b998c5 -r 3b6f1ec9dde9 d
> +  --- a/d      Thu Jan 01 00:00:04 1970 +0000
> +  +++ b/d      Thu Jan 01 00:00:05 1970 +0000
> +  @@ -1,1 +1,2 @@
> +   d
> +  +d
> +
> This change modifies file b
>   $ hg email --date '1970-1-1 0:2' --to=devel --test -r 1 --config patchbomb.publicurl=
>   From [test]: test
> 
> 
>

Patch

diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -3080,6 +3080,45 @@  the To line because it has a setsubscrip
     d
    +d

+With an email.to configuration, the --to flag takes precedence:
+  $ hg email --date '1970-1-1 0:2' --to=devel --to=foo --test -r 10 
--config patchbomb.publicurl= --config email.to=bob@example.com
+  From [test]: test
+  this patch series consists of 1 patches.
+
+  Cc [c-or-d@example.com]: c-or-d@example.com
+
+  displaying [PATCH] dd ...
+  Content-Type: text/plain; charset="us-ascii"
+  MIME-Version: 1.0
+  Content-Transfer-Encoding: 7bit
+  Subject: [PATCH] dd
+  X-Mercurial-Node: 3b6f1ec9dde933a40a115a7990f8b320477231af
+  X-Mercurial-Series-Index: 1
+  X-Mercurial-Series-Total: 1
+  Message-Id: <3b6f1ec9dde933a40a11.*@*> (glob)
+  X-Mercurial-Series-Id: <3b6f1ec9dde933a40a11.*@*> (glob)
+  User-Agent: Mercurial-patchbomb/* (glob)
+  Date: Thu, 01 Jan 1970 00:02:00 +0000
+  From: test
+  To: mercurial-devel@example.com
+  Cc: c-or-d@example.com
+
+  # HG changeset patch
+  # User test
+  # Date 5 0
+  #      Thu Jan 01 00:00:05 1970 +0000
+  # Branch test
+  # Node ID 3b6f1ec9dde933a40a115a7990f8b320477231af
+  # Parent  2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
+  dd
+
+  diff -r 2f9fa9b998c5 -r 3b6f1ec9dde9 d
+  --- a/d      Thu Jan 01 00:00:04 1970 +0000
+  +++ b/d      Thu Jan 01 00:00:05 1970 +0000
+  @@ -1,1 +1,2 @@
+   d
+  +d
+
  This change modifies file b
    $ hg email --date '1970-1-1 0:2' --to=devel --test -r 1 --config 
patchbomb.publicurl=