summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-07-06 21:30:06 -0700
committerRaman Tenneti <rtenneti@google.com>2021-07-14 00:41:36 +0000
commit8db30d686a5298a28c6275cc05fb24fb1cfa1ba5 (patch)
treef6bbed3e2467e5c462daad49eb62b437780615b4 /subcmds
parente39d8b36f6bee37424712a9b6ba7765183175c5e (diff)
downloadgit-repo-8db30d686a5298a28c6275cc05fb24fb1cfa1ba5.tar.gz
superproject - More friendly user message when superproject failed.v2.16.1
superproject is going to be default for some users. This change doesn't fail for repo init or repo sync if source couldn't be synced because of errors in superproject and superproject=true in the config file. The commands will fail if --use-superproject is specified on the command line explicitly. The error messages are logged with trace2 event logs and will be monitored. + sync - When there are errors with superproject and git_superproject says it is fatal failure, sync will exit only when --use-superproject option is specified on the command line. + init - command doesn't fail *if there are any superproject errors), but it will print a warning message and logs message via trace2 event logs. For fatal errors, init will exit only when --use-superproject option is specified on the command line. + All git commands log the command that is being executed so trace2 event logs will know the manifest, remote url and the branch name. There is no functional change other than fatal errors are honored with --use-supeproject option with init/sync commands. Tested the code with the following commands. $ ./run_tests -v Test 1 - sync'ing without errors -------------------------------- Added the following lines to '~/.repoconfig/config [repo] superproject = true $ repo_dev init -u https://android.googlesource.com/platform/manifest -b android-s-beta-2 NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` repo: error: git fetch call failed, command: git ['fetch', 'https://android.googlesource.com/platform/superproject', '--depth', '1', '--force', '--no-tags', '--filter', 'blob:none', 'android-s-beta-2:android-s-beta-2'], return code: 128, stderr: fatal: couldn't find remote ref android-s-beta-2 warning: git update of superproject failed, repo sync will not use superproject to fetch source; while this error is not fatal, and you can continue to run repo sync, please run repo init with the --no-use-superproject option to stop seeing this warning Your identity is: Raman Tenneti <rtenneti@google.com> If you want to change this, please re-run 'repo init' with --config-name repo has been initialized in /usr/local/google/home/rtenneti/work/drive2/android/test $ repo_dev sync remote: Total 4 (delta 1), reused 4 (delta 1) NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` /usr/local/google/home/rtenneti/work/drive2/android/aosp/.repo/exp-superproject/925043f706ba64db713e9bf3b55987e2-superproject.git: Initial setup for superproject completed. ... Test 2 - init and sync fail when --use-superproject option is passed -------------------------------------------------------------------- $ repo_dev init -u https://android.googlesource.com/platform/manifest -b android-s-beta-2 --use-superproject remote: Total 57 (delta 16), reused 56 (delta 16) NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` repo: error: git fetch call failed, command: git ['fetch', 'https://android.googlesource.com/platform/superproject', '--depth', '1', '--force', '--no-tags', '--filter', 'blob:none', 'android-s-beta-2:android-s-beta-2'], return code: 128, stderr: fatal: couldn't find remote ref android-s-beta-2 warning: git update of superproject failed, repo sync will not use superproject to fetch source; while this error is not fatal, and you can continue to run repo sync, please run repo init with the --no-use-superproject option to stop seeing this warning rtenneti@rtenneti2:~/work/drive2/android/test$ repo_dev sync --use-superproject NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` repo: error: git fetch call failed, command: git ['fetch', 'https://android.googlesource.com/platform/superproject', '--depth', '1', '--force', '--no-tags', '--filter', 'blob:none', 'android-s-beta-2:android-s-beta-2'], return code: 128, stderr: fatal: couldn't find remote ref android-s-beta-2 warning: Cannot get project commit ids from manifest warning: Update of revisionId from superproject has failed, repo sync will not use superproject to fetch the source. Please resync with the --no-use-superproject option to avoid this repo warning. Test 3 - git fetch command fails and git command is printed ----------------------------------------------------------- With config change $ repo_dev init -u https://android.googlesource.com/platform/manifest -b android-s-beta-2 ... NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` .../android/test/.repo/exp-superproject/925043f706ba64db713e9bf3b55987e2-superproject.git: Performing initial setup for superproject; this might take several minutes. repo: error: git fetch call failed,command: git ['fetch', 'https://android.googlesource.com/platform/superproject', '--depth', '1', '--force', '--no-tags', '--filter', 'blob:none', 'android-s-beta-2:android-s-beta-2'], return code: 128, stderr: fatal: couldn't find remote ref android-s-beta-2 warning: git update of superproject failed, repo sync will not use superproject to fetch source; while this error is not fatal and you can continue to run repo sync please run repo init with the --no-use-superproject option to avoid the repo warning Your identity is: Raman Tenneti <rtenneti@google.com> If you want to change this, please re-run 'repo init' with --config-name repo has been initialized in .... Test 4 - no superproject tag ----------------------------- $ repo_dev init -u https://android.googlesource.com/platform/manifest -b pie-dev ... NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` repo error: superproject tag is not defined in manifest: .../android/pie_dev/.repo/manifest.xml warning: git update of superproject failed, repo sync will not use superproject to fetch source; while this error is not fatal and you can continue to run repo sync please run repo init with the --no-use-superproject option to avoid the repo warning Your identity is: Raman Tenneti <rtenneti@google.com> If you want to change this, please re-run 'repo init' with --config-name repo has been initialized in ... $ repo_dev sync NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` repo error: superproject tag is not defined in manifest: /usr/local/google/home/rtenneti/work/drive2/android/pie_dev/.repo/manifest.xml warning: Cannot get project commit ids from manifest warning: Update of revsionId from superproject has failed. Please resync with --no-use-superproject option to avoid the repo warning. Bug: [google internal] b/192614798 Bug: [google internal] b/Bug: [google internal] b/192614798 Change-Id: I9a97a0e7d9e609fad151bd7dd9cfc523eaa887cd Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/311502 Reviewed-by: Amith Dsouza <amithds@google.com> Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/init.py8
-rw-r--r--subcmds/sync.py7
2 files changed, 10 insertions, 5 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 536e367c..5671fc24 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -100,8 +100,12 @@ to update the working directory files.
100 quiet=opt.quiet) 100 quiet=opt.quiet)
101 sync_result = superproject.Sync() 101 sync_result = superproject.Sync()
102 if not sync_result.success: 102 if not sync_result.success:
103 print('error: git update of superproject failed', file=sys.stderr) 103 print('warning: git update of superproject failed, repo sync will not '
104 if sync_result.fatal: 104 'use superproject to fetch source; while this error is not fatal, '
105 'and you can continue to run repo sync, please run repo init with '
106 'the --no-use-superproject option to stop seeing this warning',
107 file=sys.stderr)
108 if sync_result.fatal and opt.use_superproject is not None:
105 sys.exit(1) 109 sys.exit(1)
106 110
107 def _SyncManifest(self, opt): 111 def _SyncManifest(self, opt):
diff --git a/subcmds/sync.py b/subcmds/sync.py
index bd5ffd0c..e6dbf1c8 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -309,10 +309,11 @@ later is required to fix a server side protocol bug.
309 if manifest_path: 309 if manifest_path:
310 self._ReloadManifest(manifest_path, load_local_manifests) 310 self._ReloadManifest(manifest_path, load_local_manifests)
311 else: 311 else:
312 print('error: Update of revsionId from superproject has failed. ' 312 print('warning: Update of revisionId from superproject has failed, '
313 'Please resync with --no-use-superproject option', 313 'repo sync will not use superproject to fetch the source. ',
314 'Please resync with the --no-use-superproject option to avoid this repo warning.',
314 file=sys.stderr) 315 file=sys.stderr)
315 if update_result.fatal: 316 if update_result.fatal and opt.use_superproject is not None:
316 sys.exit(1) 317 sys.exit(1)
317 return manifest_path 318 return manifest_path
318 319