# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1481985864 -19800 # Node ID bb77654dc7ae3ff9e246086d964154d9b2e0abfe # Parent cfe66dcf45c00c75449dfc6bd48d9fdf465deec7 py3: replace os.sep with pycompat.ossep (part 3 of 4) diff -r cfe66dcf45c0 -r bb77654dc7ae mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sat Dec 17 20:02:50 2016 +0530 +++ b/mercurial/cmdutil.py Sat Dec 17 20:14:24 2016 +0530 @@ -731,7 +731,7 @@ else: striplen = len(abspfx) if striplen: - striplen += len(os.sep) + striplen += len(pycompat.ossep) res = lambda p: os.path.join(dest, util.localpath(p)[striplen:]) elif destdirexists: res = lambda p: os.path.join(dest, @@ -765,12 +765,12 @@ abspfx = util.localpath(abspfx) striplen = len(abspfx) if striplen: - striplen += len(os.sep) + striplen += len(pycompat.ossep) if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])): score = evalpath(striplen) striplen1 = len(os.path.split(abspfx)[0]) if striplen1: - striplen1 += len(os.sep) + striplen1 += len(pycompat.ossep) if evalpath(striplen1) > score: striplen = striplen1 res = lambda p: os.path.join(dest, diff -r cfe66dcf45c0 -r bb77654dc7ae mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Sat Dec 17 20:02:50 2016 +0530 +++ b/mercurial/hgweb/common.py Sat Dec 17 20:14:24 2016 +0530 @@ -12,7 +12,10 @@ import mimetypes import os -from .. import util +from .. import ( + pycompat, + util, +) httpserver = util.httpserver @@ -139,7 +142,8 @@ parts = fname.split('/') for part in parts: if (part in ('', os.curdir, os.pardir) or - os.sep in part or os.altsep is not None and os.altsep in part): + pycompat.ossep in part or + os.altsep is not None and os.altsep in part): return fpath = os.path.join(*parts) if isinstance(directory, str): diff -r cfe66dcf45c0 -r bb77654dc7ae mercurial/subrepo.py --- a/mercurial/subrepo.py Sat Dec 17 20:02:50 2016 +0530 +++ b/mercurial/subrepo.py Sat Dec 17 20:14:24 2016 +0530 @@ -31,6 +31,7 @@ node, pathutil, phases, + pycompat, scmutil, util, ) @@ -1172,7 +1173,7 @@ changes.append(path) for path in changes: for ext in externals: - if path == ext or path.startswith(ext + os.sep): + if path == ext or path.startswith(ext + pycompat.ossep): return True, True, bool(missing) return bool(changes), False, bool(missing) diff -r cfe66dcf45c0 -r bb77654dc7ae mercurial/templater.py --- a/mercurial/templater.py Sat Dec 17 20:02:50 2016 +0530 +++ b/mercurial/templater.py Sat Dec 17 20:14:24 2016 +0530 @@ -17,6 +17,7 @@ error, minirst, parser, + pycompat, registrar, revset as revsetmod, templatefilters, @@ -1243,7 +1244,7 @@ # only plain name is allowed to honor template paths if (not style or style in (os.curdir, os.pardir) - or os.sep in style + or pycompat.ossep in style or os.altsep and os.altsep in style): continue locations = [os.path.join(style, 'map'), 'map-' + style] diff -r cfe66dcf45c0 -r bb77654dc7ae mercurial/windows.py --- a/mercurial/windows.py Sat Dec 17 20:02:50 2016 +0530 +++ b/mercurial/windows.py Sat Dec 17 20:14:24 2016 +0530 @@ -215,7 +215,7 @@ msvcrt.setmode(fno(), os.O_BINARY) def pconvert(path): - return path.replace(os.sep, '/') + return path.replace(pycompat.ossep, '/') def localpath(path): return path.replace('/', '\\') @@ -316,7 +316,7 @@ return executable return None - if os.sep in command: + if pycompat.ossep in command: return findexisting(command) for path in os.environ.get('PATH', '').split(pycompat.ospathsep):