Patchwork D7766: cleanup: drop redundant character escapes from `[]` character sets

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

Comments

phabricator - Jan. 8, 2020, 7:51 p.m.
Closed by commit rHG6d3b67a837a6: cleanup: drop redundant character escapes from `[]` character sets (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/D7766?vs=18997&id=19095

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

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

AFFECTED FILES
  hgext/convert/cvs.py
  mercurial/hgweb/wsgiheaders.py
  mercurial/ui.py
  mercurial/util.py
  tests/run-tests.py

CHANGE DETAILS




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

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3179,9 +3179,7 @@ 
                 expanded_args.append(arg)
         args = expanded_args
 
-        testcasepattern = re.compile(
-            br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-\.#]+))'
-        )
+        testcasepattern = re.compile(br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-.#]+))')
         tests = []
         for t in args:
             case = []
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1165,7 +1165,7 @@ 
     """
     if not v:
         v = version()
-    m = remod.match(br'(\d+(?:\.\d+){,2})[\+-]?(.*)', v)
+    m = remod.match(br'(\d+(?:\.\d+){,2})[+-]?(.*)', v)
     if not m:
         vparts, extra = b'', v
     elif m.group(2):
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1626,7 +1626,7 @@ 
         # prompt to start parsing. Sadly, we also can't rely on
         # choices containing spaces, ASCII, or basically anything
         # except an ampersand followed by a character.
-        m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt)
+        m = re.match(br'(?s)(.+?)\$\$([^$]*&[^ $].*)', prompt)
         msg = m.group(1)
         choices = [p.strip(b' ') for p in m.group(2).split(b'$$')]
 
diff --git a/mercurial/hgweb/wsgiheaders.py b/mercurial/hgweb/wsgiheaders.py
--- a/mercurial/hgweb/wsgiheaders.py
+++ b/mercurial/hgweb/wsgiheaders.py
@@ -13,7 +13,7 @@ 
 
 import re
 
-tspecials = re.compile(br'[ \(\)<>@,;:\\"/\[\]\?=]')
+tspecials = re.compile(br'[ ()<>@,;:\\"/\[\]?=]')
 
 
 def _formatparam(param, value=None, quote=1):
diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py
--- a/hgext/convert/cvs.py
+++ b/hgext/convert/cvs.py
@@ -144,9 +144,7 @@ 
 
         if root.startswith(b":pserver:"):
             root = root[9:]
-            m = re.match(
-                r'(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?(.*)', root
-            )
+            m = re.match(r'(?:(.*?)(?::(.*?))?@)?([^:/]*)(?::(\d*))?(.*)', root)
             if m:
                 conntype = b"pserver"
                 user, passw, serv, port, root = m.groups()