# HG changeset patch # User Brendan Cully # Date 1181767829 25200 # Node ID 78c50632437eb9133c6570936a5021fd84ad8731 # Parent 622d8ed78b4731389a8b78fa0900e4d7567db26c# Parent 9b3a818adae63d272165d1833cbc85f95df5c124 Merge with crew diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -223,13 +223,15 @@ def patchbomb(ui, repo, *revs, **opts): pass os.rmdir(tmpdir) - if not opts['test']: + really_sending = not (opts['test'] or opts['mbox']) + + if really_sending: mail.validateconfig(ui) if not (revs or opts.get('rev') or opts.get('outgoing')): raise util.Abort(_('specify at least one changeset with -r or -o')) - commands.setremoteconfig(ui, opts) + cmdutil.setremoteconfig(ui, opts) if opts.get('outgoing') and opts.get('bundle'): raise util.Abort(_("--outgoing mode always on with --bundle; do not re-specify --outgoing")) @@ -250,7 +252,10 @@ def patchbomb(ui, repo, *revs, **opts): opts['revs'] = revs # start - start_time = util.makedate() + if opts.get('date'): + start_time = util.parsedate(opts['date']) + else: + start_time = util.makedate() def genmsgid(id): return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) @@ -351,7 +356,7 @@ def patchbomb(ui, repo, *revs, **opts): ui.write('\n') - if not opts['test'] and not opts['mbox']: + if really_sending: mailer = mail.connect(ui) parent = None @@ -405,6 +410,7 @@ cmdtable = { ('', 'bcc', [], 'email addresses of blind copy recipients'), ('c', 'cc', [], 'email addresses of copy recipients'), ('d', 'diffstat', None, 'add diffstat output to messages'), + ('', 'date', '', _('use the given date as the sending date')), ('g', 'git', None, _('use git extended diff format')), ('f', 'from', '', 'email address of sender'), ('', 'plain', None, 'omit hg patch header'), diff --git a/tests/test-patchbomb b/tests/test-patchbomb --- a/tests/test-patchbomb +++ b/tests/test-patchbomb @@ -14,4 +14,7 @@ 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:.*@\|In-Reply-To:.*@\).*/\1/' + sed -e 's/\(Message-Id:.*@\).*/\1/' | \ + sed -e 's/\(In-Reply-To:.*@\).*/\1/' + +hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip diff --git a/tests/test-patchbomb.out b/tests/test-patchbomb.out --- a/tests/test-patchbomb.out +++ b/tests/test-patchbomb.out @@ -1,134 +1,109 @@ adding a -hg email: option --date not recognized -hg email [OPTION]... [DEST]... - -send changesets by email - - By default, diffs are sent in the format generated by hg export, - one per message. The series starts with a "[PATCH 0 of N]" - introduction, which describes the series as a whole. +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [PATCH] a +X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab +Message-Id: <8580ff50825a50c8f716.60@ +Date: Thu, 01 Jan 1970 00:01:00 +0000 +From: quux +To: foo +Cc: bar - Each patch email has a Subject line of "[PATCH M of N] ...", using - the first line of the changeset description as the subject text. - The message contains two or three body parts. First, the rest of - the changeset description. Next, (optionally) if the diffstat - program is installed, the result of running diffstat on the patch. - Finally, the patch itself, as generated by "hg export". - - With --outgoing, emails will be generated for patches not - found in the destination repository (or only those which are - ancestors of the specified revisions if any are provided) +# HG changeset patch +# User test +# Date 1 0 +# Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab +# Parent 0000000000000000000000000000000000000000 +a - With --bundle, changesets are selected as for --outgoing, - but a single email containing a binary Mercurial bundle as an - attachment will be sent. - - Examples: - - hg email -r 3000 # send patch 3000 only - hg email -r 3000 -r 3001 # send patches 3000 and 3001 - hg email -r 3000:3005 # send patches 3000 through 3005 - hg email 3000 # send patch 3000 (deprecated) +diff -r 000000000000 -r 8580ff50825a a +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:01 1970 +0000 +@@ -0,0 +1,1 @@ ++a - hg email -o # send all patches not in default - hg email -o DEST # send all patches not in DEST - hg email -o -r 3000 # send all ancestors of 3000 not in default - hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST +This patch series consists of 1 patches. - hg email -b # send bundle of all patches not in default - hg email -b DEST # send bundle of all patches not in DEST - hg email -b -r 3000 # bundle of all ancestors of 3000 not in default - hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST - - Before using this command, you will need to enable email in your hgrc. - See the [email] section in hgrc(5) for details. - -options: - -a --attach send patches as inline attachments - --bcc email addresses of blind copy recipients - -c --cc email addresses of copy recipients - -d --diffstat add diffstat output to messages - -g --git use git extended diff format - -f --from email address of sender - --plain omit hg patch header - -n --test print messages that would be sent - -m --mbox write messages to mbox file instead of sending them - -o --outgoing send changes not found in the target repository - -b --bundle send changes not in target as a binary bundle - -r --rev a revision to send - -s --subject subject of first message (intro or single patch) - -t --to email addresses of recipients - --force run even when remote repository is unrelated (with -b) - --base a base changeset to specify instead of a destination (with -b) - -e --ssh specify ssh command to use - --remotecmd specify hg command to run on the remote side +Displaying [PATCH] a ... +adding b +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [PATCH 0 of 2] test +Message-Id: