Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Make path references OS independent
Browse files Browse the repository at this point in the history
Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
(cherry picked from commit b0f9a02)

Conflicts:

	command.py
  • Loading branch information
Anthony Newnam authored and spearce committed Jan 10, 2011
1 parent f18cb76 commit df14a70
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions command.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,23 @@ 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()
for p in all.values():
by_path[p.worktree] = p

if os.path.exists(path):
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)
else:
try:
Expand Down
2 changes: 1 addition & 1 deletion manifest_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,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,
Expand Down
4 changes: 2 additions & 2 deletions project.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,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

Expand Down
6 changes: 5 additions & 1 deletion repo
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,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))

Expand Down

0 comments on commit df14a70

Please sign in to comment.