Patchwork D8171: tests: handle In-Reply-To headers for line wrapping

login
register
mail settings
Submitter phabricator
Date Feb. 26, 2020, 9:26 p.m.
Message ID <differential-rev-PHID-DREV-hg2l2xjuy3cjdxpunb4d-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45355/
State Superseded
Headers show

Comments

phabricator - Feb. 26, 2020, 9:26 p.m.
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8171

AFFECTED FILES
  tests/unwrap-message-id.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 28, 2020, 3:56 p.m.
marmoute added a comment.
marmoute accepted this revision.


  If the test are happy, I guess we are.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8171/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8171

To: joerg.sonnenberger, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel

Patch

diff --git a/tests/unwrap-message-id.py b/tests/unwrap-message-id.py
--- a/tests/unwrap-message-id.py
+++ b/tests/unwrap-message-id.py
@@ -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="")