Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 5753:ea1016b32e94
patchbomb: make --bundle respect --desc
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 27 Dec 2007 22:40:07 -0600 |
parents | 84a6e463b948 |
children | 43ee007dbd0e |
line wrap: on
line diff
--- a/hgext/patchbomb.py Fri Dec 28 16:41:40 2007 +0100 +++ b/hgext/patchbomb.py Thu Dec 27 22:40:07 2007 -0600 @@ -265,6 +265,15 @@ def genmsgid(id): return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) + def getdescription(body, sender): + if opts['desc']: + body = open(opts['desc']).read() + else: + ui.write(_('\nWrite the introductory message for the ' + 'patch series.\n\n')) + body = ui.edit(body, sender) + return body + def getexportmsgs(): patches = [] @@ -310,13 +319,7 @@ d = cdiffstat(_('Final summary:\n'), jumbo) if d: body = '\n' + d - if opts['desc']: - body = open(opts['desc']).read() - else: - ui.write(_('\nWrite the introductory message for the ' - 'patch series.\n\n')) - body = ui.edit(body, sender) - + body = getdescription(body, sender) msg = email.MIMEText.MIMEText(body) msg['Subject'] = subj @@ -326,9 +329,8 @@ def getbundlemsgs(bundle): subj = (opts['subject'] or prompt('Subject:', default='A bundle for your repository')) - ui.write(_('\nWrite the introductory message for the bundle.\n\n')) - body = ui.edit('', sender) + body = getdescription('', sender) msg = email.MIMEMultipart.MIMEMultipart() if body: msg.attach(email.MIMEText.MIMEText(body, 'plain'))