summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-07-03 16:52:28 -0700
committerShawn O. Pearce <sop@google.com>2009-07-03 20:03:38 -0700
commitce86abbe8ab9389fbad9d375e3754ed054d8b744 (patch)
tree07f97c93055b8743dd4db0848ad0fb1d05ddbac6
parent75b87c8a5171b26947d0a13d970f09defac736e3 (diff)
downloadgit-repo-ce86abbe8ab9389fbad9d375e3754ed054d8b744.tar.gz
Allow the manifest to be accessed it if is in work tree
If the manifest's work tree is actually inside of the rest of the client work tree then its only fair that we include it as a project that the user can access. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--command.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/command.py b/command.py
index 9e970e80..6e4e2c57 100644
--- a/command.py
+++ b/command.py
@@ -71,6 +71,12 @@ class Command(object):
71 """A list of projects that match the arguments. 71 """A list of projects that match the arguments.
72 """ 72 """
73 all = self.manifest.projects 73 all = self.manifest.projects
74
75 mp = self.manifest.manifestProject
76 if mp.relpath == '.':
77 all = dict(all)
78 all[mp.name] = mp
79
74 result = [] 80 result = []
75 81
76 if not args: 82 if not args:
@@ -91,7 +97,9 @@ class Command(object):
91 for p in all.values(): 97 for p in all.values():
92 by_path[p.worktree] = p 98 by_path[p.worktree] = p
93 99
94 if os.path.exists(path): 100 try:
101 project = by_path[path]
102 except KeyError:
95 while path \ 103 while path \
96 and path != '/' \ 104 and path != '/' \
97 and path != self.manifest.topdir: 105 and path != self.manifest.topdir:
@@ -100,11 +108,6 @@ class Command(object):
100 break 108 break
101 except KeyError: 109 except KeyError:
102 path = os.path.dirname(path) 110 path = os.path.dirname(path)
103 else:
104 try:
105 project = by_path[path]
106 except KeyError:
107 pass
108 111
109 if not project: 112 if not project:
110 raise NoSuchProjectError(arg) 113 raise NoSuchProjectError(arg)