Patchwork D6293: match: use raw strings to avoid illegal baskslash escape

login
register
mail settings
Submitter phabricator
Date April 22, 2019, 1:03 p.m.
Message ID <c8392f1da130ffb17c48981eaaa6a749@localhost.localdomain>
Download mbox | patch
Permalink /patch/39784/
State Not Applicable
Headers show

Comments

phabricator - April 22, 2019, 1:03 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfd384911f51b: match: use raw strings to avoid illegal baskslash escape (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6293?vs=14877&id=14879

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

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -484,7 +484,7 @@ 
     """Matches a set of (kind, pat, source) against a 'root' directory.
 
     >>> kindpats = [
-    ...     (b're', b'.*\.c$', b''),
+    ...     (b're', br'.*\.c$', b''),
     ...     (b'path', b'foo/a', b''),
     ...     (b'relpath', b'b', b''),
     ...     (b'glob', b'*.h', b''),
@@ -651,7 +651,7 @@ 
     r'''Matches the input files exactly. They are interpreted as paths, not
     patterns (so no kind-prefixes).
 
-    >>> m = exactmatcher([b'a.txt', b're:.*\.c$'])
+    >>> m = exactmatcher([b'a.txt', br're:.*\.c$'])
     >>> m(b'a.txt')
     True
     >>> m(b'b.txt')
@@ -664,7 +664,7 @@ 
     So pattern 're:.*\.c$' is not considered as a regex, but as a file name
     >>> m(b'main.c')
     False
-    >>> m(b're:.*\.c$')
+    >>> m(br're:.*\.c$')
     True
     '''
 
@@ -1075,7 +1075,7 @@ 
 def patkind(pattern, default=None):
     '''If pattern is 'kind:pat' with a known kind, return kind.
 
-    >>> patkind(b're:.*\.c$')
+    >>> patkind(br're:.*\.c$')
     're'
     >>> patkind(b'glob:*.c')
     'glob'