From ad8aa6977248c46669575282302f5de90043fdf0 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Thu, 15 Apr 2021 09:20:51 -0700 Subject: [PATCH] sync: only print error.GitError, don't raise that exception. In _FetchOne & _CheckOne, only print error.GitError exception, but other exceptions are still thrown Fixes the GitError exceptions from /usr/lib/python3.8/multiprocessing/pool.py exiting the repo sync. Tested the code with the following commands and verified repo sync continues after fetch error because of an invalid SHA1. $ ./run_tests -v $ python3 ~/work/repo/git-repo/repo sync -m manifest_P21623846.xml -j32 ... error.GitError: Cannot fetch platform/vendor/google_devices/redbull/proprietary update-ref: fatal: d5a99e518f09d6abb0c0dfa899594e1ea6232459^0: not a valid SHA1 .... An error like the following when jobs=1 error.GitError: Cannot checkout platform/vendor/qcom/sdm845/proprietary/qcrilOemHook: Cannot initialize work tree for platform/vendor/qcom/sdm845/proprietary/qcrilOemHook Bug: https://crbug.com/gerrit/14392 Change-Id: I8922ad6c07c733125419f5698b0f7e32d70c7905 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303544 Reviewed-by: Mike Frysinger Tested-by: Raman Tenneti --- subcmds/sync.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subcmds/sync.py b/subcmds/sync.py index 4763fadc..21bc5e7d 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -354,6 +354,8 @@ later is required to fix a server side protocol bug. print('error: Cannot fetch %s from %s' % (project.name, project.remote.url), file=sys.stderr) + except GitError as e: + print('error.GitError: Cannot fetch %s' % str(e), file=sys.stderr) except Exception as e: print('error: Cannot fetch %s (%s: %s)' % (project.name, type(e).__name__, str(e)), file=sys.stderr) @@ -446,6 +448,9 @@ later is required to fix a server side protocol bug. try: project.Sync_LocalHalf(syncbuf, force_sync=force_sync) success = syncbuf.Finish() + except GitError as e: + print('error.GitError: Cannot checkout %s: %s' % + (project.name, str(e)), file=sys.stderr) except Exception as e: print('error: Cannot checkout %s: %s: %s' % (project.name, type(e).__name__, str(e)),