##// END OF EJS Templates
py3: replace os.sep with pycompat.ossep (part 2 of 4)...
Pulkit Goyal -
r30614:cfe66dcf default
parent child Browse files
Show More
@@ -286,7 +286,7 b' class dirstate(object):'
286 # self._root ends with a path separator if self._root is '/' or 'C:\'
286 # self._root ends with a path separator if self._root is '/' or 'C:\'
287 rootsep = self._root
287 rootsep = self._root
288 if not util.endswithsep(rootsep):
288 if not util.endswithsep(rootsep):
289 rootsep += os.sep
289 rootsep += pycompat.ossep
290 if cwd.startswith(rootsep):
290 if cwd.startswith(rootsep):
291 return cwd[len(rootsep):]
291 return cwd[len(rootsep):]
292 else:
292 else:
@@ -9,6 +9,7 b' from .i18n import _'
9 from . import (
9 from . import (
10 encoding,
10 encoding,
11 error,
11 error,
12 pycompat,
12 util,
13 util,
13 )
14 )
14
15
@@ -87,8 +88,8 b' class pathauditor(object):'
87 # This means we won't accidentally traverse a symlink into some other
88 # This means we won't accidentally traverse a symlink into some other
88 # filesystem (which is potentially expensive to access).
89 # filesystem (which is potentially expensive to access).
89 for i in range(len(parts)):
90 for i in range(len(parts)):
90 prefix = os.sep.join(parts[:i + 1])
91 prefix = pycompat.ossep.join(parts[:i + 1])
91 normprefix = os.sep.join(normparts[:i + 1])
92 normprefix = pycompat.ossep.join(normparts[:i + 1])
92 if normprefix in self.auditeddir:
93 if normprefix in self.auditeddir:
93 continue
94 continue
94 if self._realfs:
95 if self._realfs:
@@ -132,7 +133,7 b' def canonpath(root, cwd, myname, auditor'
132 if util.endswithsep(root):
133 if util.endswithsep(root):
133 rootsep = root
134 rootsep = root
134 else:
135 else:
135 rootsep = root + os.sep
136 rootsep = root + pycompat.ossep
136 name = myname
137 name = myname
137 if not os.path.isabs(name):
138 if not os.path.isabs(name):
138 name = os.path.join(root, cwd, name)
139 name = os.path.join(root, cwd, name)
@@ -202,8 +203,8 b' def normasprefix(path):'
202 '/'
203 '/'
203 '''
204 '''
204 d, p = os.path.splitdrive(path)
205 d, p = os.path.splitdrive(path)
205 if len(p) != len(os.sep):
206 if len(p) != len(pycompat.ossep):
206 return path + os.sep
207 return path + pycompat.ossep
207 else:
208 else:
208 return path
209 return path
209
210
@@ -369,7 +369,7 b" if sys.platform == 'cygwin':"
369 # use upper-ing as normcase as same as NTFS workaround
369 # use upper-ing as normcase as same as NTFS workaround
370 def normcase(path):
370 def normcase(path):
371 pathlen = len(path)
371 pathlen = len(path)
372 if (pathlen == 0) or (path[0] != os.sep):
372 if (pathlen == 0) or (path[0] != pycompat.ossep):
373 # treat as relative
373 # treat as relative
374 return encoding.upper(path)
374 return encoding.upper(path)
375
375
@@ -381,7 +381,7 b" if sys.platform == 'cygwin':"
381 mplen = len(mp)
381 mplen = len(mp)
382 if mplen == pathlen: # mount point itself
382 if mplen == pathlen: # mount point itself
383 return mp
383 return mp
384 if path[mplen] == os.sep:
384 if path[mplen] == pycompat.ossep:
385 return mp + encoding.upper(path[mplen:])
385 return mp + encoding.upper(path[mplen:])
386
386
387 return encoding.upper(path)
387 return encoding.upper(path)
@@ -456,7 +456,7 b' def findexe(command):'
456 return executable
456 return executable
457 return None
457 return None
458
458
459 if os.sep in command:
459 if pycompat.ossep in command:
460 return findexisting(command)
460 return findexisting(command)
461
461
462 if sys.platform == 'plan9':
462 if sys.platform == 'plan9':
General Comments 0
You need to be logged in to leave comments. Login now