py3: use pycompat.ossep at certain places
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 06 Nov 2016 04:10:33 +0530
changeset 30317 ba2c04059317
parent 30316 ad40d307a9f0
child 30318 af7c60988f6e
py3: use pycompat.ossep at certain places Certain instances of os.sep has been converted to pycompat.ossep where it was sure to use bytes only. There are more such instances which needs some more attention and will get surely.
mercurial/commands.py
mercurial/dirstate.py
mercurial/pure/osutil.py
--- a/mercurial/commands.py	Sun Nov 06 03:44:44 2016 +0530
+++ b/mercurial/commands.py	Sun Nov 06 04:10:33 2016 +0530
@@ -61,6 +61,7 @@
     phases,
     policy,
     pvec,
+    pycompat,
     repair,
     revlog,
     revset,
@@ -3160,7 +3161,7 @@
         if os.path.isdir(spec):
             spec += '/'
         spec = spec[len(rootdir):]
-        fixpaths = os.sep != '/'
+        fixpaths = pycompat.ossep != '/'
         if fixpaths:
             spec = spec.replace(os.sep, '/')
         speclen = len(spec)
@@ -3755,7 +3756,7 @@
     if not items:
         return
     f = lambda fn: fn
-    if ui.configbool('ui', 'slash') and os.sep != '/':
+    if ui.configbool('ui', 'slash') and pycompat.ossep != '/':
         f = lambda fn: util.normpath(fn)
     fmt = 'f  %%-%ds  %%-%ds  %%s' % (
         max([len(abs) for abs in items]),
--- a/mercurial/dirstate.py	Sun Nov 06 03:44:44 2016 +0530
+++ b/mercurial/dirstate.py	Sun Nov 06 04:10:33 2016 +0530
@@ -21,6 +21,7 @@
     osutil,
     parsers,
     pathutil,
+    pycompat,
     scmutil,
     util,
 )
@@ -215,7 +216,7 @@
 
     @propertycache
     def _slash(self):
-        return self._ui.configbool('ui', 'slash') and os.sep != '/'
+        return self._ui.configbool('ui', 'slash') and pycompat.ossep != '/'
 
     @propertycache
     def _checklink(self):
--- a/mercurial/pure/osutil.py	Sun Nov 06 03:44:44 2016 +0530
+++ b/mercurial/pure/osutil.py	Sun Nov 06 04:10:33 2016 +0530
@@ -14,7 +14,11 @@
 import stat as statmod
 import sys
 
-from . import policy
+from . import (
+    policy,
+    pycompat,
+)
+
 modulepolicy = policy.policy
 policynocffi = policy.policynocffi
 
@@ -51,8 +55,8 @@
     '''
     result = []
     prefix = path
-    if not prefix.endswith(os.sep):
-        prefix += os.sep
+    if not prefix.endswith(pycompat.ossep):
+        prefix += pycompat.ossep
     names = os.listdir(path)
     names.sort()
     for fn in names: