diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-04-10 15:05:40 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-04-10 15:05:40 -0400 |
commit | 3f06f6fb40b41813e946154d591f4d1f37b52f85 (patch) | |
tree | cc4f650ea9b1773b54b718f5e704f99e3a1d022f /b4/__init__.py | |
parent | 39181293c0cb1780e56e3eaee9ac2cc8abd8d43f (diff) | |
download | b4-3f06f6fb40b41813e946154d591f4d1f37b52f85.tar.gz |
Add summaries to default templates
They are much more useful if b4.thanks-commit-url-mask is set, but even
without them this will list all subjects and corresponding commit IDs.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/__init__.py')
-rw-r--r-- | b4/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 54cc42b..a49f439 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -93,6 +93,12 @@ DEFAULT_CONFIG = { 'attestation-checkmarks': 'fancy', # How long to keep things in cache before expiring (minutes)? 'cache-expire': '10', + # Used when creating summaries for b4 ty + 'thanks-commit-url-mask': None, + # See thanks-pr-template.example + 'thanks-pr-template': None, + # See thanks-am-template.example + 'thanks-am-template': None, # If this is not set, we'll use what we find in # git-config for gpg.program, and if that's not set, # we'll use "gpg" and hope for the better @@ -1673,3 +1679,17 @@ def format_addrs(pairs): # Remove any quoted-printable header junk from the name addrs.add(email.utils.formataddr((LoreMessage.clean_header(pair[0]), LoreMessage.clean_header(pair[1])))) return ', '.join(addrs) + + +def make_quote(body, maxlines=5): + quotelines = list() + qcount = 0 + for line in body.split('\n'): + # Quote the first paragraph only and then [snip] if we quoted more than maxlines + if qcount > maxlines and (not len(line.strip()) or line.strip().find('---') == 0): + quotelines.append('> ') + quotelines.append('> [...]') + break + quotelines.append('> %s' % line.strip('\r\n')) + qcount += 1 + return '\n'.join(quotelines) |