##// END OF EJS Templates
py3: replace os.sep with pycompat.ossep (part 3 of 4)
Pulkit Goyal -
r30615:bb77654d default
parent child Browse files
Show More
@@ -731,7 +731,7 b' def copy(ui, repo, pats, opts, rename=Fa'
731 else:
731 else:
732 striplen = len(abspfx)
732 striplen = len(abspfx)
733 if striplen:
733 if striplen:
734 striplen += len(os.sep)
734 striplen += len(pycompat.ossep)
735 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
735 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:])
736 elif destdirexists:
736 elif destdirexists:
737 res = lambda p: os.path.join(dest,
737 res = lambda p: os.path.join(dest,
@@ -765,12 +765,12 b' def copy(ui, repo, pats, opts, rename=Fa'
765 abspfx = util.localpath(abspfx)
765 abspfx = util.localpath(abspfx)
766 striplen = len(abspfx)
766 striplen = len(abspfx)
767 if striplen:
767 if striplen:
768 striplen += len(os.sep)
768 striplen += len(pycompat.ossep)
769 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
769 if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])):
770 score = evalpath(striplen)
770 score = evalpath(striplen)
771 striplen1 = len(os.path.split(abspfx)[0])
771 striplen1 = len(os.path.split(abspfx)[0])
772 if striplen1:
772 if striplen1:
773 striplen1 += len(os.sep)
773 striplen1 += len(pycompat.ossep)
774 if evalpath(striplen1) > score:
774 if evalpath(striplen1) > score:
775 striplen = striplen1
775 striplen = striplen1
776 res = lambda p: os.path.join(dest,
776 res = lambda p: os.path.join(dest,
@@ -12,7 +12,10 b' import errno'
12 import mimetypes
12 import mimetypes
13 import os
13 import os
14
14
15 from .. import util
15 from .. import (
16 pycompat,
17 util,
18 )
16
19
17 httpserver = util.httpserver
20 httpserver = util.httpserver
18
21
@@ -139,7 +142,8 b' def staticfile(directory, fname, req):'
139 parts = fname.split('/')
142 parts = fname.split('/')
140 for part in parts:
143 for part in parts:
141 if (part in ('', os.curdir, os.pardir) or
144 if (part in ('', os.curdir, os.pardir) or
142 os.sep in part or os.altsep is not None and os.altsep in part):
145 pycompat.ossep in part or
146 os.altsep is not None and os.altsep in part):
143 return
147 return
144 fpath = os.path.join(*parts)
148 fpath = os.path.join(*parts)
145 if isinstance(directory, str):
149 if isinstance(directory, str):
@@ -31,6 +31,7 b' from . import ('
31 node,
31 node,
32 pathutil,
32 pathutil,
33 phases,
33 phases,
34 pycompat,
34 scmutil,
35 scmutil,
35 util,
36 util,
36 )
37 )
@@ -1172,7 +1173,7 b' class svnsubrepo(abstractsubrepo):'
1172 changes.append(path)
1173 changes.append(path)
1173 for path in changes:
1174 for path in changes:
1174 for ext in externals:
1175 for ext in externals:
1175 if path == ext or path.startswith(ext + os.sep):
1176 if path == ext or path.startswith(ext + pycompat.ossep):
1176 return True, True, bool(missing)
1177 return True, True, bool(missing)
1177 return bool(changes), False, bool(missing)
1178 return bool(changes), False, bool(missing)
1178
1179
@@ -17,6 +17,7 b' from . import ('
17 error,
17 error,
18 minirst,
18 minirst,
19 parser,
19 parser,
20 pycompat,
20 registrar,
21 registrar,
21 revset as revsetmod,
22 revset as revsetmod,
22 templatefilters,
23 templatefilters,
@@ -1243,7 +1244,7 b' def stylemap(styles, paths=None):'
1243 # only plain name is allowed to honor template paths
1244 # only plain name is allowed to honor template paths
1244 if (not style
1245 if (not style
1245 or style in (os.curdir, os.pardir)
1246 or style in (os.curdir, os.pardir)
1246 or os.sep in style
1247 or pycompat.ossep in style
1247 or os.altsep and os.altsep in style):
1248 or os.altsep and os.altsep in style):
1248 continue
1249 continue
1249 locations = [os.path.join(style, 'map'), 'map-' + style]
1250 locations = [os.path.join(style, 'map'), 'map-' + style]
@@ -215,7 +215,7 b' def setbinary(fd):'
215 msvcrt.setmode(fno(), os.O_BINARY)
215 msvcrt.setmode(fno(), os.O_BINARY)
216
216
217 def pconvert(path):
217 def pconvert(path):
218 return path.replace(os.sep, '/')
218 return path.replace(pycompat.ossep, '/')
219
219
220 def localpath(path):
220 def localpath(path):
221 return path.replace('/', '\\')
221 return path.replace('/', '\\')
@@ -316,7 +316,7 b' def findexe(command):'
316 return executable
316 return executable
317 return None
317 return None
318
318
319 if os.sep in command:
319 if pycompat.ossep in command:
320 return findexisting(command)
320 return findexisting(command)
321
321
322 for path in os.environ.get('PATH', '').split(pycompat.ospathsep):
322 for path in os.environ.get('PATH', '').split(pycompat.ospathsep):
General Comments 0
You need to be logged in to leave comments. Login now