changeset 44405:a1908951ca42

tests: handle In-Reply-To headers for line wrapping Python 3 tends to insert a newline for both Message-ID and In-Reply-To headers, so unwrap both. Just check the wrapped line format explicitly without regular expression. Differential Revision: https://phab.mercurial-scm.org/D8171
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 26 Feb 2020 22:26:28 +0100
parents 0e5e192adb6f
children baf8c3f944eb
files tests/unwrap-message-id.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/unwrap-message-id.py	Wed Feb 26 10:48:56 2020 -0800
+++ b/tests/unwrap-message-id.py	Wed Feb 26 22:26:28 2020 +0100
@@ -1,6 +1,8 @@
 from __future__ import absolute_import, print_function
 
-import re
 import sys
 
-print(re.sub(r"(?<=Message-Id:) \n ", " ", sys.stdin.read()), end="")
+for line in sys.stdin:
+    if line.lower() in ("message-id: \n", "in-reply-to: \n"):
+        line = line[:-2]
+    print(line, end="")