aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-15 13:56:13 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-15 13:56:13 -0400
commitc4469dc30c30f629b1d725b663d80e8a78956c61 (patch)
tree4072252e820c65256df8070f353a1d97c3bd5712
parent7a1a978790036f35b8d3d83b80105be1ca15ccd6 (diff)
downloadb4-c4469dc30c30f629b1d725b663d80e8a78956c61.tar.gz
Keep track of how many messages we create
Don't tell us to run git send-email when there's nothing to send. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ty.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/b4/ty.py b/b4/ty.py
index 4b69f5c..0592af5 100644
--- a/b4/ty.py
+++ b/b4/ty.py
@@ -320,6 +320,7 @@ def send_messages(listing, gitdir, outdir, branch, since='1.week'):
else:
signature = '%s <%s>' % (usercfg['name'], usercfg['email'])
+ outgoing = 0
for jsondata in listing:
slug_from = re.sub(r'\W', '_', jsondata['fromemail'])
slug_subj = re.sub(r'\W', '_', jsondata['subject'])
@@ -337,6 +338,8 @@ def send_messages(listing, gitdir, outdir, branch, since='1.week'):
if msg is None:
continue
+
+ outgoing += 1
outfile = os.path.join(outdir, '%s.thanks' % slug)
logger.info(' Writing: %s', outfile)
bout = msg.as_string(policy=b4.emlpolicy)
@@ -346,6 +349,11 @@ def send_messages(listing, gitdir, outdir, branch, since='1.week'):
fullpath = os.path.join(datadir, jsondata['trackfile'])
os.rename(fullpath, '%s.sent' % fullpath)
logger.info('---')
+ if not outgoing:
+ logger.info('No thanks necessary.')
+ return
+
+ logger.debug('Wrote %s thank-you letters', outgoing)
logger.info('You can now run:')
logger.info(' git send-email %s/*.thanks', outdir)