Patchwork [4,of,4] py3: replace os.altsep with pycompat.altsep

login
register
mail settings
Submitter Pulkit Goyal
Date Dec. 18, 2016, 12:01 p.m.
Message ID <ebca87566128e20c8f04.1482062494@pulkit-goyal>
Download mbox | patch
Permalink /patch/17954/
State Accepted
Headers show

Comments

Pulkit Goyal - Dec. 18, 2016, 12:01 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1482004032 -19800
#      Sun Dec 18 01:17:12 2016 +0530
# Node ID ebca87566128e20c8f044f4e2d9aaec36efef625
# Parent  e737d795d5813e66ce7a57a74fa30f52f6eb4ec4
py3: replace os.altsep with pycompat.altsep

All the occurences of os.altsep are replaced with pycompat.altsep which
returns bytes.

Patch

diff -r e737d795d581 -r ebca87566128 mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py	Sun Dec 18 00:52:05 2016 +0530
+++ b/mercurial/hgweb/common.py	Sun Dec 18 01:17:12 2016 +0530
@@ -143,7 +143,7 @@ 
     for part in parts:
         if (part in ('', os.curdir, os.pardir) or
             pycompat.ossep in part or
-            os.altsep is not None and os.altsep in part):
+            pycompat.osaltsep is not None and pycompat.osaltsep in part):
             return
     fpath = os.path.join(*parts)
     if isinstance(directory, str):
diff -r e737d795d581 -r ebca87566128 mercurial/templater.py
--- a/mercurial/templater.py	Sun Dec 18 00:52:05 2016 +0530
+++ b/mercurial/templater.py	Sun Dec 18 01:17:12 2016 +0530
@@ -1245,7 +1245,7 @@ 
         if (not style
             or style in (os.curdir, os.pardir)
             or pycompat.ossep in style
-            or os.altsep and os.altsep in style):
+            or pycompat.osaltsep and pycompat.osaltsep in style):
             continue
         locations = [os.path.join(style, 'map'), 'map-' + style]
         locations.append('map')
diff -r e737d795d581 -r ebca87566128 mercurial/util.py
--- a/mercurial/util.py	Sun Dec 18 00:52:05 2016 +0530
+++ b/mercurial/util.py	Sun Dec 18 01:17:12 2016 +0530
@@ -1304,8 +1304,8 @@ 
         return dict((normcase(n), n) for n in os.listdir(dir))
 
     seps = pycompat.ossep
-    if os.altsep:
-        seps = seps + os.altsep
+    if pycompat.osaltsep:
+        seps = seps + pycompat.osaltsep
     # Protect backslashes. This gets silly very quickly.
     seps.replace('\\','\\\\')
     pattern = remod.compile(r'([^%s]+)|([%s]+)' % (seps, seps))
@@ -1371,7 +1371,7 @@ 
 def endswithsep(path):
     '''Check path ends with os.sep or os.altsep.'''
     return (path.endswith(pycompat.ossep)
-            or os.altsep and path.endswith(os.altsep))
+            or pycompat.osaltsep and path.endswith(pycompat.osaltsep))
 
 def splitpath(path):
     '''Split path by os.sep.