183 ui.status(_("no changes found\n")) |
183 ui.status(_("no changes found\n")) |
184 return [] |
184 return [] |
185 o = repo.changelog.nodesbetween(o, revs or None)[0] |
185 o = repo.changelog.nodesbetween(o, revs or None)[0] |
186 return [str(repo.changelog.rev(r)) for r in o] |
186 return [str(repo.changelog.rev(r)) for r in o] |
187 |
187 |
188 def getbundle(dest, revs): |
188 def getbundle(dest): |
189 tmpdir = tempfile.mkdtemp(prefix='hg-email-bundle-') |
189 tmpdir = tempfile.mkdtemp(prefix='hg-email-bundle-') |
190 tmpfn = os.path.join(tmpdir, 'bundle') |
190 tmpfn = os.path.join(tmpdir, 'bundle') |
191 try: |
191 try: |
192 commands.bundle(ui, repo, tmpfn, dest, *revs, **{'force': 0}) |
192 commands.bundle(ui, repo, tmpfn, dest, **opts) |
193 return open(tmpfn).read() |
193 return open(tmpfn).read() |
194 finally: |
194 finally: |
195 try: |
195 try: |
196 os.unlink(tmpfn) |
196 os.unlink(tmpfn) |
197 except: |
197 except: |
214 raise util.Abort(_('use only one form to specify the revision')) |
214 raise util.Abort(_('use only one form to specify the revision')) |
215 revs = opts.get('rev') |
215 revs = opts.get('rev') |
216 |
216 |
217 if opts.get('outgoing'): |
217 if opts.get('outgoing'): |
218 revs = outgoing(dest, opts.get('rev')) |
218 revs = outgoing(dest, opts.get('rev')) |
|
219 if opts.get('bundle'): |
|
220 opts['revs'] = revs |
219 |
221 |
220 # start |
222 # start |
221 start_time = util.makedate() |
223 start_time = util.makedate() |
222 |
224 |
223 def genmsgid(id): |
225 def genmsgid(id): |
378 ('m', 'mbox', '', 'write messages to mbox file instead of sending them'), |
380 ('m', 'mbox', '', 'write messages to mbox file instead of sending them'), |
379 ('o', 'outgoing', None, _('send changes not found in the target repository')), |
381 ('o', 'outgoing', None, _('send changes not found in the target repository')), |
380 ('b', 'bundle', None, _('send changes not in target as a binary bundle')), |
382 ('b', 'bundle', None, _('send changes not in target as a binary bundle')), |
381 ('r', 'rev', [], _('a revision to send')), |
383 ('r', 'rev', [], _('a revision to send')), |
382 ('s', 'subject', '', 'subject of first message (intro or single patch)'), |
384 ('s', 'subject', '', 'subject of first message (intro or single patch)'), |
383 ('t', 'to', [], 'email addresses of recipients')] + commands.remoteopts, |
385 ('t', 'to', [], 'email addresses of recipients'), |
|
386 ('', 'force', None, _('run even when remote repository is unrelated (with -b)')), |
|
387 ('', 'base', [], |
|
388 _('a base changeset to specify instead of a destination (with -b)'))] |
|
389 + commands.remoteopts, |
384 "hg email [OPTION]... [DEST]...") |
390 "hg email [OPTION]... [DEST]...") |
385 } |
391 } |