mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Make path references OS independent
Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
This commit is contained in:
parent
69b1e8aa65
commit
b0f9a02394
@ -90,7 +90,7 @@ class Command(object):
|
|||||||
project = all.get(arg)
|
project = all.get(arg)
|
||||||
|
|
||||||
if not project:
|
if not project:
|
||||||
path = os.path.abspath(arg)
|
path = os.path.abspath(arg).replace('\\', '/')
|
||||||
|
|
||||||
if not by_path:
|
if not by_path:
|
||||||
by_path = dict()
|
by_path = dict()
|
||||||
@ -100,13 +100,15 @@ class Command(object):
|
|||||||
try:
|
try:
|
||||||
project = by_path[path]
|
project = by_path[path]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
oldpath = None
|
||||||
while path \
|
while path \
|
||||||
and path != '/' \
|
and path != oldpath \
|
||||||
and path != self.manifest.topdir:
|
and path != self.manifest.topdir:
|
||||||
try:
|
try:
|
||||||
project = by_path[path]
|
project = by_path[path]
|
||||||
break
|
break
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
oldpath = path
|
||||||
path = os.path.dirname(path)
|
path = os.path.dirname(path)
|
||||||
|
|
||||||
if not project:
|
if not project:
|
||||||
|
@ -357,7 +357,7 @@ class XmlManifest(Manifest):
|
|||||||
worktree = None
|
worktree = None
|
||||||
gitdir = os.path.join(self.topdir, '%s.git' % name)
|
gitdir = os.path.join(self.topdir, '%s.git' % name)
|
||||||
else:
|
else:
|
||||||
worktree = os.path.join(self.topdir, path)
|
worktree = os.path.join(self.topdir, path).replace('\\', '/')
|
||||||
gitdir = os.path.join(self.repodir, 'projects/%s.git' % path)
|
gitdir = os.path.join(self.repodir, 'projects/%s.git' % path)
|
||||||
|
|
||||||
project = Project(manifest = self,
|
project = Project(manifest = self,
|
||||||
|
@ -233,8 +233,8 @@ class Project(object):
|
|||||||
self.manifest = manifest
|
self.manifest = manifest
|
||||||
self.name = name
|
self.name = name
|
||||||
self.remote = remote
|
self.remote = remote
|
||||||
self.gitdir = gitdir
|
self.gitdir = gitdir.replace('\\', '/')
|
||||||
self.worktree = worktree
|
self.worktree = worktree.replace('\\', '/')
|
||||||
self.relpath = relpath
|
self.relpath = relpath
|
||||||
self.revisionExpr = revisionExpr
|
self.revisionExpr = revisionExpr
|
||||||
|
|
||||||
|
6
repo
6
repo
@ -432,10 +432,14 @@ def _FindRepo():
|
|||||||
dir = os.getcwd()
|
dir = os.getcwd()
|
||||||
repo = None
|
repo = None
|
||||||
|
|
||||||
while dir != '/' and not repo:
|
olddir = None
|
||||||
|
while dir != '/' \
|
||||||
|
and dir != olddir \
|
||||||
|
and not repo:
|
||||||
repo = os.path.join(dir, repodir, REPO_MAIN)
|
repo = os.path.join(dir, repodir, REPO_MAIN)
|
||||||
if not os.path.isfile(repo):
|
if not os.path.isfile(repo):
|
||||||
repo = None
|
repo = None
|
||||||
|
olddir = dir
|
||||||
dir = os.path.dirname(dir)
|
dir = os.path.dirname(dir)
|
||||||
return (repo, os.path.join(dir, repodir))
|
return (repo, os.path.join(dir, repodir))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user