summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Newnam <anthony.newnam@garmin.com>2010-11-29 13:15:24 -0600
committerAnthony Newnam <anthony.newnam@garmin.com>2010-11-29 13:17:53 -0600
commitb0f9a02394779c1c9422a9649412c9ac5fb0f12f (patch)
treef7cb755beb0dd1a24406a714d9433ecebf6ed208
parent69b1e8aa65ab933fa919166d88aec90c86852beb (diff)
downloadgit-repo-b0f9a02394779c1c9422a9649412c9ac5fb0f12f.tar.gz
Make path references OS independent
Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
-rw-r--r--command.py6
-rw-r--r--manifest_xml.py2
-rw-r--r--project.py4
-rwxr-xr-xrepo6
4 files changed, 12 insertions, 6 deletions
diff --git a/command.py b/command.py
index 6e4e2c57..4e0253fc 100644
--- a/command.py
+++ b/command.py
@@ -90,7 +90,7 @@ class Command(object):
90 project = all.get(arg) 90 project = all.get(arg)
91 91
92 if not project: 92 if not project:
93 path = os.path.abspath(arg) 93 path = os.path.abspath(arg).replace('\\', '/')
94 94
95 if not by_path: 95 if not by_path:
96 by_path = dict() 96 by_path = dict()
@@ -100,13 +100,15 @@ class Command(object):
100 try: 100 try:
101 project = by_path[path] 101 project = by_path[path]
102 except KeyError: 102 except KeyError:
103 oldpath = None
103 while path \ 104 while path \
104 and path != '/' \ 105 and path != oldpath \
105 and path != self.manifest.topdir: 106 and path != self.manifest.topdir:
106 try: 107 try:
107 project = by_path[path] 108 project = by_path[path]
108 break 109 break
109 except KeyError: 110 except KeyError:
111 oldpath = path
110 path = os.path.dirname(path) 112 path = os.path.dirname(path)
111 113
112 if not project: 114 if not project:
diff --git a/manifest_xml.py b/manifest_xml.py
index d888653d..35318d0a 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -357,7 +357,7 @@ class XmlManifest(Manifest):
357 worktree = None 357 worktree = None
358 gitdir = os.path.join(self.topdir, '%s.git' % name) 358 gitdir = os.path.join(self.topdir, '%s.git' % name)
359 else: 359 else:
360 worktree = os.path.join(self.topdir, path) 360 worktree = os.path.join(self.topdir, path).replace('\\', '/')
361 gitdir = os.path.join(self.repodir, 'projects/%s.git' % path) 361 gitdir = os.path.join(self.repodir, 'projects/%s.git' % path)
362 362
363 project = Project(manifest = self, 363 project = Project(manifest = self,
diff --git a/project.py b/project.py
index 5a143a76..1cea959e 100644
--- a/project.py
+++ b/project.py
@@ -233,8 +233,8 @@ class Project(object):
233 self.manifest = manifest 233 self.manifest = manifest
234 self.name = name 234 self.name = name
235 self.remote = remote 235 self.remote = remote
236 self.gitdir = gitdir 236 self.gitdir = gitdir.replace('\\', '/')
237 self.worktree = worktree 237 self.worktree = worktree.replace('\\', '/')
238 self.relpath = relpath 238 self.relpath = relpath
239 self.revisionExpr = revisionExpr 239 self.revisionExpr = revisionExpr
240 240
diff --git a/repo b/repo
index ff7c4188..3a545cc6 100755
--- a/repo
+++ b/repo
@@ -432,10 +432,14 @@ def _FindRepo():
432 dir = os.getcwd() 432 dir = os.getcwd()
433 repo = None 433 repo = None
434 434
435 while dir != '/' and not repo: 435 olddir = None
436 while dir != '/' \
437 and dir != olddir \
438 and not repo:
436 repo = os.path.join(dir, repodir, REPO_MAIN) 439 repo = os.path.join(dir, repodir, REPO_MAIN)
437 if not os.path.isfile(repo): 440 if not os.path.isfile(repo):
438 repo = None 441 repo = None
442 olddir = dir
439 dir = os.path.dirname(dir) 443 dir = os.path.dirname(dir)
440 return (repo, os.path.join(dir, repodir)) 444 return (repo, os.path.join(dir, repodir))
441 445