From 27827959c9b8cdd0dc82a8ff28b2f71b68f726d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Tue, 11 Sep 2007 05:57:14 +0200 Subject: [PATCH] Add shortlog of patch series to cover mail MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Unlike the cover mail diffstat, this covers exactly the selected patches and nothing else. Signed-off-by: Karl Hasselström --- stgit/commands/mail.py | 41 +++++++++++++++++++++++++---------------- stgit/stack.py | 7 +++++++ templates/covermail.tmpl | 3 +++ 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py index c223665..c32894e 100644 --- a/stgit/commands/mail.py +++ b/stgit/commands/mail.py @@ -58,28 +58,35 @@ SMTP authentication is also possible with '--smtp-user' and 'smtpuser' and 'smtppassword'. TLS encryption can be enabled by '--smtp-tls' option and 'smtptls' setting. -The patch e-mail template accepts the following variables: +The following variables are accepted by both the preamble and the +patch e-mail templates: - %(patch)s - patch name - %(sender)s - 'sender' or 'authname ' as per the config file - %(shortdescr)s - the first line of the patch description - %(longdescr)s - the rest of the patch description, after the first line - %(diff)s - unified diff of the patch %(diffstat)s - diff statistics - %(version)s - ' version' string passed on the command line (or empty) - %(prefix)s - 'prefix ' string passed on the command line + %(number)s - empty if only one patch is sent or ' patchnr/totalnr' %(patchnr)s - patch number + %(sender)s - 'sender' or 'authname ' as per the config file %(totalnr)s - total number of patches to be sent - %(number)s - empty if only one patch is sent or ' patchnr/totalnr' - %(fromauth)s - 'From: author\\n\\n' if different from sender - %(authname)s - author's name - %(authemail)s - author's email + %(version)s - ' version' string passed on the command line (or empty) + +In addition to the common variables, the preamble e-mail template +accepts the following: + + %(shortlog)s - first line of each patch description, listed by author + +In addition to the common variables, the patch e-mail template accepts +the following: + %(authdate)s - patch creation date - %(commname)s - committer's name + %(authemail)s - author's email + %(authname)s - author's name %(commemail)s - committer's e-mail - -For the preamble e-mail template, only the %(diffstat)s, %(sender)s, -%(version)s, %(patchnr)s, %(totalnr)s and %(number)s variables are supported.""" + %(commname)s - committer's name + %(diff)s - unified diff of the patch + %(fromauth)s - 'From: author\\n\\n' if different from sender + %(longdescr)s - the rest of the patch description, after the first line + %(patch)s - patch name + %(prefix)s - 'prefix ' string passed on the command line + %(shortdescr)s - the first line of the patch description""" options = [make_option('-a', '--all', help = 'e-mail all the applied patches', @@ -339,6 +346,8 @@ def __build_cover(tmpl, patches, msg_id, options): 'patchnr': patch_nr_str, 'totalnr': total_nr_str, 'number': number_str, + 'shortlog': stack.shortlog(crt_series.get_patch(p) + for p in patches), 'diffstat': git.diffstat( rev1 = git_id('%s//bottom' % patches[0]), rev2 = git_id('%s//top' % patches[-1]))} diff --git a/stgit/stack.py b/stgit/stack.py index b19ff4d..906e6b1 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -22,6 +22,7 @@ import sys, os, re from stgit.utils import * from stgit.out import * +from stgit.run import * from stgit import git, basedir, templates from stgit.config import config from shutil import copyfile @@ -348,6 +349,12 @@ class PatchSet(StgitObject): return bool(config.get(self.format_version_key())) +def shortlog(patches): + log = ''.join(Run('git-log', '--pretty=short', + p.get_top(), '^%s' % p.get_bottom()).raw_output() + for p in patches) + return Run('git-shortlog').raw_input(log).raw_output() + class Series(PatchSet): """Class including the operations on series """ diff --git a/templates/covermail.tmpl b/templates/covermail.tmpl index adc0b92..5cf11b5 100644 --- a/templates/covermail.tmpl +++ b/templates/covermail.tmpl @@ -3,6 +3,9 @@ Subject: [%(prefix)sPATCH%(version)s%(number)s] Series short description The following series implements... +--- + +%(shortlog)s %(diffstat)s -- Signature -- 2.11.0