Note: The diffstat is computed from the bottom of the first patch to
the top of the last, which gives a correct result if and only if the
series is contiguous. This is often the case, and handling anything
but this case is nontrivial, as it would involve creating a temporary
series of commits that are contiguous, with all the performance and
merge problems that would entail.
Signed-off-by: Karl Hasselström <kha@treskal.com>
%(commname)s - committer's name
%(commemail)s - committer's e-mail
%(commname)s - committer's name
%(commemail)s - committer's e-mail
-For the preamble e-mail template, only the %(sender)s, %(version)s,
-%(patchnr)s, %(totalnr)s and %(number)s variables are supported."""
+For the preamble e-mail template, only the %(diffstat)s, %(sender)s,
+%(version)s, %(patchnr)s, %(totalnr)s and %(number)s variables are supported."""
options = [make_option('-a', '--all',
help = 'e-mail all the applied patches',
options = [make_option('-a', '--all',
help = 'e-mail all the applied patches',
-def __build_cover(tmpl, total_nr, msg_id, options):
+def __build_cover(tmpl, patches, msg_id, options):
"""Build the cover message (series description) to be sent via SMTP
"""
sender = __get_sender()
"""Build the cover message (series description) to be sent via SMTP
"""
sender = __get_sender()
- total_nr_str = str(total_nr)
+ total_nr_str = str(len(patches))
patch_nr_str = '0'.zfill(len(total_nr_str))
patch_nr_str = '0'.zfill(len(total_nr_str))
number_str = ' %s/%s' % (patch_nr_str, total_nr_str)
else:
number_str = ''
number_str = ' %s/%s' % (patch_nr_str, total_nr_str)
else:
number_str = ''
'prefix': prefix_str,
'patchnr': patch_nr_str,
'totalnr': total_nr_str,
'prefix': prefix_str,
'patchnr': patch_nr_str,
'totalnr': total_nr_str,
+ 'number': number_str,
+ 'diffstat': git.diffstat(
+ rev1 = git_id('%s//bottom' % patches[0]),
+ rev2 = git_id('%s//top' % patches[-1]))}
try:
msg_string = tmpl % tmpl_dict
try:
msg_string = tmpl % tmpl_dict
raise CmdException, 'No cover message template file found'
msg_id = email.Utils.make_msgid('stgit')
raise CmdException, 'No cover message template file found'
msg_id = email.Utils.make_msgid('stgit')
- msg = __build_cover(tmpl, total_nr, msg_id, options)
+ msg = __build_cover(tmpl, patches, msg_id, options)
from_addr, to_addr_list = __parse_addresses(msg)
msg_string = msg.as_string(options.mbox)
from_addr, to_addr_list = __parse_addresses(msg)
msg_string = msg.as_string(options.mbox)
The following series implements...
The following series implements...