# HG changeset patch # User Patrick Mezard # Date 1198816807 21600 # Node ID ea1016b32e948f57cd3de4bcad248197e91e4d43 # Parent 84a6e463b948dbad4e21340dfcf7b9a701e68093 patchbomb: make --bundle respect --desc diff -r 84a6e463b948 -r ea1016b32e94 hgext/patchbomb.py --- 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')) diff -r 84a6e463b948 -r ea1016b32e94 tests/test-patchbomb --- a/tests/test-patchbomb Fri Dec 28 16:41:40 2007 +0100 +++ b/tests/test-patchbomb Thu Dec 27 22:40:07 2007 -0600 @@ -1,20 +1,46 @@ #!/bin/sh +fixheaders() +{ + sed -e 's/\(Message-Id:.*@\).*/\1/' \ + -e 's/\(In-Reply-To:.*@\).*/\1/' \ + -e 's/===.*/===/' +} + echo "[extensions]" >> $HGRCPATH echo "patchbomb=" >> $HGRCPATH -hg init +hg init t +cd t echo a > a hg commit -Ama -d '1 0' hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar tip | \ - sed -e 's/\(Message-Id:.*@\).*/\1/' + fixheaders echo b > b hg commit -Amb -d '2 0' hg email --date '1970-1-1 0:2' -n -f quux -t foo -c bar -s test 0:tip | \ - sed -e 's/\(Message-Id:.*@\).*/\1/' | \ - sed -e 's/\(In-Reply-To:.*@\).*/\1/' + fixheaders hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip + +cd .. + +hg clone -q t t2 +cd t2 +echo c > c +hg commit -Amc -d '3 0' + +cat > description <