Go to file
Raman Tenneti 8db30d686a superproject - More friendly user message when superproject failed.
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>
2021-07-14 00:41:36 +00:00
.github/workflows Drop support for Python 3.5 2021-06-03 11:34:17 +00:00
docs Gracefully ignore bad remove-project line 2021-07-08 16:48:21 +00:00
hooks Revert "commit-msg: Insert Change-Id at start of trailers" 2020-04-15 07:17:16 +00:00
release release-process: document schedule (including freezes) publicly 2020-07-23 08:07:38 +00:00
subcmds superproject - More friendly user message when superproject failed. 2021-07-14 00:41:36 +00:00
tests Gracefully ignore bad remove-project line 2021-07-08 16:48:21 +00:00
.flake8 flake8: Suppress "E731 do not assign a lambda expression, use a def" 2020-02-15 03:41:17 +00:00
.gitattributes Adds additional crlf clobber avoidance. 2016-06-22 08:36:45 +00:00
.gitignore Add parallelism to 'branches' command 2020-12-14 23:35:12 +00:00
.mailmap Update .mailmap 2020-02-13 04:49:55 +00:00
.project Set correct name in PyDev and Eclipse project config 2013-04-19 09:35:43 +09:00
.pydevproject Leverage the next keyword from python 2.7 2018-12-19 11:06:35 -08:00
color.py strip python2-only coding:utf-8 & print_function settings 2021-01-06 18:53:05 +00:00
command.py superproject: Don't exit if superproject tag doesn't exist in manifest. 2021-06-16 04:48:35 +00:00
completion.bash bash-completion: initial import based on CrOS version 2021-03-15 16:54:21 +00:00
editor.py strip python2-only coding:utf-8 & print_function settings 2021-01-06 18:53:05 +00:00
error.py help/version: sprinkle bug report URL around 2021-04-26 21:43:43 +00:00
event_log.py strip python2-only coding:utf-8 & print_function settings 2021-01-06 18:53:05 +00:00
git_command.py Add the ability to administratively enroll repo into using superproject. 2021-07-01 16:27:43 +00:00
git_config.py Add the ability to administratively enroll repo into using superproject. 2021-07-01 16:27:43 +00:00
git_refs.py git_refs: fix crash with binary . files in .git/refs/ 2021-02-28 16:07:24 +00:00
git_ssh add license header to a few more files 2019-06-13 13:23:19 -04:00
git_superproject.py superproject - More friendly user message when superproject failed. 2021-07-14 00:41:36 +00:00
git_trace2_event_log.py trace2_event_log: Added logging of error events. 2021-06-09 14:24:20 +00:00
gitc_utils.py superproject: pass groups to ToXml method. 2021-03-11 01:24:52 +00:00
hooks.py drop pyversion & is_python3 checking 2021-01-06 18:53:58 +00:00
LICENSE setup.py: add basic packaging files 2019-12-02 04:23:31 +00:00
main.py superproject: Don't exit if superproject tag doesn't exist in manifest. 2021-06-16 04:48:35 +00:00
manifest_xml.py Gracefully ignore bad remove-project line 2021-07-08 16:48:21 +00:00
MANIFEST.in setup.py: add basic packaging files 2019-12-02 04:23:31 +00:00
pager.py strip python2-only coding:utf-8 & print_function settings 2021-01-06 18:53:05 +00:00
platform_utils_win32.py drop pyversion & is_python3 checking 2021-01-06 18:53:58 +00:00
platform_utils.py platform_utils: delete unused FileDescriptorStreams APIs 2021-02-24 01:45:57 +00:00
progress.py progress: hide progress bar when --quiet 2021-04-13 22:25:26 +00:00
project.py Fix an issue when syncing with --use-superproject and clone bundles. 2021-06-30 15:31:15 +00:00
README.md README: use new bug template 2020-02-26 23:20:43 +00:00
repo launcher: bump version for new release 2021-05-10 17:10:04 +00:00
repo_trace.py strip python2-only coding:utf-8 & print_function settings 2021-01-06 18:53:05 +00:00
requirements.json Drop support for Python 3.5 2021-06-03 11:34:17 +00:00
run_tests run_tests: fix pytest selection inside tox venv 2021-06-03 15:27:51 +00:00
setup.py Drop support for Python 3.5 2021-06-03 11:34:17 +00:00
ssh.py ssh: rewrite proxy management for multiprocessing usage 2021-05-10 21:16:06 +00:00
SUBMITTING_PATCHES.md switch to "main" branch for development 2020-11-16 05:07:33 +00:00
tox.ini Drop support for Python 3.5 2021-06-03 11:34:17 +00:00
wrapper.py strip python2-only coding:utf-8 & print_function settings 2021-01-06 18:53:05 +00:00

repo

Repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow. Repo is not meant to replace Git, only to make it easier to work with Git. The repo command is an executable Python script that you can put anywhere in your path.

Contact

Please use the repo-discuss mailing list or issue tracker for questions.

You can file a new bug report under the "repo" component.

Please do not e-mail individual developers for support. They do not have the bandwidth for it, and often times questions have already been asked on repo-discuss or bugs posted to the issue tracker. So please search those sites first.

Install

Many distros include repo, so you might be able to install from there.

# Debian/Ubuntu.
$ sudo apt-get install repo

# Gentoo.
$ sudo emerge dev-vcs/repo

You can install it manually as well as it's a single script.

$ mkdir -p ~/.bin
$ PATH="${HOME}/.bin:${PATH}"
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
$ chmod a+rx ~/.bin/repo