changeset 39154:4899c6d22dff

patchbomb: extract function for generating message-id Differential Revision: https://phab.mercurial-scm.org/D4293
author Augie Fackler <raf@durin42.com>
date Thu, 16 Aug 2018 00:39:32 -0400
parents ffb34ee6de9e
children 1415b78869eb
files hgext/patchbomb.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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