[PATCH 6 of 8] py3: use pycompat.ossep at certain places
Pulkit Goyal
7895pulkit at gmail.com
Sat Nov 5 23:16:23 UTC 2016
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1478385633 -19800
# Sun Nov 06 04:10:33 2016 +0530
# Node ID d9461776be8ccc38def14ef34c3337099fda9b23
# Parent 0c892b7a70b56a27d485562b4191eb44da625f5b
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.
diff -r 0c892b7a70b5 -r d9461776be8c mercurial/commands.py
--- a/mercurial/commands.py Sun Nov 06 03:57:34 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]),
diff -r 0c892b7a70b5 -r d9461776be8c mercurial/dirstate.py
--- a/mercurial/dirstate.py Sun Nov 06 03:57:34 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):
diff -r 0c892b7a70b5 -r d9461776be8c mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py Sun Nov 06 03:57:34 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:
More information about the Mercurial-devel
mailing list