Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG4899c6d22dff: patchbomb: extract function for generating message-id
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/patchbomb.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Aug 16 2018, 12:39 AM |
revs = [r for r in revs if r >= 0] | revs = [r for r in revs if r >= 0] | ||||
if not revs: | if not revs: | ||||
revs = [repo.changelog.tiprev()] | revs = [repo.changelog.tiprev()] | ||||
revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs) | revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs) | ||||
if not revs: | if not revs: | ||||
ui.status(_("no changes found\n")) | ui.status(_("no changes found\n")) | ||||
return revs | return revs | ||||
def _msgid(node, timestamp): | |||||
return '<%s.%d@%s>' % (node, timestamp, | |||||
encoding.strtolocal(socket.getfqdn())) | |||||
emailopts = [ | emailopts = [ | ||||
('', 'body', None, _('send patches as inline message text (default)')), | ('', 'body', None, _('send patches as inline message text (default)')), | ||||
('a', 'attach', None, _('send patches as attachments')), | ('a', 'attach', None, _('send patches as attachments')), | ||||
('i', 'inline', None, _('send patches as inline attachments')), | ('i', 'inline', None, _('send patches as inline attachments')), | ||||
('', 'bcc', [], _('email addresses of blind carbon copy recipients')), | ('', 'bcc', [], _('email addresses of blind carbon copy recipients')), | ||||
('c', 'cc', [], _('email addresses of copy recipients')), | ('c', 'cc', [], _('email addresses of copy recipients')), | ||||
('', 'confirm', None, _('ask for confirmation before sending')), | ('', 'confirm', None, _('ask for confirmation before sending')), | ||||
('d', 'diffstat', None, _('add diffstat output to messages')), | ('d', 'diffstat', None, _('add diffstat output to messages')), | ||||
# start | # start | ||||
if date: | if date: | ||||
start_time = dateutil.parsedate(date) | start_time = dateutil.parsedate(date) | ||||
else: | else: | ||||
start_time = dateutil.makedate() | start_time = dateutil.makedate() | ||||
def genmsgid(id): | def genmsgid(id): | ||||
return '<%s.%d@%s>' % (id[:20], int(start_time[0]), | return _msgid(id[:20], int(start_time[0])) | ||||
encoding.strtolocal(socket.getfqdn())) | |||||
# deprecated config: patchbomb.from | # deprecated config: patchbomb.from | ||||
sender = (opts.get('from') or ui.config('email', 'from') or | sender = (opts.get('from') or ui.config('email', 'from') or | ||||
ui.config('patchbomb', 'from') or | ui.config('patchbomb', 'from') or | ||||
prompt(ui, 'From', ui.username())) | prompt(ui, 'From', ui.username())) | ||||
if bundle: | if bundle: | ||||
stropts = pycompat.strkwargs(opts) | stropts = pycompat.strkwargs(opts) |