Patchwork [06,of,11,py3] util: use '\\' rather than using r'\'

login
register
mail settings
Submitter Augie Fackler
Date Oct. 9, 2016, 2:16 p.m.
Message ID <88a5fecb60831eea7c44.1476022608@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/17002/
State Accepted
Headers show

Comments

Augie Fackler - Oct. 9, 2016, 2:16 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1476018047 14400
#      Sun Oct 09 09:00:47 2016 -0400
# Node ID 88a5fecb60831eea7c44c6d6025ee23513528501
# Parent  db2eae3cd5db193cd8922e93df2c6120ca9d7340
util: use '\\' rather than using r'\'

We need bytes, and I find this just a little more immediately obvious
than doing rb'\'.
Yuya Nishihara - Nov. 9, 2016, 12:33 p.m.
On Sun, 09 Oct 2016 10:16:48 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1476018047 14400
> #      Sun Oct 09 09:00:47 2016 -0400
> # Node ID 88a5fecb60831eea7c44c6d6025ee23513528501
> # Parent  db2eae3cd5db193cd8922e93df2c6120ca9d7340
> util: use '\\' rather than using r'\'

Queued this, thanks.

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2378,7 +2378,7 @@  class url(object):
 
     _safechars = "!~*'()+"
     _safepchars = "/!~*'()+:\\"
-    _matchscheme = remod.compile(r'^[a-zA-Z0-9+.\-]+:').match
+    _matchscheme = remod.compile('^[a-zA-Z0-9+.\\-]+:').match
 
     def __init__(self, path, parsequery=True, parsefragment=True):
         # We slowly chomp away at path until we have only the path left
@@ -2392,7 +2392,7 @@  class url(object):
             path, self.fragment = path.split('#', 1)
 
         # special case for Windows drive letters and UNC paths
-        if hasdriveletter(path) or path.startswith(r'\\'):
+        if hasdriveletter(path) or path.startswith('\\\\'):
             self.path = path
             return