##// END OF EJS Templates
py3: replace os.sep with pycompat.ossep (part 1 of 4)...
Pulkit Goyal -
r30613:1112ff99 default
parent child Browse files
Show More
@@ -2356,7 +2356,7 b' def debugpathcomplete(ui, repo, *specs, '
2356 def complete(path, acceptable):
2356 def complete(path, acceptable):
2357 dirstate = repo.dirstate
2357 dirstate = repo.dirstate
2358 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
2358 spec = os.path.normpath(os.path.join(pycompat.getcwd(), path))
2359 rootdir = repo.root + os.sep
2359 rootdir = repo.root + pycompat.ossep
2360 if spec != repo.root and not spec.startswith(rootdir):
2360 if spec != repo.root and not spec.startswith(rootdir):
2361 return [], []
2361 return [], []
2362 if os.path.isdir(spec):
2362 if os.path.isdir(spec):
@@ -2364,7 +2364,7 b' def debugpathcomplete(ui, repo, *specs, '
2364 spec = spec[len(rootdir):]
2364 spec = spec[len(rootdir):]
2365 fixpaths = pycompat.ossep != '/'
2365 fixpaths = pycompat.ossep != '/'
2366 if fixpaths:
2366 if fixpaths:
2367 spec = spec.replace(os.sep, '/')
2367 spec = spec.replace(pycompat.ossep, '/')
2368 speclen = len(spec)
2368 speclen = len(spec)
2369 fullpaths = opts['full']
2369 fullpaths = opts['full']
2370 files, dirs = set(), set()
2370 files, dirs = set(), set()
@@ -2372,11 +2372,11 b' def debugpathcomplete(ui, repo, *specs, '
2372 for f, st in dirstate.iteritems():
2372 for f, st in dirstate.iteritems():
2373 if f.startswith(spec) and st[0] in acceptable:
2373 if f.startswith(spec) and st[0] in acceptable:
2374 if fixpaths:
2374 if fixpaths:
2375 f = f.replace('/', os.sep)
2375 f = f.replace('/', pycompat.ossep)
2376 if fullpaths:
2376 if fullpaths:
2377 addfile(f)
2377 addfile(f)
2378 continue
2378 continue
2379 s = f.find(os.sep, speclen)
2379 s = f.find(pycompat.ossep, speclen)
2380 if s >= 0:
2380 if s >= 0:
2381 adddir(f[:s])
2381 adddir(f[:s])
2382 else:
2382 else:
@@ -916,7 +916,7 b' def pathto(root, n1, n2):'
916 a.pop()
916 a.pop()
917 b.pop()
917 b.pop()
918 b.reverse()
918 b.reverse()
919 return os.sep.join((['..'] * len(a)) + b) or '.'
919 return pycompat.ossep.join((['..'] * len(a)) + b) or '.'
920
920
921 def mainfrozen():
921 def mainfrozen():
922 """return True if we are a frozen executable.
922 """return True if we are a frozen executable.
@@ -1303,7 +1303,7 b' def fspath(name, root):'
1303 def _makefspathcacheentry(dir):
1303 def _makefspathcacheentry(dir):
1304 return dict((normcase(n), n) for n in os.listdir(dir))
1304 return dict((normcase(n), n) for n in os.listdir(dir))
1305
1305
1306 seps = os.sep
1306 seps = pycompat.ossep
1307 if os.altsep:
1307 if os.altsep:
1308 seps = seps + os.altsep
1308 seps = seps + os.altsep
1309 # Protect backslashes. This gets silly very quickly.
1309 # Protect backslashes. This gets silly very quickly.
@@ -1370,7 +1370,8 b' def checknlink(testfile):'
1370
1370
1371 def endswithsep(path):
1371 def endswithsep(path):
1372 '''Check path ends with os.sep or os.altsep.'''
1372 '''Check path ends with os.sep or os.altsep.'''
1373 return path.endswith(os.sep) or os.altsep and path.endswith(os.altsep)
1373 return (path.endswith(pycompat.ossep)
1374 or os.altsep and path.endswith(os.altsep))
1374
1375
1375 def splitpath(path):
1376 def splitpath(path):
1376 '''Split path by os.sep.
1377 '''Split path by os.sep.
@@ -1378,7 +1379,7 b' def splitpath(path):'
1378 an alternative of simple "xxx.split(os.sep)".
1379 an alternative of simple "xxx.split(os.sep)".
1379 It is recommended to use os.path.normpath() before using this
1380 It is recommended to use os.path.normpath() before using this
1380 function if need.'''
1381 function if need.'''
1381 return path.split(os.sep)
1382 return path.split(pycompat.ossep)
1382
1383
1383 def gui():
1384 def gui():
1384 '''Are we running in a GUI?'''
1385 '''Are we running in a GUI?'''
General Comments 0
You need to be logged in to leave comments. Login now