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 3/3] git-multimail: Add stdout option to config
Date: Wed, 22 Apr 2015 07:04:47 +0800	[thread overview]
Message-ID: <1429657487-10809-3-git-send-email-daveboutcher@gmail.com> (raw)
In-Reply-To: <1429657487-10809-1-git-send-email-daveboutcher@gmail.com>

Add a stdout option to the config that is equivalent to the --stdout
command line option. This allows for easier debugging for a hook

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

diff --git a/git-multimail/README b/git-multimail/README
index 49e0937..0235b83 100644
--- a/git-multimail/README
+++ b/git-multimail/README
@@ -400,6 +400,11 @@ multimailhook.quiet
 
     Do not output the list of email recipients from the hook
 
+multimailhook.stdout
+
+    For debugging, send emails to stdout rather than to the
+    mailer.  Equivalent to the --stdout command line option
+
 Email filtering aids
 --------------------
 
diff --git a/git-multimail/git_multimail.py b/git-multimail/git_multimail.py
index 095110a..35a1140 100755
--- a/git-multimail/git_multimail.py
+++ b/git-multimail/git_multimail.py
@@ -1585,6 +1585,9 @@ class Environment(object):
         quiet (bool)
             On success do not write to stderr
 
+        stdout (bool)
+            Write email to stdout rather than emailing. Useful for debugging
+
     """
 
     REPO_NAME_RE = re.compile(r'^(?P<name>.+?)(?:\.git)$')
@@ -1598,6 +1601,7 @@ class Environment(object):
         self.refchange_showlog = False
         self.commitlogopts = ['-C', '--stat', '-p', '--cc']
         self.quiet = False
+        self.stdout = False
 
         self.COMPUTED_KEYS = [
             'administrator',
@@ -1753,6 +1757,10 @@ class ConfigOptionsEnvironmentMixin(ConfigEnvironmentMixin):
             'quiet', default=False
             )
 
+        self.stdout = config.get_bool(
+            'stdout', default=False
+            )
+
         maxcommitemails = config.get('maxcommitemails')
         if maxcommitemails is not None:
             try:
@@ -2563,7 +2571,7 @@ def main(args):
                 sys.stderr.write('    %s : %r\n' % (k, v))
             sys.stderr.write('\n')
 
-        if options.stdout:
+        if options.stdout or environment.stdout:
             mailer = OutputMailer(sys.stdout)
         else:
             mailer = choose_mailer(config, environment)
-- 
2.3.0

  parent 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 ` [PATCH 2/3] git-multimail: Add a quiet option to prevent outputting email addresses from hook Dave Boutcher
2015-04-21 23:04 ` Dave Boutcher [this message]
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-3-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).