git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Boutcher <daveboutcher@gmail.com>
To: git@vger.kernel.org
Cc: mhagger@alum.mit.edu, Dave Boutcher <daveboutcher@gmail.com>
Subject: [PATCH 2/3] git-multimail: Add a quiet option to prevent outputting email addresses from hook
Date: Wed, 22 Apr 2015 07:04:46 +0800	[thread overview]
Message-ID: <1429657487-10809-2-git-send-email-daveboutcher@gmail.com> (raw)
In-Reply-To: <1429657487-10809-1-git-send-email-daveboutcher@gmail.com>

We have a very log list of recipients...displaying that list
on every push is annoying

Add an option to prevent printing the list of email addresses from
the hook

Signed-off-by: Dave Boutcher <daveboutcher@gmail.com>
---
 git-multimail/README           |  3 +++
 git-multimail/git_multimail.py | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/git-multimail/README b/git-multimail/README
index a40847a..49e0937 100644
--- a/git-multimail/README
+++ b/git-multimail/README
@@ -396,6 +396,9 @@ multimailhook.replyToRefchange
     - The value "none", in which case the Reply-To: field will be
       omitted.
 
+multimailhook.quiet
+
+    Do not output the list of email recipients from the hook
 
 Email filtering aids
 --------------------
diff --git a/git-multimail/git_multimail.py b/git-multimail/git_multimail.py
index 5ed253f..095110a 100755
--- a/git-multimail/git_multimail.py
+++ b/git-multimail/git_multimail.py
@@ -1582,6 +1582,9 @@ class Environment(object):
             commit mail.  The value should be a list of strings
             representing words to be passed to the command.
 
+        quiet (bool)
+            On success do not write to stderr
+
     """
 
     REPO_NAME_RE = re.compile(r'^(?P<name>.+?)(?:\.git)$')
@@ -1594,6 +1597,7 @@ class Environment(object):
         self.logopts = []
         self.refchange_showlog = False
         self.commitlogopts = ['-C', '--stat', '-p', '--cc']
+        self.quiet = False
 
         self.COMPUTED_KEYS = [
             'administrator',
@@ -1745,6 +1749,10 @@ class ConfigOptionsEnvironmentMixin(ConfigEnvironmentMixin):
             'refchangeshowlog', default=self.refchange_showlog
             )
 
+        self.quiet = config.get_bool(
+            'quiet', default=False
+            )
+
         maxcommitemails = config.get('maxcommitemails')
         if maxcommitemails is not None:
             try:
@@ -2376,7 +2384,8 @@ class Push(object):
                     % (change.refname, change.old.sha1, change.new.sha1,)
                     )
             else:
-                sys.stderr.write('Sending notification emails to: %s\n' % (change.recipients,))
+                if not self.environment.quiet:
+                    sys.stderr.write('Sending notification emails to: %s\n' % (change.recipients,))
                 extra_values = {'send_date': send_date.next()}
                 mailer.send(
                     change.generate_email(self, body_filter, extra_values),
-- 
2.3.0

  reply	other threads:[~2015-04-21 23:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 23:04 [PATCH 1/3] git-multimail: Add an option to filter on branches Dave Boutcher
2015-04-21 23:04 ` Dave Boutcher [this message]
2015-04-21 23:04 ` [PATCH 3/3] git-multimail: Add stdout option to config Dave Boutcher
2015-04-22 10:39 ` [PATCH 1/3] git-multimail: Add an option to filter on branches Michael Haggerty
2015-04-22 10:46   ` Dave Boutcher
2015-04-22 11:44     ` Michael Haggerty
2015-04-23  1:48       ` Dave Boutcher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429657487-10809-2-git-send-email-daveboutcher@gmail.com \
    --to=daveboutcher@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).