patchbomb: extract function for generating message-id
Differential Revision: https://phab.mercurial-scm.org/D4293
--- a/hgext/patchbomb.py Wed Aug 15 11:27:57 2018 +0530
+++ b/hgext/patchbomb.py Thu Aug 16 00:39:32 2018 -0400
@@ -469,6 +469,10 @@
ui.status(_("no changes found\n"))
return revs
+def _msgid(node, timestamp):
+ return '<%s.%d@%s>' % (node, timestamp,
+ encoding.strtolocal(socket.getfqdn()))
+
emailopts = [
('', 'body', None, _('send patches as inline message text (default)')),
('a', 'attach', None, _('send patches as attachments')),
@@ -677,8 +681,7 @@
start_time = dateutil.makedate()
def genmsgid(id):
- return '<%s.%d@%s>' % (id[:20], int(start_time[0]),
- encoding.strtolocal(socket.getfqdn()))
+ return _msgid(id[:20], int(start_time[0]))
# deprecated config: patchbomb.from
sender = (opts.get('from') or ui.config('email', 'from') or