diff options
| author | Anthony Newnam <anthony.newnam@garmin.com> | 2011-01-09 17:31:57 -0800 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2011-01-09 17:39:19 -0800 |
| commit | df14a70c4529821d7450303ec553a9f608af1656 (patch) | |
| tree | 4631409d5610fb103912687dc4f8321d9b46f3a4 | |
| parent | f18cb761731a791bf1b9ee8c6308bfce5c9d3e62 (diff) | |
| download | git-repo-df14a70c4529821d7450303ec553a9f608af1656.tar.gz | |
Make path references OS independent
Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
(cherry picked from commit b0f9a02394779c1c9422a9649412c9ac5fb0f12f)
Conflicts:
command.py
| -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
| @@ -74,7 +74,7 @@ class Command(object): | |||
| 74 | project = all.get(arg) | 74 | project = all.get(arg) |
| 75 | 75 | ||
| 76 | if not project: | 76 | if not project: |
| 77 | path = os.path.abspath(arg) | 77 | path = os.path.abspath(arg).replace('\\', '/') |
| 78 | 78 | ||
| 79 | if not by_path: | 79 | if not by_path: |
| 80 | by_path = dict() | 80 | by_path = dict() |
| @@ -82,13 +82,15 @@ class Command(object): | |||
| 82 | by_path[p.worktree] = p | 82 | by_path[p.worktree] = p |
| 83 | 83 | ||
| 84 | if os.path.exists(path): | 84 | if os.path.exists(path): |
| 85 | oldpath = None | ||
| 85 | while path \ | 86 | while path \ |
| 86 | and path != '/' \ | 87 | and path != oldpath \ |
| 87 | and path != self.manifest.topdir: | 88 | and path != self.manifest.topdir: |
| 88 | try: | 89 | try: |
| 89 | project = by_path[path] | 90 | project = by_path[path] |
| 90 | break | 91 | break |
| 91 | except KeyError: | 92 | except KeyError: |
| 93 | oldpath = path | ||
| 92 | path = os.path.dirname(path) | 94 | path = os.path.dirname(path) |
| 93 | else: | 95 | else: |
| 94 | try: | 96 | try: |
diff --git a/manifest_xml.py b/manifest_xml.py index 9d68f09f..0103cf55 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -435,7 +435,7 @@ class XmlManifest(object): | |||
| 435 | worktree = None | 435 | worktree = None |
| 436 | gitdir = os.path.join(self.topdir, '%s.git' % name) | 436 | gitdir = os.path.join(self.topdir, '%s.git' % name) |
| 437 | else: | 437 | else: |
| 438 | worktree = os.path.join(self.topdir, path) | 438 | worktree = os.path.join(self.topdir, path).replace('\\', '/') |
| 439 | gitdir = os.path.join(self.repodir, 'projects/%s.git' % path) | 439 | gitdir = os.path.join(self.repodir, 'projects/%s.git' % path) |
| 440 | 440 | ||
| 441 | project = Project(manifest = self, | 441 | project = Project(manifest = self, |
| @@ -236,8 +236,8 @@ class Project(object): | |||
| 236 | self.manifest = manifest | 236 | self.manifest = manifest |
| 237 | self.name = name | 237 | self.name = name |
| 238 | self.remote = remote | 238 | self.remote = remote |
| 239 | self.gitdir = gitdir | 239 | self.gitdir = gitdir.replace('\\', '/') |
| 240 | self.worktree = worktree | 240 | self.worktree = worktree.replace('\\', '/') |
| 241 | self.relpath = relpath | 241 | self.relpath = relpath |
| 242 | self.revisionExpr = revisionExpr | 242 | self.revisionExpr = revisionExpr |
| 243 | 243 | ||
| @@ -430,10 +430,14 @@ def _FindRepo(): | |||
| 430 | dir = os.getcwd() | 430 | dir = os.getcwd() |
| 431 | repo = None | 431 | repo = None |
| 432 | 432 | ||
| 433 | while dir != '/' and not repo: | 433 | olddir = None |
| 434 | while dir != '/' \ | ||
| 435 | and dir != olddir \ | ||
| 436 | and not repo: | ||
| 434 | repo = os.path.join(dir, repodir, REPO_MAIN) | 437 | repo = os.path.join(dir, repodir, REPO_MAIN) |
| 435 | if not os.path.isfile(repo): | 438 | if not os.path.isfile(repo): |
| 436 | repo = None | 439 | repo = None |
| 440 | olddir = dir | ||
| 437 | dir = os.path.dirname(dir) | 441 | dir = os.path.dirname(dir) |
| 438 | return (repo, os.path.join(dir, repodir)) | 442 | return (repo, os.path.join(dir, repodir)) |
| 439 | 443 | ||
