Add common bundle/outgoing options to hg email
authorJohn Goerzen <jgoerzen@complete.org>
Mon, 26 Mar 2007 13:57:49 -0500
changeset 4279 126d1967a3f8
parent 4278 cfe886c14ddf
child 4280 a9336520a4ee
Add common bundle/outgoing options to hg email
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 @@
         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 @@
 
     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 @@
         return [msg]
 
     if opts.get('bundle'):
-        msgs = getbundlemsgs(getbundle(dest, revs))
+        msgs = getbundlemsgs(getbundle(dest))
     else:
         msgs = getexportmsgs()
 
@@ -380,6 +382,10 @@
       ('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]...")
     }