Allow repo forall to skip repo and manifest mirrors
When running `repo forall` in a mirror client, allow the caller to request skipping over the tools/repo.git and manifest.git repository as these aren't typically listed in the manifest, and thus don't appear in a normal (non-mirror) client checkout. Bug: REPO-18 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
feabbdb440
commit
42c14dc03e
3 changed files with 11 additions and 0 deletions
|
@ -287,6 +287,7 @@ class Manifest(object):
|
|||
worktree = None,
|
||||
relpath = None,
|
||||
revision = m.revision)
|
||||
project.metaProject = True
|
||||
self._projects[project.name] = project
|
||||
|
||||
def _ParseRemote(self, node):
|
||||
|
|
|
@ -223,6 +223,7 @@ class Project(object):
|
|||
self.snapshots = {}
|
||||
self.extraRemotes = {}
|
||||
self.copyfiles = []
|
||||
self.metaProject = False
|
||||
self.config = GitConfig.ForRepository(
|
||||
gitdir = self.gitdir,
|
||||
defaults = self.manifest.globalConfig)
|
||||
|
@ -1167,6 +1168,7 @@ class MetaProject(Project):
|
|||
remote = Remote('origin'),
|
||||
relpath = '.repo/%s' % name,
|
||||
revision = 'refs/heads/master')
|
||||
self.metaProject = True
|
||||
|
||||
def PreSync(self):
|
||||
if self.Exists:
|
||||
|
|
|
@ -54,6 +54,11 @@ not redirected.
|
|||
"""
|
||||
|
||||
def _Options(self, p):
|
||||
p.add_option('--manifest-only',
|
||||
help='Exclude repo and manifest mirrors',
|
||||
dest='manifest_only',
|
||||
action='store_true')
|
||||
|
||||
def cmd(option, opt_str, value, parser):
|
||||
setattr(parser.values, option.dest, list(parser.rargs))
|
||||
while parser.rargs:
|
||||
|
@ -81,6 +86,9 @@ not redirected.
|
|||
mirror = self.manifest.IsMirror
|
||||
rc = 0
|
||||
for project in self.GetProjects(args):
|
||||
if mirror and project.metaProject and opt.manifest_only:
|
||||
continue
|
||||
|
||||
env = dict(os.environ.iteritems())
|
||||
def setenv(name, val):
|
||||
if val is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue