[PATCH] Add --outgoing option to patchbomb
Brendan Cully
brendan at kublai.com
Wed Mar 21 14:16:18 CDT 2007
# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1174504528 25200
# Node ID 8269cd88c4725baaf519d356150e67770dc19f8c
# Parent fe0fe0b4d73b32f9197f386140f2eb9363a13f7f
Add --outgoing option to patchbomb
diff -r fe0fe0b4d73b -r 8269cd88c472 hgext/patchbomb.py
--- a/hgext/patchbomb.py Tue Mar 20 22:21:05 2007 -0300
+++ b/hgext/patchbomb.py Wed Mar 21 12:15:28 2007 -0700
@@ -164,6 +164,22 @@ def patchbomb(ui, repo, *revs, **opts):
msg['Subject'] = subj
msg['X-Mercurial-Node'] = node
return msg
+
+ def outgoing(dest, revs):
+ '''Return the revisions present locally but not in dest'''
+ dest = ui.expandpath(dest)
+ revs = [repo.lookup(rev) for rev in revs]
+ other = hg.repository(ui, dest)
+ ui.status(_('comparing with %s\n') % dest)
+ o = repo.findoutgoing(other)
+ if not o:
+ ui.status(_("no changes found\n"))
+ return []
+ o = repo.changelog.nodesbetween(o, revs or None)[0]
+ return [str(repo.changelog.rev(r)) for r in o]
+
+ if opts.get('outgoing'):
+ revs = outgoing(opts.get('outgoing'), revs)
start_time = util.makedate()
@@ -299,6 +315,7 @@ cmdtable = {
('', 'plain', None, 'omit hg patch header'),
('n', 'test', None, 'print messages that would be sent'),
('m', 'mbox', '', 'write messages to mbox file instead of sending them'),
+ ('o', 'outgoing', '', 'send patches not in the target repository'),
('s', 'subject', '', 'subject of first message (intro or single patch)'),
('t', 'to', [], 'email addresses of recipients')],
"hg email [OPTION]... [REV]...")
More information about the Mercurial-devel
mailing list