Permalink
Browse files

Make path references OS independent

Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
  • Loading branch information...
1 parent 69b1e8a commit b0f9a02394779c1c9422a9649412c9ac5fb0f12f Anthony Newnam committed Nov 29, 2010
Showing with 12 additions and 6 deletions.
  1. +4 −2 command.py
  2. +1 −1 manifest_xml.py
  3. +2 −2 project.py
  4. +5 −1 repo
View
@@ -90,7 +90,7 @@ def GetProjects(self, args, missing_ok=False):
project = all.get(arg)
if not project:
- path = os.path.abspath(arg)
+ path = os.path.abspath(arg).replace('\\', '/')
if not by_path:
by_path = dict()
@@ -100,13 +100,15 @@ def GetProjects(self, args, missing_ok=False):
try:
project = by_path[path]
except KeyError:
+ oldpath = None
while path \
- and path != '/' \
+ and path != oldpath \
and path != self.manifest.topdir:
try:
project = by_path[path]
break
except KeyError:
+ oldpath = path
path = os.path.dirname(path)
if not project:
View
@@ -357,7 +357,7 @@ def _ParseProject(self, node):
worktree = None
gitdir = os.path.join(self.topdir, '%s.git' % name)
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)
project = Project(manifest = self,
View
@@ -233,8 +233,8 @@ def __init__(self,
self.manifest = manifest
self.name = name
self.remote = remote
- self.gitdir = gitdir
- self.worktree = worktree
+ self.gitdir = gitdir.replace('\\', '/')
+ self.worktree = worktree.replace('\\', '/')
self.relpath = relpath
self.revisionExpr = revisionExpr
View
6 repo
@@ -432,10 +432,14 @@ def _FindRepo():
dir = os.getcwd()
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)
if not os.path.isfile(repo):
repo = None
+ olddir = dir
dir = os.path.dirname(dir)
return (repo, os.path.join(dir, repodir))

0 comments on commit b0f9a02

Please sign in to comment.