diff --git a/hggit/__init__.py b/hggit/__init__.py index 65a64460de81f1a2dd1021c3ea696aa2217a4dfb_aGdnaXQvX19pbml0X18ucHk=..29586627ff32c393ad241c1f2408d64da00f2bc3_aGdnaXQvX19pbml0X18ucHk= 100644 --- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -127,8 +127,8 @@ def _url(orig, path, **kwargs): # we'll test for 'git@' then use our heuristic method to determine if it's # a git uri - if not (path.startswith(os.sep) and b':' in path): + if not (path.startswith(pycompat.ossep) and b':' in path): return orig(path, **kwargs) # the file path will be everything up until the last slash right before the # ':' @@ -131,8 +131,8 @@ return orig(path, **kwargs) # the file path will be everything up until the last slash right before the # ':' - lastsep = path.rindex(os.sep, None, path.index(b':')) + 1 + lastsep = path.rindex(pycompat.ossep, None, path.index(b':')) + 1 gituri = path[lastsep:] if util.isgitsshuri(gituri): diff --git a/hggit/git_handler.py b/hggit/git_handler.py index 65a64460de81f1a2dd1021c3ea696aa2217a4dfb_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..29586627ff32c393ad241c1f2408d64da00f2bc3_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -24,6 +24,7 @@ encoding, error, phases, + pycompat, util as hgutil, ) @@ -261,7 +262,7 @@ for root, dirs, files in os.walk(remotedir): for f in files: try: - ref = root.replace(refdir + os.sep, b'') + b'/' + ref = root.replace(refdir + pycompat.ossep, b'') + b'/' node = open(os.path.join(root, f)).read().strip() self._remote_refs[ref + f] = bin(self._map_git[node]) except (KeyError, IOError): diff --git a/hggit/hg2git.py b/hggit/hg2git.py index 65a64460de81f1a2dd1021c3ea696aa2217a4dfb_aGdnaXQvaGcyZ2l0LnB5..29586627ff32c393ad241c1f2408d64da00f2bc3_aGdnaXQvaGcyZ2l0LnB5 100644 --- a/hggit/hg2git.py +++ b/hggit/hg2git.py @@ -11,6 +11,7 @@ from mercurial import ( encoding, error, + pycompat, ) from . import compat @@ -52,7 +53,7 @@ >>> audit_git_path(u, b'this/is/safe') """ dangerous = False - for c in path.split(os.path.sep): + for c in path.split(pycompat.ossep): if encoding.hfsignoreclean(c) == b'.git': dangerous = True break