changeset 4570:78c50632437e

Merge with crew
author Brendan Cully <brendan@kublai.com>
date Wed, 13 Jun 2007 13:50:29 -0700
parents 622d8ed78b47 (current diff) 9b3a818adae6 (diff)
children eb403f295ff1 b1716a8b32d3
files
diffstat 3 files changed, 108 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Wed Jun 13 13:46:40 2007 -0700
+++ b/hgext/patchbomb.py	Wed Jun 13 13:50:29 2007 -0700
@@ -223,13 +223,15 @@
                 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 @@
         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 @@
 
     ui.write('\n')
 
-    if not opts['test'] and not opts['mbox']:
+    if really_sending:
         mailer = mail.connect(ui)
     parent = None
 
@@ -405,6 +410,7 @@
       ('', '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'),
--- a/tests/test-patchbomb	Wed Jun 13 13:46:40 2007 -0700
+++ b/tests/test-patchbomb	Wed Jun 13 13:50:29 2007 -0700
@@ -14,4 +14,7 @@
 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
--- a/tests/test-patchbomb.out	Wed Jun 13 13:46:40 2007 -0700
+++ b/tests/test-patchbomb.out	Wed Jun 13 13:50:29 2007 -0700
@@ -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: <patchbomb.120@
+Date: Thu, 01 Jan 1970 00:02:00 +0000
+From: quux
+To: foo
+Cc: bar
+
+
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [PATCH 1 of 2] a
+X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
+Message-Id: <8580ff50825a50c8f716.121@
+In-Reply-To: <patchbomb.120@
+Date: Thu, 01 Jan 1970 00:02:01 +0000
+From: quux
+To: foo
+Cc: bar
 
-use "hg -v help email" to show global options
-adding b
-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.
+# HG changeset patch
+# User test
+# Date 1 0
+# Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab
+# Parent  0000000000000000000000000000000000000000
+a
 
-    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)
+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
 
-    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)
+Content-Type: text/plain; charset="us-ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [PATCH 2 of 2] b
+X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
+Message-Id: <97d72e5f12c7e84f8506.122@
+In-Reply-To: <patchbomb.120@
+Date: Thu, 01 Jan 1970 00:02:02 +0000
+From: quux
+To: foo
+Cc: bar
 
-    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
+# HG changeset patch
+# User test
+# Date 2 0
+# Node ID 97d72e5f12c7e84f85064aa72e5a297142c36ed9
+# Parent  8580ff50825a50c8f716709acdf8de0deddcd6ab
+b
 
-    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
+diff -r 8580ff50825a -r 97d72e5f12c7 b
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/b	Thu Jan 01 00:00:02 1970 +0000
+@@ -0,0 +1,1 @@
++b
 
-    Before using this command, you will need to enable email in your hgrc.
-    See the [email] section in hgrc(5) for details.
+This patch series consists of 2 patches.
 
-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
+Write the introductory message for the patch series.
+
+
+Displaying [PATCH 0 of 2] test ...
+Displaying [PATCH 1 of 2] a ...
+Displaying [PATCH 2 of 2] b ...
+This patch series consists of 2 patches.
 
-use "hg -v help email" to show global options
+
+Write the introductory message for the patch series.
+
+
+Writing [PATCH 0 of 2] test ...
+Writing [PATCH 1 of 2] a ...
+Writing [PATCH 2 of 2] b ...