[PATCH 1 of 1] patchbomb: do not assume the presence of angle brackets around msg-id

Cédric Duval cedricduval at free.fr
Wed Jun 17 13:59:23 CDT 2009


# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1245264866 -7200
# Node ID 07c05f5169b631d1b11b2171b054db72a2e024c0
# Parent  5b439c3949e435d9e064425b0324996c4a9a4857
patchbomb: do not assume the presence of angle brackets around msg-id

RFC 5322 states:
  "Semantically, the angle bracket characters are not part of the
   msg-id; the msg-id is what is contained between the two angle bracket
   characters."

Hence it should be correct to pass a message Id with no angle brackets
to --in-reply-to. Adding them if missing.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -397,6 +397,13 @@
     ui.write('\n')
 
     parent = opts.get('in_reply_to') or None
+    # angle brackets may be omitted, they're not semantically part of the msg-id
+    if parent is not None:
+        if not parent.startswith('<'):
+            parent = '<' + parent
+        if not parent.endswith('>'):
+            parent += '>'
+
     first = True
 
     sender_addr = email.Utils.parseaddr(sender)[1]



More information about the Mercurial-devel mailing list