# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-11-05 22:40:33 # Node ID ba2c04059317fc144581b58a432e21f6c8d54492 # Parent ad40d307a9f03cdb71bc4cfef576618e826735fc 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 --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -61,6 +61,7 @@ from . import ( phases, policy, pvec, + pycompat, repair, revlog, revset, @@ -3160,7 +3161,7 @@ def debugpathcomplete(ui, repo, *specs, 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 @@ def debugwalk(ui, repo, *pats, **opts): 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 --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -21,6 +21,7 @@ from . import ( osutil, parsers, pathutil, + pycompat, scmutil, util, ) @@ -215,7 +216,7 @@ class dirstate(object): @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 --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py +++ b/mercurial/pure/osutil.py @@ -14,7 +14,11 @@ import socket import stat as statmod import sys -from . import policy +from . import ( + policy, + pycompat, +) + modulepolicy = policy.policy policynocffi = policy.policynocffi @@ -51,8 +55,8 @@ def listdirpure(path, stat=False, skip=N ''' 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: