summaryrefslogtreecommitdiffstats
path: root/subcmds/forall.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-03-25 01:58:20 -0400
committerMike Frysinger <vapier@google.com>2021-03-25 23:08:51 +0000
commitddab0604eee41e26572f0cf9f3fd5ff7a0637594 (patch)
tree49bf3180b007ea4dd457fdde4b6f719ed3ef4c86 /subcmds/forall.py
parent2ae44d7029fd435be96ba48eb1e367241c36c940 (diff)
downloadgit-repo-ddab0604eee41e26572f0cf9f3fd5ff7a0637594.tar.gz
forall: handle missing project refs betterv2.13.8
If the project exists, but the ref the manifest wants doesn't exist, don't throw an error (and abort the process in general). This can come up with a partially synced tree: the manifest is up-to-date, but not all the projects have yet been synced. Bug: https://crbug.com/gerrit/14289 Change-Id: Iba97413c476544223ffe518198c900c2193a00ed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/301262 Reviewed-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/forall.py')
-rw-r--r--subcmds/forall.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/subcmds/forall.py b/subcmds/forall.py
index aa998d20..f0ce97cb 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -24,6 +24,7 @@ import subprocess
24 24
25from color import Coloring 25from color import Coloring
26from command import DEFAULT_LOCAL_JOBS, Command, MirrorSafeCommand, WORKER_BATCH_SIZE 26from command import DEFAULT_LOCAL_JOBS, Command, MirrorSafeCommand, WORKER_BATCH_SIZE
27from error import ManifestInvalidRevisionError
27 28
28_CAN_COLOR = [ 29_CAN_COLOR = [
29 'branch', 30 'branch',
@@ -252,7 +253,7 @@ without iterating through the remaining projects.
252 rc = rc or errno.EINTR 253 rc = rc or errno.EINTR
253 except Exception as e: 254 except Exception as e:
254 # Catch any other exceptions raised 255 # Catch any other exceptions raised
255 print('Got an error, terminating the pool: %s: %s' % 256 print('forall: unhandled error, terminating the pool: %s: %s' %
256 (type(e).__name__, e), 257 (type(e).__name__, e),
257 file=sys.stderr) 258 file=sys.stderr)
258 rc = rc or getattr(e, 'errno', 1) 259 rc = rc or getattr(e, 'errno', 1)
@@ -295,7 +296,13 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config):
295 setenv('REPO_PROJECT', project.name) 296 setenv('REPO_PROJECT', project.name)
296 setenv('REPO_PATH', project.relpath) 297 setenv('REPO_PATH', project.relpath)
297 setenv('REPO_REMOTE', project.remote.name) 298 setenv('REPO_REMOTE', project.remote.name)
298 setenv('REPO_LREV', '' if mirror else project.GetRevisionId()) 299 try:
300 # If we aren't in a fully synced state and we don't have the ref the manifest
301 # wants, then this will fail. Ignore it for the purposes of this code.
302 lrev = '' if mirror else project.GetRevisionId()
303 except ManifestInvalidRevisionError:
304 lrev = ''
305 setenv('REPO_LREV', lrev)
299 setenv('REPO_RREV', project.revisionExpr) 306 setenv('REPO_RREV', project.revisionExpr)
300 setenv('REPO_UPSTREAM', project.upstream) 307 setenv('REPO_UPSTREAM', project.upstream)
301 setenv('REPO_DEST_BRANCH', project.dest_branch) 308 setenv('REPO_DEST_BRANCH', project.dest_branch)