Patchwork D7765: cleanup: replace contiguous spaces in regex patterns with an explicit count

login
register
mail settings
Submitter phabricator
Date Jan. 8, 2020, 7:49 p.m.
Message ID <60661290fab7ce7169164a5fedbaad24@localhost.localdomain>
Download mbox | patch
Permalink /patch/44197/
State Not Applicable
Headers show

Comments

phabricator - Jan. 8, 2020, 7:49 p.m.
Closed by commit rHGac3cb5e05a38: cleanup: replace contiguous spaces in regex patterns with an explicit count (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7765?vs=18996&id=19094

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

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

AFFECTED FILES
  contrib/testparseutil.py
  hgext/convert/monotone.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
--- a/hgext/convert/monotone.py
+++ b/hgext/convert/monotone.py
@@ -239,7 +239,7 @@ 
         #   key "test@selenic.com"
         # mtn >= 0.45:
         #   key [ff58a7ffb771907c4ff68995eada1c4da068d328]
-        certlist = re.split(br'\n\n      key ["\[]', certlist)
+        certlist = re.split(br'\n\n {6}key ["\[]', certlist)
         for e in certlist:
             m = self.cert_re.match(e)
             if m:
diff --git a/contrib/testparseutil.py b/contrib/testparseutil.py
--- a/contrib/testparseutil.py
+++ b/contrib/testparseutil.py
@@ -331,9 +331,9 @@ 
         )
         self._fileres = [
             # "cat > NAME << LIMIT" case
-            re.compile(r'  \$ \s*cat' + namepat + heredoclimitpat),
+            re.compile(r' {2}\$ \s*cat' + namepat + heredoclimitpat),
             # "cat << LIMIT > NAME" case
-            re.compile(r'  \$ \s*cat' + heredoclimitpat + namepat),
+            re.compile(r' {2}\$ \s*cat' + heredoclimitpat + namepat),
         ]
 
     def startsat(self, line):
@@ -426,7 +426,7 @@ 
     """
 
     _prefix = '  >>> '
-    _prefixre = re.compile(r'  (>>>|\.\.\.) ')
+    _prefixre = re.compile(r' {2}(>>>|\.\.\.) ')
 
     # If a line matches against not _prefixre but _outputre, that line
     # is "an expected output line" (= not a part of code fragment).
@@ -436,7 +436,7 @@ 
     # run-tests.py. But "directive line inside inline python code"
     # should be rejected by Mercurial reviewers. Therefore, this
     # regexp does not matche against such directive lines.
-    _outputre = re.compile(r'  $|  [^$]')
+    _outputre = re.compile(r' {2}$| {2}[^$]')
 
     def __init__(self):
         super(pydoctestmatcher, self).__init__("doctest style python code")
@@ -509,7 +509,7 @@ 
     _prefix = '  > '
 
     _startre = re.compile(
-        r'  \$ (\$PYTHON|"\$PYTHON"|python).*' + heredoclimitpat
+        r' {2}\$ (\$PYTHON|"\$PYTHON"|python).*' + heredoclimitpat
     )
 
     def __init__(self):