# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1481985170 -19800 # Sat Dec 17 20:02:50 2016 +0530 # Node ID a82ca84371f5f4b4213aec534ab0ccdfbd04cf9b # Parent 4107888f9b89e178ab8369a6d63ebb2e17dc26b9 py3: replace os.sep with pycompat.ossep (part 2 of 4)
This part also replaces some chunks of os.sep with pycompat.ossep. diff -r 4107888f9b89 -r a82ca84371f5 mercurial/dirstate.py --- a/mercurial/dirstate.py Sat Dec 17 19:56:30 2016 +0530 +++ b/mercurial/dirstate.py Sat Dec 17 20:02:50 2016 +0530 @@ -286,7 +286,7 @@ # self._root ends with a path separator if self._root is '/' or 'C:\' rootsep = self._root if not util.endswithsep(rootsep): - rootsep += os.sep + rootsep += pycompat.ossep if cwd.startswith(rootsep): return cwd[len(rootsep):] else: diff -r 4107888f9b89 -r a82ca84371f5 mercurial/pathutil.py --- a/mercurial/pathutil.py Sat Dec 17 19:56:30 2016 +0530 +++ b/mercurial/pathutil.py Sat Dec 17 20:02:50 2016 +0530 @@ -9,6 +9,7 @@ from . import ( encoding, error, + pycompat, util, ) @@ -87,8 +88,8 @@ # This means we won't accidentally traverse a symlink into some other # filesystem (which is potentially expensive to access). for i in range(len(parts)): - prefix = os.sep.join(parts[:i + 1]) - normprefix = os.sep.join(normparts[:i + 1]) + prefix = pycompat.ossep.join(parts[:i + 1]) + normprefix = pycompat.ossep.join(normparts[:i + 1]) if normprefix in self.auditeddir: continue if self._realfs: @@ -132,7 +133,7 @@ if util.endswithsep(root): rootsep = root else: - rootsep = root + os.sep + rootsep = root + pycompat.ossep name = myname if not os.path.isabs(name): name = os.path.join(root, cwd, name) @@ -202,8 +203,8 @@ '/' ''' d, p = os.path.splitdrive(path) - if len(p) != len(os.sep): - return path + os.sep + if len(p) != len(pycompat.ossep): + return path + pycompat.ossep else: return path diff -r 4107888f9b89 -r a82ca84371f5 mercurial/posix.py --- a/mercurial/posix.py Sat Dec 17 19:56:30 2016 +0530 +++ b/mercurial/posix.py Sat Dec 17 20:02:50 2016 +0530 @@ -369,7 +369,7 @@ # use upper-ing as normcase as same as NTFS workaround def normcase(path): pathlen = len(path) - if (pathlen == 0) or (path[0] != os.sep): + if (pathlen == 0) or (path[0] != pycompat.ossep): # treat as relative return encoding.upper(path) @@ -381,7 +381,7 @@ mplen = len(mp) if mplen == pathlen: # mount point itself return mp - if path[mplen] == os.sep: + if path[mplen] == pycompat.ossep: return mp + encoding.upper(path[mplen:]) return encoding.upper(path) @@ -456,7 +456,7 @@ return executable return None - if os.sep in command: + if pycompat.ossep in command: return findexisting(command) if sys.platform == 'plan9': _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel