##// END OF EJS Templates
patchbomb: use cmdutil.command decorator
Adrian Buehlmann -
r14309:37e80214 default
parent child Browse files
Show More
@@ -52,6 +52,9 b' from mercurial import cmdutil, commands,'
52 52 from mercurial.i18n import _
53 53 from mercurial.node import bin
54 54
55 cmdtable = {}
56 command = cmdutil.command(cmdtable)
57
55 58 def prompt(ui, prompt, default=None, rest=':'):
56 59 if not ui.interactive() and default is None:
57 60 raise util.Abort(_("%s Please enter a valid value" % (prompt + rest)))
@@ -146,6 +149,40 b' def makepatch(ui, repo, patchlines, opts'
146 149 msg['X-Mercurial-Node'] = node
147 150 return msg, subj, ds
148 151
152 emailopts = [
153 ('a', 'attach', None, _('send patches as attachments')),
154 ('i', 'inline', None, _('send patches as inline attachments')),
155 ('', 'bcc', [], _('email addresses of blind carbon copy recipients')),
156 ('c', 'cc', [], _('email addresses of copy recipients')),
157 ('', 'confirm', None, _('ask for confirmation before sending')),
158 ('d', 'diffstat', None, _('add diffstat output to messages')),
159 ('', 'date', '', _('use the given date as the sending date')),
160 ('', 'desc', '', _('use the given file as the series description')),
161 ('f', 'from', '', _('email address of sender')),
162 ('n', 'test', None, _('print messages that would be sent')),
163 ('m', 'mbox', '', _('write messages to mbox file instead of sending them')),
164 ('', 'reply-to', [], _('email addresses replies should be sent to')),
165 ('s', 'subject', '', _('subject of first message (intro or single patch)')),
166 ('', 'in-reply-to', '', _('message identifier to reply to')),
167 ('', 'flag', [], _('flags to add in subject prefixes')),
168 ('t', 'to', [], _('email addresses of recipients'))]
169
170 @command('email',
171 [('g', 'git', None, _('use git extended diff format')),
172 ('', 'plain', None, _('omit hg patch header')),
173 ('o', 'outgoing', None,
174 _('send changes not found in the target repository')),
175 ('b', 'bundle', None, _('send changes not in target as a binary bundle')),
176 ('', 'bundlename', 'bundle',
177 _('name of the bundle attachment file'), _('NAME')),
178 ('r', 'rev', [], _('a revision to send'), _('REV')),
179 ('', 'force', None, _('run even when remote repository is unrelated '
180 '(with -b/--bundle)')),
181 ('', 'base', [], _('a base changeset to specify instead of a destination '
182 '(with -b/--bundle)'), _('REV')),
183 ('', 'intro', None, _('send an introduction email for a single patch')),
184 ] + emailopts + commands.remoteopts,
185 _('hg email [OPTION]... [DEST]...'))
149 186 def patchbomb(ui, repo, *revs, **opts):
150 187 '''send changesets by email
151 188
@@ -511,52 +548,3 b' def patchbomb(ui, repo, *revs, **opts):'
511 548
512 549 ui.progress(_('writing'), None)
513 550 ui.progress(_('sending'), None)
514
515 emailopts = [
516 ('a', 'attach', None, _('send patches as attachments')),
517 ('i', 'inline', None, _('send patches as inline attachments')),
518 ('', 'bcc', [], _('email addresses of blind carbon copy recipients')),
519 ('c', 'cc', [], _('email addresses of copy recipients')),
520 ('', 'confirm', None, _('ask for confirmation before sending')),
521 ('d', 'diffstat', None, _('add diffstat output to messages')),
522 ('', 'date', '', _('use the given date as the sending date')),
523 ('', 'desc', '', _('use the given file as the series description')),
524 ('f', 'from', '', _('email address of sender')),
525 ('n', 'test', None, _('print messages that would be sent')),
526 ('m', 'mbox', '',
527 _('write messages to mbox file instead of sending them')),
528 ('', 'reply-to', [], _('email addresses replies should be sent to')),
529 ('s', 'subject', '',
530 _('subject of first message (intro or single patch)')),
531 ('', 'in-reply-to', '',
532 _('message identifier to reply to')),
533 ('', 'flag', [], _('flags to add in subject prefixes')),
534 ('t', 'to', [], _('email addresses of recipients')),
535 ]
536
537
538 cmdtable = {
539 "email":
540 (patchbomb,
541 [('g', 'git', None, _('use git extended diff format')),
542 ('', 'plain', None, _('omit hg patch header')),
543 ('o', 'outgoing', None,
544 _('send changes not found in the target repository')),
545 ('b', 'bundle', None,
546 _('send changes not in target as a binary bundle')),
547 ('', 'bundlename', 'bundle',
548 _('name of the bundle attachment file'), _('NAME')),
549 ('r', 'rev', [],
550 _('a revision to send'), _('REV')),
551 ('', 'force', None,
552 _('run even when remote repository is unrelated '
553 '(with -b/--bundle)')),
554 ('', 'base', [],
555 _('a base changeset to specify instead of a destination '
556 '(with -b/--bundle)'),
557 _('REV')),
558 ('', 'intro', None,
559 _('send an introduction email for a single patch')),
560 ] + emailopts + commands.remoteopts,
561 _('hg email [OPTION]... [DEST]...'))
562 }
General Comments 0
You need to be logged in to leave comments. Login now