Permalink
Browse files

Add -x option to crepo do-all.

This can be used to ignore missing repositories when doing things
like crepo do-all clean
  • Loading branch information...
1 parent a655687 commit 63b8536456271ef08b91a82fc2c3aac32a308651 @toddlipcon toddlipcon committed Mar 10, 2010
Showing with 23 additions and 6 deletions.
  1. +23 −6 crepo.py
View
@@ -152,18 +152,35 @@ def hard_reset_branches(args):
def do_all_projects(args):
"""Run the given git-command in every project
- Pass -p to do it in parallel"""
+ Pass -p to do it in parallel
+ Pass -x to ignore any non-checked-out projects
+ """
man = load_manifest()
-
- if args[0] == '-p':
- parallel = True
+
+ parallel = False
+ ignore_missing = False
+
+ while args and args[0].startswith("-"):
+ if args[0] == '-p':
+ parallel = True
+ elif args[0] == "-x":
+ ignore_missing = True
+ else:
+ raise "Unknown flag: " + arg
del args[0]
- else:
- parallel = False
towait = []
for (name, project) in man.projects.iteritems():
+ if not project.git_repo.is_cloned():
+ if ignore_missing:
+ print >>sys.stderr, "Skipping project " + name + " (not checked out)"
+ continue
+ else:
+ print >>sys.stderr, "Project " + name + " not cloned. " + \
+ "Pass '-x' option to skip uncloned repos in do-all"
+ sys.exit(1)
+
print >>sys.stderr, "In project: ", name, " running ", " ".join(args)
p = project.git_repo.command_process(args)
if not parallel:

0 comments on commit 63b8536

Please sign in to comment.