Show More
@@ -86,7 +86,13 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
86 | The message contains two or three body parts. First, the rest of |
|
86 | The message contains two or three body parts. First, the rest of | |
87 | the changeset description. Next, (optionally) if the diffstat |
|
87 | the changeset description. Next, (optionally) if the diffstat | |
88 | program is installed, the result of running diffstat on the patch. |
|
88 | program is installed, the result of running diffstat on the patch. | |
89 |
Finally, the patch itself, as generated by "hg export". |
|
89 | Finally, the patch itself, as generated by "hg export". | |
|
90 | ||||
|
91 | With --outgoing, emails will be generated for patches not | |||
|
92 | found in the target repository (or only those which are | |||
|
93 | ancestors of the specified revisions if any are provided) | |||
|
94 | ''' | |||
|
95 | ||||
90 | def prompt(prompt, default = None, rest = ': ', empty_ok = False): |
|
96 | def prompt(prompt, default = None, rest = ': ', empty_ok = False): | |
91 | if default: prompt += ' [%s]' % default |
|
97 | if default: prompt += ' [%s]' % default | |
92 | prompt += rest |
|
98 | prompt += rest | |
@@ -165,6 +171,36 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
165 | msg['X-Mercurial-Node'] = node |
|
171 | msg['X-Mercurial-Node'] = node | |
166 | return msg |
|
172 | return msg | |
167 |
|
173 | |||
|
174 | def outgoing(dest, revs): | |||
|
175 | '''Return the revisions present locally but not in dest''' | |||
|
176 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |||
|
177 | revs = [repo.lookup(rev) for rev in revs] | |||
|
178 | other = hg.repository(ui, dest) | |||
|
179 | ui.status(_('comparing with %s\n') % dest) | |||
|
180 | o = repo.findoutgoing(other) | |||
|
181 | if not o: | |||
|
182 | ui.status(_("no changes found\n")) | |||
|
183 | return [] | |||
|
184 | o = repo.changelog.nodesbetween(o, revs or None)[0] | |||
|
185 | return [str(repo.changelog.rev(r)) for r in o] | |||
|
186 | ||||
|
187 | # option handling | |||
|
188 | commands.setremoteconfig(ui, opts) | |||
|
189 | if opts.get('outgoing'): | |||
|
190 | if len(revs) > 1: | |||
|
191 | raise util.Abort(_("too many destinations")) | |||
|
192 | dest = revs and revs[0] or None | |||
|
193 | revs = [] | |||
|
194 | ||||
|
195 | if opts.get('rev'): | |||
|
196 | if revs: | |||
|
197 | raise util.Abort(_('use only one form to specify the revision')) | |||
|
198 | revs = opts.get('rev') | |||
|
199 | ||||
|
200 | if opts.get('outgoing'): | |||
|
201 | revs = outgoing(dest, opts.get('rev')) | |||
|
202 | ||||
|
203 | # start | |||
168 | start_time = util.makedate() |
|
204 | start_time = util.makedate() | |
169 |
|
205 | |||
170 | def genmsgid(id): |
|
206 | def genmsgid(id): | |
@@ -299,7 +335,9 b' cmdtable = {' | |||||
299 | ('', 'plain', None, 'omit hg patch header'), |
|
335 | ('', 'plain', None, 'omit hg patch header'), | |
300 | ('n', 'test', None, 'print messages that would be sent'), |
|
336 | ('n', 'test', None, 'print messages that would be sent'), | |
301 | ('m', 'mbox', '', 'write messages to mbox file instead of sending them'), |
|
337 | ('m', 'mbox', '', 'write messages to mbox file instead of sending them'), | |
|
338 | ('o', 'outgoing', None, _('send changes not found in the target repository')), | |||
|
339 | ('r', 'rev', [], _('a revision to send')), | |||
302 | ('s', 'subject', '', 'subject of first message (intro or single patch)'), |
|
340 | ('s', 'subject', '', 'subject of first message (intro or single patch)'), | |
303 | ('t', 'to', [], 'email addresses of recipients')], |
|
341 | ('t', 'to', [], 'email addresses of recipients')] + commands.remoteopts, | |
304 |
"hg email [OPTION]... [ |
|
342 | "hg email [OPTION]... [DEST]...") | |
305 | } |
|
343 | } |
General Comments 0
You need to be logged in to leave comments.
Login now