[PATCH] Add common bundle/outgoing options to hg email

John Goerzen jgoerzen at complete.org
Mon Mar 26 13:57:53 CDT 2007


# HG changeset patch
# User John Goerzen <jgoerzen at complete.org>
# Date 1174935469 18000
# Node ID 126d1967a3f86bf0c3e5fdb7679c6d195a5a702d
# Parent  cfe886c14ddfdd8caea11c97f9a427f96eb0308b
Add common bundle/outgoing options to hg email

diff -r cfe886c14ddf -r 126d1967a3f8 hgext/patchbomb.py
--- a/hgext/patchbomb.py	Mon Mar 26 13:37:48 2007 -0500
+++ b/hgext/patchbomb.py	Mon Mar 26 13:57:49 2007 -0500
@@ -185,11 +185,11 @@ def patchbomb(ui, repo, *revs, **opts):
         o = repo.changelog.nodesbetween(o, revs or None)[0]
         return [str(repo.changelog.rev(r)) for r in o]
 
-    def getbundle(dest, revs):
+    def getbundle(dest):
         tmpdir = tempfile.mkdtemp(prefix='hg-email-bundle-')
         tmpfn = os.path.join(tmpdir, 'bundle')
         try:
-            commands.bundle(ui, repo, tmpfn, dest, *revs, **{'force': 0})
+            commands.bundle(ui, repo, tmpfn, dest, **opts)
             return open(tmpfn).read()
         finally:
             try:
@@ -216,6 +216,8 @@ def patchbomb(ui, repo, *revs, **opts):
 
     if opts.get('outgoing'):
         revs = outgoing(dest, opts.get('rev'))
+    if opts.get('bundle'):
+        opts['revs'] = revs
 
     # start
     start_time = util.makedate()
@@ -311,7 +313,7 @@ def patchbomb(ui, repo, *revs, **opts):
         return [msg]
 
     if opts.get('bundle'):
-        msgs = getbundlemsgs(getbundle(dest, revs))
+        msgs = getbundlemsgs(getbundle(dest))
     else:
         msgs = getexportmsgs()
 
@@ -380,6 +382,10 @@ cmdtable = {
       ('b', 'bundle', None, _('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')] + commands.remoteopts,
+      ('t', 'to', [], 'email addresses of recipients'),
+      ('', 'force', None, _('run even when remote repository is unrelated (with -b)')),
+      ('', 'base', [],
+          _('a base changeset to specify instead of a destination (with -b)'))]
+      + commands.remoteopts,
      "hg email [OPTION]... [DEST]...")
     }


More information about the Mercurial-devel mailing list