diff options
author | Anthony Newnam <anthony.newnam@garmin.com> | 2010-11-29 13:15:24 -0600 |
---|---|---|
committer | Anthony Newnam <anthony.newnam@garmin.com> | 2010-11-29 13:17:53 -0600 |
commit | b0f9a02394779c1c9422a9649412c9ac5fb0f12f (patch) | |
tree | f7cb755beb0dd1a24406a714d9433ecebf6ed208 | |
parent | 69b1e8aa65ab933fa919166d88aec90c86852beb (diff) | |
download | git-repo-b0f9a02394779c1c9422a9649412c9ac5fb0f12f.tar.gz |
Make path references OS independent
Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
-rw-r--r-- | command.py | 6 | ||||
-rw-r--r-- | manifest_xml.py | 2 | ||||
-rw-r--r-- | project.py | 4 | ||||
-rwxr-xr-x | repo | 6 |
4 files changed, 12 insertions, 6 deletions
@@ -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, |
@@ -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 | ||
@@ -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 | ||