Browse Source

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>
Shawn O. Pearce 16 năm trước cách đây
mục cha
commit
ce86abbe8a
1 tập tin đã thay đổi với 9 bổ sung6 xóa
  1. 9 6
      command.py

+ 9 - 6
command.py

@@ -71,6 +71,12 @@ class Command(object):
     """A list of projects that match the arguments.
     """
     all = self.manifest.projects
+
+    mp = self.manifest.manifestProject
+    if mp.relpath == '.':
+      all = dict(all)
+      all[mp.name] = mp
+
     result = []
 
     if not args:
@@ -91,7 +97,9 @@ class Command(object):
             for p in all.values():
               by_path[p.worktree] = p
 
-          if os.path.exists(path):
+          try:
+            project = by_path[path]
+          except KeyError:
             while path \
               and path != '/' \
               and path != self.manifest.topdir:
@@ -100,11 +108,6 @@ class Command(object):
                 break
               except KeyError:
                 path = os.path.dirname(path)
-          else:
-            try:
-              project = by_path[path]
-            except KeyError:
-              pass
 
         if not project:
           raise NoSuchProjectError(arg)