# HG changeset patch # User Augie Fackler # Date 2018-08-16 04:39:32 # Node ID 4899c6d22dff806e8bdb5c19cf4998d42ccfeb95 # Parent ffb34ee6de9ec216a6aa711fe2f1e974288de942 patchbomb: extract function for generating message-id Differential Revision: https://phab.mercurial-scm.org/D4293 diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -469,6 +469,10 @@ def _getoutgoing(repo, dest, revs): 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 @@ def email(ui, repo, *revs, **opts): 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