patchbomb: allow using HGHOSTNAME to force a hostname
authorAugie Fackler <raf@durin42.com>
Thu, 16 Aug 2018 00:40:20 -0400
changeset 39118 1415b78869eb
parent 39117 4899c6d22dff
child 39119 1f987f7c832b
patchbomb: allow using HGHOSTNAME to force a hostname I'll update run-tests.py to set this globally to stabilize some tests. The variable name is intentionally generic because I suspect we should generalize this to other tests. Differential Revision: https://phab.mercurial-scm.org/D4294
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Thu Aug 16 00:39:32 2018 -0400
+++ b/hgext/patchbomb.py	Thu Aug 16 00:40:20 2018 -0400
@@ -470,8 +470,9 @@
     return revs
 
 def _msgid(node, timestamp):
-    return '<%s.%d@%s>' % (node, timestamp,
-                           encoding.strtolocal(socket.getfqdn()))
+    hostname = encoding.strtolocal(socket.getfqdn())
+    hostname = encoding.environ.get('HGHOSTNAME', hostname)
+    return '<%s.%d@%s>' % (node, timestamp, hostname)
 
 emailopts = [
     ('', 'body', None, _('send patches as inline message text (default)')),