mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
forall: add an --ignore-missing option
In CrOS, our infra has to deal with partial checkouts constantly (for a variety of reasons). To help reset back to a good state, we run git commands via `repo forall`, but don't care about the missing checkouts. Add a flag so we can disambiguate between missing repos and failing git subcommands. Bug: https://crbug.com/1013377 Bug: https://crbug.com/1013623 Change-Id: Ie3498c6d111276c60d2ecedbba21bfa778588d50 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/241935 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
d1e93dd58a
commit
b466854bed
@ -139,6 +139,9 @@ without iterating through the remaining projects.
|
||||
p.add_option('-e', '--abort-on-errors',
|
||||
dest='abort_on_errors', action='store_true',
|
||||
help='Abort if a command exits unsuccessfully')
|
||||
p.add_option('--ignore-missing', action='store_true',
|
||||
help='Silently skip & do not exit non-zero due missing '
|
||||
'checkouts')
|
||||
|
||||
g = p.add_option_group('Output')
|
||||
g.add_option('-p',
|
||||
@ -323,6 +326,10 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config):
|
||||
cwd = project['worktree']
|
||||
|
||||
if not os.path.exists(cwd):
|
||||
# Allow the user to silently ignore missing checkouts so they can run on
|
||||
# partial checkouts (good for infra recovery tools).
|
||||
if opt.ignore_missing:
|
||||
return 0
|
||||
if ((opt.project_header and opt.verbose)
|
||||
or not opt.project_header):
|
||||
print('skipping %s/' % project['relpath'], file=sys.stderr)
|
||||
|
Loading…
Reference in New Issue
Block a user