summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* manifest: make repo-hooks more robust wrt element orderingJack Neus2021-09-232-23/+39
| | | | | | | | | | | | | Currently, repo will fail to sync to a manifest if the definition of the repo-hooks project comes after the repo-hooks element. BUG=none TEST=new test, run_tests Change-Id: I0bf85625173492af6c6404d4b67543e96e670562 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/318520 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Jack Neus <jackneus@google.com>
* update-manpages: avoid regen just for datestamp updateMike Frysinger2021-09-221-5/+17
| | | | | | | | | | | To avoid noise due to the passage of time, don't regenerate man pages if the only thing different is the datestamp in the header. Change-Id: Ic8d7b08d12e59c66994c0cc2d4ec2d2ed3eb6e6d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/318575 Reviewed-by: Jack Neus <jackneus@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* superproject: Move enrollment to opt-out when enabled globallyv2.16.8Xin Li2021-09-201-36/+10
| | | | | | | | | | | | | | | | Our internal experiments was a success so far and we are enrolling 100% users now. Instead of asking every two weeks, simply consider a lack of unexpired choice as accepting the system default. With this change the user would still be able to override the system default with --no-use-superproject, or to permanently set the choice in user's profile with git config --global repo.superprojectchoice. Bug: [google internal] b/190688390 Change-Id: Idc77a9cbf88a169d90304169e91f0d722dc4ac8b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/317975 Tested-by: Xin Li <delphij@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com>
* superproject: Log branch and remote url with every log message.Raman Tenneti2021-09-161-14/+18
| | | | | | | | | | | | | | | | | | | | Saved superproject's remote URL in _remote_url data and used it in the _Fecth function. Tested: $ ./run_tests $ flake8 git_superproject.py $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest $ repo_dev sync Verified the all log messages have the following format. repo superproject branch: <branch> url: <url> warning: <message> Bug: [google internal] b/200072098 Change-Id: Iac6af7c99225479fd50bc6909396b22e0ce5f76b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/318177 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* sync: Log repo sync state events as 'data' events.Raman Tenneti2021-09-144-5/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git_trace2_event_log.py: + Added LogDataConfigEvents method to log 'data' events. Sync's current_sync_state and previous_sync_state are logged as 'data' events in the current log. It logs are key/value in the |config| argument. Each key is prefixed with |prefix| argument. The following are sample events that are logged during repo sync. {"event":"data", "sid":"repo-20210914T181545Z-P000330c0/repo-20210914T181545Z-P000330c0", "thread":"MainThread", "time":"2021-09-14T18:16:19.935846Z", "key":"previous_sync_state/repo.syncstate.main.synctime", "value":"2021-09-14T17:27:11.573717Z"} {"event":"data", "sid":"repo-20210914T181545Z-P000330c0/repo-20210914T181545Z-P000330c0", "thread":"MainThread", "time":"2021-09-14T18:16:19.955546Z", "key":"current_sync_state/repo.syncstate.main.synctime", "value":"2021-09-14T18:16:19.935979Z"} tests/test_git_trace2_event_log.py: + Added unit tests sync.py: + Changed logging calls to LogDataConfigEvents. Tested: $ ./run_tests Tested it by running the following command multiple times. $ repo_dev sync -j 20 repo sync has finished successfully Verified config data is looged in trace2 event logs. Bug: [google internal] b/199758376 Change-Id: I75fd830e90c1811ec28510538c99a2632b104e85 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/317823 Reviewed-by: Josh Steadmon <steadmon@google.com> Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* superproject: Provide accurate feedback for user choicev2.16.7Xin Li2021-09-081-3/+8
| | | | | | | | | | | | | | Currently the code would give a message that would appear like the user have enrolled the experiment regardless of the actual choice. For users who choose to not enroll in the experiment, we should give them instructions to override (enable) superproject once instead of how to disable it, which is what the code already behave. Bug: [google internal] b/199167992 Change-Id: Iba3314cb510aedf024375a26baa8bc1d5e2846cf Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/317382 Tested-by: Xin Li <delphij@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com>
* superoject: log error message in the 'fmt' field also.v2.16.6Raman Tenneti2021-09-031-1/+1
| | | | | | | | | | | Tested: + Verified error messages are being collected. Bug: [google internal] b/193711236 Change-Id: I6c608a2af332ccd38722b7f83a82e5ac8fa143db Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/317162 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* docs: Add version for Ubuntu 21.04 Hirsute and Debian 11 BullseyeRoger Shimizu2021-09-031-0/+5
| | | | | | | | | | | * Add footer to the version table, so easier to read and maintain. * Add version entry for Ubuntu 21.04 Hirsute (non-LTS). * Add version entry for Debian 11 Bullseye (LTS). Change-Id: Ic72f911e616b1a13901e56074004f05cdc2c7633 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/313322 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Xin Li <delphij@google.com>
* superproject: print messages if the manifest has superproject tag.v2.16.5Raman Tenneti2021-08-134-21/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) If the manifest has superproject tag (git_master, etc), then display error/warning messages (as it is doing today) 2) If the manifest doesn't have superproject tag (nest, chromeos manifests), then don't display any error/warning messages about superrproject (behave as though user has specified --no-use-superproject). 3) Print error/warning messages if --use-superproject passed as argument to repo sync. 4) No change in behavior for the repo init command. git_superproject.py: + Fixed typo in _WriteManifestFile method name + Superproject accepts print_message as an argument and it defaults to True. All messages that are printed to stderr are controlled by this flag. If it is True, then messages get printed. + Added PrintMessages function which return true if either --use-superproject is specified on the command line or if the manifest has a superproject tag. sync.py: + Displays the warning message if PrintMessgages are enabled and passes that as argument to superproject object. + Added 'hassuperprojecttag' trace2 log entry for analysis. We can find users/branches that are using superproject, but the manifest is missing the superproject tag. Tested: $ ./run_tests + Verified printing of messages with and without superproject tag, with with --use-superproject option. + aosp-master $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest $ repo_dev sync + A manifest without superproject tag. $ repo_dev init -m $(pwd)/manifest_7482982.xml $ repo_dev sync -n -c -j32 -m $(pwd)/manifest_7482982.xml Bug: [google internal] b/196411099 Change-Id: I92166dcad15a4129fab82edcf869e7c8db3efd4b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/314982 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* superproject: prepend messages with - "repo superproject"Raman Tenneti2021-08-122-19/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Changed _LogError method to _LogWarning. Replaced 'repo error:' with "repo superproject warning:"(except IOError message, which is still an "repo superproject error:" message) Tested: $ ./run_tests Tested the errors and warnings by forcing the error/warning. $ repo_dev sync -j 20 --use-superproject platform/packages/apps/Music ... repo superproject warning: please file a bug using go/repo-bug to report missing commit_ids for: [] ... repo superproject error: cannot write manifest to : /sdc/android/src/aosp/.repo/exp-superproject/superproject_override.xml ... Bug: [google internal] b/193711236 Change-Id: Ia0b6c830e04cf18dfc1a2ce325181a5b1160e054 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/314642 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Ian Kasprzak <iankaz@google.com> Reviewed-by: Xin Li <delphij@google.com>
* man: make output system independentMike Frysinger2021-07-3114-13/+38
| | | | | | | | | | | | | | The current help output might change based on the number of CPU cores available (since it reflects the dynamic --jobs logic). This is good for users running repo locally, but not good for shipping static man pages. Hook the help output to have it generate the same output all the time. Change-Id: I3098ceddc0ad914b0b8e3b25d660b5a264cb41ee Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312882 Reviewed-by: Roger Shimizu <rosh@debian.org> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: Remove '_' from the repo.syncstate.* keys when saved to config.v2.16.4Raman Tenneti2021-07-293-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | GitConfig doesn't save keys if the keys contain "_" characters. Some of the options like mp_update, use_superproject have underscores. This fixes issue with previous_sync_state missing some of the options. Tested: $ ./run_tests $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest Tested it by running the sync command multiple times and verifing previous_sync_state and current_sync_state have the same keys. $ repo_dev sync -j 20 repo sync has finished successfully Verified config file has [syncstate ...] data saved. Bug: [google internal] b/188573450 Change-Id: I16b52a164f9dd1633d7dad1d8cf6b151c629fcb1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/313242 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* sync: Added logging of repo sync state and config options for analysis.Raman Tenneti2021-07-296-9/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git_config.py: + Added SyncAnalysisState class, which saves the following data into the config object. ++ sys.argv, options, superproject's logging data. ++ repo.*, branch.* and remote.* parameters from config object. ++ current time as synctime. ++ Version number of the object. + All the keys for the above data are prepended with 'repo.syncstate.' + Added GetSyncAnalysisStateData and UpdateSyncAnalysisState methods to GitConfig object to save/get the above data. git_trace2_event_log.py: + Added LogConfigEvents method with code from DefParamRepoEvents to log events. sync.py: + superproject_logging_data is a dictionary that collects all the superproject data that is to be logged as trace2 event. + Sync at the end logs the previously saved syncstate.* parameters as previous_sync_state. Then it calls config's UpdateSyncAnalysisState to save and log all the current options, superproject logged data. docs/internal-fs-layout.md: + Added doc string explaining [repo.syncstate ...] sections of .repo/manifests.git/config file. test_git_config.py: + Added unit test for the new methods of GitConfig object. Tested: $ ./run_tests $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest Tested it by running the following command multiple times. $ repo_dev sync -j 20 repo sync has finished successfully Verified config file has [syncstate ...] data saved. Bug: [google internal] b/188573450 Change-Id: I1f914ce50f3382111b72940ca56de7c41b53d460 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/313123 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Xin Li <delphij@google.com>
* superproject: Skip updating of superproject when -l is used with sync.Raman Tenneti2021-07-282-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Skip updating the superproject when -l is present and use the existing superproject, if available (this would make sync -l work as it's intended to do), and fall back to sync without superproject when not (this would catch the case when superproject is enabled by automatic rollout). Tested: $ repo sync -j 20 -n NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` /usr/local/google/home/rtenneti/work/android/src/aosp/.repo/exp-superproject/925043f706ba64db713e9bf3b55987e2-superproject.git: Initial setup for superproject completed. Fetching: 100% (1032/1032), done in 41.184s ... $ repo_dev sync -j 20 -l prebuilts/asuite/: discarding 1 commits prebuilts/runtime/: discarding 1 commits ... repo sync has finished successfully. + With superproject-override.xml and test it. $ ls -l .repo/exp-superproject/ total 176 drwxr-xr-x 7 rtenneti primarygroup 4096 Jul 27 14:10 925043f706ba64db713e9bf3b55987e2-superproject.git -rw-r--r-- 1 rtenneti primarygroup 172742 Jul 27 14:10 superproject_override.xml rtenneti@rtenneti:~/work/android/src/aosp$ repo_dev sync -j 20 -l ... repo sync has finished successfully. + Rename the file superproject-override.xml and test it. $ ls -l .repo/exp-superproject/ total 176 drwxr-xr-x 7 rtenneti primarygroup 4096 Jul 27 14:10 925043f706ba64db713e9bf3b55987e2-superproject.git -rw-r--r-- 1 rtenneti primarygroup 172742 Jul 27 14:10 temp.xml $ repo_dev sync -j 20 -l Checking out: 1% (12/1031) platform/external/rust/crates/fallible-streaming-iteexternal/linux-kselftest/: discarding 1 commits prebuilts/remoteexecution-client/: discarding 1 commits Checking out: 51% (536/1031) platform/prebuilts/gcc/darwin-x86/aarch64/.... .... Checking out: 100% (1031/1031), done in 5.478s repo sync has finished successfully. Bug: [google internal] b/184368268 Change-Id: I3aba5872e4f7c299977b92c2a39847ef28698c5a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312962 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* repo: add --show-toplevel akin to gitMike Frysinger2021-07-282-0/+11
| | | | | | | | | | Simple API to make it easy to find the top of the repo client checkout for users. This mirrors the `git rev-parse --show-toplevel` API. Change-Id: I0c3f98def089d0fc9ebcfa50aa3dc02091c1c273 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312909 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo: refactor help output handlingMike Frysinger2021-07-285-19/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we have the behavior: * `repo`: Equivalent to `repo help` -- only shows common subcommands (with short description), and then exits 0. * `repo --help`: Shows repo's core options, lists all commands (no specific info), and then exits 0. The first case is not behaving well: * If you run `repo` without a specific subcommand, that's an error, so we should be exiting 1 instead. * Showing only subcommands and no actual option summary makes it seem like repo itself doesn't take any options. This confuses users. Let's rework things a bit. Now we have the behavior: * `repo`: Shows repo's core options, lists all commands (no specific info), and then exits 1. * `repo --help`: Shows repo's core options, shows common subcommands (with short description), and then exits 0. * `repo --help-all`: Shows repo's core options, shows all subcommands (with short description), and then exits 0. Basically we swap the behavior of `repo` and `repo --help`, and fix the exit status when the subcommand is missing. The addition of --help-all is mostly for the man pages. We were relying on `repo help --all` to generate the repo(1) man page, but that too omitted the core repo options. Now the man page includes all the core repo options and provides a summary of all commands. Change-Id: I1f99b99d5b8af2591f96a078d0647a3d76d6b0fc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312908 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo: make --version always workMike Frysinger2021-07-281-3/+1
| | | | | | | | | | | | | | | | | | We don't really care what the subcommand is set to when --version output is requested, so stop enforcing it. This fixes some weird behavior like `repo --version version` fails, but `repo --version help` works. The new logic skips subcommand validation, so `repo --version asdf` will still display the version output. This matches git behavior, and makes a bit of sense when we consider that the user really wants to see the tool version, and probably doesn't care about anything else on the command line. Change-Id: I87454d473c2c8869344b3888a7affaa2e03f5b0f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312907 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo: refactor internal --help/--version parsingMike Frysinger2021-07-281-24/+24
| | | | | | | | | | | | | | | | The _ParseArgs method parses the arguments and processes some of the options, with the rest left to the _Run method. Simplify the _ParseArgs method to only parse arguments and have _Run handle all actual processing. This will make it easier to add more terminal options (ones that exit immediately without a subcommand), and makes it easier to understand the overall code flow. Change-Id: I47f7274c3f2b59378fd479e403e70fb24b681536 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312906 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* bash-completion: complete projects with repo forallMike Frysinger2021-07-271-1/+21
| | | | | | | | | | | We need to add a little bit more logic here so we stop completing projects once we see the -c argument. Bug: https://crbug.com/gerrit/14797 Change-Id: Ic2ba4f3dd616ec49d8ad754ff62d0d6e0250dbe6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312905 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* list: add a --relative-to optionMike Frysinger2021-07-273-7/+22
| | | | | | | | | | | | | | | The current list output only shows project paths relative to the root of the repo client checkout. It can be helpful to also get a listing of paths based on other paths (e.g. the current working directory), so add an option to repo list to support that. We'll leverage this in bash completion to support completing projects by their local paths and not just remote names. Bug: https://crbug.com/gerrit/14797 Change-Id: Ia2b35d18c890217768448118b003874a1016efd4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312904 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* bash-completion: refactor unique subcommand processingMike Frysinger2021-07-271-15/+27
| | | | | | | | | | | | | Let's keep the main processing loop free of subcommand implementations by pulling the existing help & start commands into dedicated functions. Having a single giant function is harder to track as we add more and more logic in. Bug: https://crbug.com/gerrit/14797 Change-Id: I2b62dc430c0e7574f09aa4838f4ef03fbe4bf7fb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312903 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* bash-completion: fallback to default completionMike Frysinger2021-07-271-1/+3
| | | | | | | | | | | | | If we can't provide any completions, then fallback to the standard bash & readline ones. This allows completion based on the user's settings (e.g. local paths) to kick in. Bug: https://crbug.com/gerrit/14797 Test: `repo rebase ./src/<tab>` works in a CrOS checkout Change-Id: Iced343c4fc6fd3a932aab99875c1346687d187b6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312902 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo: properly handle remote annotations in manifest_xmlJack Neus2021-07-234-18/+80
| | | | | | | | | | BUG=b:192664812 TEST=tests/ Change-Id: I1aa50260f4a00d3cebbd531141e1626825e70127 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312643 Tested-by: Jack Neus <jackneus@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Force a fetch when superproject has a newer SHA1 for remote branch.v2.16.3Xin Li2021-07-201-0/+1
| | | | | | | | | | | | | | | | | | For older git-repo versions, we might have only fetched the SHA1 revision that was provided by the project, but have remote branch left intact as long as they exist. When the remote branch become stale, some repo operations like rebase would fail, and repo sync would not correct this situation. Fix this by tightening the requirement to also require the superproject provided SHA1 be an ancestor or equal to the tip-of-tree of the remote branch. Bug: [google internal] b/193798453 Change-Id: Ie34c5d860dabb1cbd9f822da929088ec69c79cf6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312642 Tested-by: Xin Li <delphij@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com>
* manifest: Support ignoring local manifests with 'repo manifest'Michael Kelly2021-07-202-0/+12
| | | | | | | | | | | | | | | | | Currently users need to look up the baseline manifest by loading the specific manifest file. This exposes them to the internals of how the manifest is stored which may potentially be fragile (eg: It was switched from a symlink pointing at the file in the report to an actual file with an 'include' tag). Instead of doing this, we can provide an option to the 'repo manifest' command which will emit the baseline manifest and decouple users from the internal manifest details. Change-Id: I12ee9160feaa591484ae71f404bc529be500ae4e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/311202 Tested-by: Michael Kelly <mkelly@arista.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Add script 'release/update-manpages' to generate manpagesRoger Shimizu2021-07-1630-0/+2577
| | | | | | | | | | | | | | | | | Debian package started to ship manpages for repo since 2.8 [1] And it's about for one year. So I think it should be upstreamed. The script depends on help2man, which is available in both debian [2] and ubuntu [3]. [1] https://tracker.debian.org/news/1150858/accepted-repo-28-1-source-into-unstable [2] https://tracker.debian.org/pkg/help2man [3] https://launchpad.net/ubuntu/+source/help2man Change-Id: Ide2b356d0944ebde34cc96c6d5a782655bd72288 Signed-off-by: Roger Shimizu <rosh@debian.org> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309782 Reviewed-by: Mike Frysinger <vapier@google.com>
* Update manifest_name with the returned manifest name for superproject.v2.16.2Xin Li2021-07-141-3/+1
| | | | | | | | | | | This is similar to smart sync, allowing sync to benefit from the patched manifest. Bug: [google internal] b/190688390 Change-Id: I158a80afceca606dcd81ec76b2caede369f7ed03 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312142 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Xin Li <delphij@google.com>
* superproject - More friendly user message when superproject failed.v2.16.1Raman Tenneti2021-07-143-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix an issue that repo can't see projects declared in a local manifest.Xin Li2021-07-131-1/+1
| | | | | | | | | | | | | | | When loading of superproject failed, we were resetting the manifest to None, and later code would reload the manifest to see if there are submodules, which would load the non-local manifest, causing sync with superproject to fail. Address this by setting the manifest_name to opt.manifest_name instead. Bug: [google internal] b/189139268 Change-Id: I3616512e1c4b73e7eca0d83fd1fc474b825adbbf Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/311102 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
* Gracefully ignore bad remove-project lineMichael Kelly2021-07-083-10/+64
| | | | | | | | | | | | | | | | Sometimes, we don't care if the remove project is referring to a non-existing project and we can just ignore it. This change allows us to ignore remove-project entries if the project that they refer to doesn't exist, making them effectively a no-op. Because this change breaks existing configuration, we allow this to be configuration controlled using the `optional` attribute in the remove-project tag. Change-Id: I6313a02983e81344eadcb4e47d7d6b037ee7420e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310964 Tested-by: Michael Kelly <mkelly@arista.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: dump git output on errorsMike Frysinger2021-07-041-1/+1
| | | | | | | | Bug: https://crbug.com/gerrit/14700 Change-Id: I1ae53dc7f3792b7e8f11d73f706864fb6591eee8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/311142 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Add the ability to administratively enroll repo into using superproject.Xin Li2021-07-014-11/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Repo will remember a choice and an expiration time of the choice, per user, about whether to use superproject by default. When not specified from command line and the choice is not expired, repo would use the user default value. When a user default value is not present and when the system wide enable default is provided in git's system configuration, repo would ask the user for a confirmation which will be valid for two weeks. git_config.py: Add support for system config. When reading system config, we would use --system to avoid hardcoding a path as the value may be different on some other distributions. git_superproject.py: Add a new subroutine, _UseSuperproject(), which returns whether superproject should be used and whether it is from a user configuration. The value is determined in the following order: 1. If the user specifies either --use-superproject or --no-use-superproject, then that choice is being used. 2. If neither is specified, we would then check the saved value (upon repo init) and use that choice when there was a choice. 3. We then check if there is a saved and unexpired value for user's choice in their ~/.gitconfig, and use the unexpired choice, if available. 4. Finally, if all the above didn't give us a decision, and if the git system configuration is providing a rollout hint, present a prompt to user for their decision and save it in ~/.gitconfig. subcmds/sync.py: Make use of the new UseSuperproject() provided by git_superproject.py. While there also silent stderr from git describe when determining the version of repo. Bug: [google internal] b/190688390 Change-Id: Iad3ee03026342ee500e5d65e2f0fa600d7637613 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309762 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
* Fix an issue when syncing with --use-superproject and clone bundles.Xin Li2021-06-303-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | It is possible that a clone bundle contained the object referenced by the branch in the manifest and in the superproject, but not the branch itself (for example, the branch may be newly created from an existing branch, or is not vislble to the user downloading the clone bundle). When --use-superproject is enabled, because we are overriding revisionExpr with the SHA1 revision provided by the superproject, the verification step would succeed, but because the expected branch do not exist, it would confuse git-repo at a later time, as it is expecting the remote branch to exist in the local clone. In project.py, fix this by making SetRevisionId() to always remember the actual branch name and verify it in _CheckForImmutableRevision() so that we only skip the fetch step when both objects exists locally. Bug: [google internal] b/191974277 Change-Id: I49d3ca0667f524c8c45f416492faf95b1dd822fb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310802 Reviewed-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
* superproject - don't update the commit ids of projects that have revisionId.Raman Tenneti2021-06-292-2/+52
| | | | | | | | | | | | | | | | | | | | Pinned manifests and release manifest have revisionId set for all projects. For such projects don't update the commit ids. Tested the code with the following commands. $ ./run_tests -v $ repo_dev sync --use-superproject -j8 $ repo_dev sync -n -c -j32 -m $(pwd)/manifest_7482982.xml Bug: [google internal] b/191995372 Change-Id: I4681135b1d15f4a63527b6f0356d76ec842485d6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310582 Reviewed-by: Xin Li <delphij@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* superproject: Don't exit if superproject tag doesn't exist in manifest.v2.16Raman Tenneti2021-06-166-61/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't exit if there are missing commit ids in superproject. This change implements the following suggestion from delphij@: "we should note the event (so we know that --use-superproject but there were some errors, e.g. manifest didn't specify commit id for some reason, or if there is no superproject but --use-superproject is used), print out a message telling the use that this is not support, but continue as if --no-use-superproject was specified?" Changes: superproject: + Added git_trace2_event_log as an argument to the constructor. + Sync method returns SyncResult a NamedTuple of ++ success - True if sync of superproject is successful, or False. ++ fatal - True if caller should exit, Or False. + UpdateProjectsRevisionId returns UpdateProjectsResult a NamedTuple of ++ manifest_path - path name of the overriding manifest file instead of None ++ fatal - True if caller should exit, Or False + _GetAllProjectsCommitIds returns CommitIdsResult a NamedTuple of ++ commit_ids - a dictionary with the projects/commit ids on success, otherwise None ++ fatal - True if caller should exit, Or False + Added _SkipUpdatingProjectRevisionId a helper function to see if a project's revision id needs to be updated or not. This function is used to exclude projects from local manifest file. + Added the following error events into git_trace2_event_log ++ If superproject is missing in a manifest ++ If there are missing commit ids for projects. command.py: + Deleted unused import - platform + Added git_trace2_event_log as a member so all subcmds can log error events. main.py: + Initialized git_trace2_event_log as a member of command object. init.py: + Deleted unused import - optparse init.py: + Called sys.exit only if Sync returns exit=True sync.py: + Called sys.exit only if Superproject's UpdateProjectsRevisionId returns exit=True + Reloaded the manifest only if manifest path is returned by UpdateProjectsRevisionId. If not, fall back to the old way of doing repo sync. test_git_superproject: + Added code to verify error events are being logged. + Added a test for no superproject tag + Added test for UpdateProjectsRevisionId not updating the revision id with the commit ids. Tested the code with the following commands. + Positive test case with aosp-master. $ repo_dev init -u persistent-https://android.git.corp.google.com/platform/manifest -b master --use-superproject NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` .../android/aosp/.repo/exp-superproject/925043f706ba64db713e9bf3b55987e2-superproject.git: Initial setup for superproject completed. 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 .../android/aosp $ repo_dev sync -j40 --use-superproject remote: Total 12 (delta 4), reused 12 (delta 4) NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` .../android/aosp/.repo/exp-superproject/925043f706ba64db713e9bf3b55987e2-superproject.git: Initial setup for superproject completed. ... repo sync has finished successfully. + Negative test case without superproject tag. $ repo_dev sync -j40 --use-superproject 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/aosp/.repo/manifest.xml error: Cannot get project commit ids from manifest error: Update of revsionId from superproject has failed. Please resync with --no-use-superproject option ... Checking out: 100% (1022/1022), done in 3.589s repo sync has finished successfully. + Test for missing commit_id for a project. $ repo_dev sync -j40 --use-superproject NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` .../android/aosp/.repo/exp-superproject/925043f706ba64db713e9bf3b55987e2-superproject.git: Initial setup for superproject completed. error: please file a bug using go/repo-bug to report missing commit_ids for: ['build/blueprint'] error: Update of revsionId from superproject has failed. Please resync with --no-use-superproject option ... Checking out: 100% (1022/1022), done in 3.364s repo sync has finished successfully. $ ./run_tests -v ... ...== 164 passed in 2.87s ==... Bug: [google internal] b/189371541 Change-Id: I5ea49f87e8fa41be590fc0c914573e16c8cdfcfa Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309162 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* repo: improve duplicate default checkJack Neus2021-06-151-1/+2
| | | | | | | | | | | | If one default is totally empty, we don't need to fail. BUG=b:187795796 TEST=unit tests Change-Id: Id226a7a7cd183dbdee58f4681b84885cc9211375 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309102 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Jack Neus <jackneus@google.com>
* commands: pass settings via __init__Mike Frysinger2021-06-153-18/+24
| | | | | | | | | | Instead of setting properties on the instantiated command, pass them via the constructor like normal objects. Change-Id: I8787499bd2be68565875ffe243c3cf2024b36ae7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309324 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* commands: document the "event_log" class attributeMike Frysinger2021-06-151-1/+6
| | | | | | | | | | Add some notes explaining why it's instantiated at the Command class level and not individual objects. Change-Id: Ib8081bb8480e85f6d3dfc23953c6bbc6ecc64934 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309323 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* commands: document the "common" class attributeMike Frysinger2021-06-1528-29/+33
| | | | | | | | | | Switch it to uppercase to make it clear it's a constant, and add documentation so its usage is clear. Change-Id: I6d281a66a90b5908b3131585c9945e88cfe815ea Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309322 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo: properly handle NoneType in Default/Remote equality checksJack Neus2021-06-112-0/+41
| | | | | | | | | | BUG=none TEST=none Change-Id: I4ccdbbc7ba4b6f6e20c6959db1b46fdb44ea2819 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308982 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Jack Neus <jackneus@google.com>
* superproject: add projects from local manifest to local::<filename> group.Raman Tenneti2021-06-104-5/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With repo sync --use-superproject, don't update the commit ids of every project that comes from local manifest. Tested the code with the following commands. $ ./run_tests -v + Test with local.xml 1. repo init --use-superproject -u persistent-https://googleplex-android.git.corp.google.com/a/platform/manifest 2. cd .repo cp -r /google/src/head/depot/google3/wireless/android/build_tools/translations/pipeline/local_manifests local_manifests cd .. local$ time repo_dev sync --use-superproject NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` .../local/.repo/exp-superproject/feb2c2847da5e274f3d530d5ab438af8-superproject.git: Initial setup for superproject completed. ... Bug: [google internal] b/189360443 Bug: [google internal] b/189139268 Bug: https://crbug.com/gerrit/14499 Change-Id: Ideaf268c294e9b500b2b9726ffbd733dd8d63004 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308822 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* trace2_event_log: Added logging of error events.Raman Tenneti2021-06-092-0/+31
| | | | | | | | | | | | | | | Added error event in preperation for superproject to log errors. Testing: + Unit tests ./run_tests -v Bug: [google internal] b/189371541 Change-Id: Ife1dd28d52d9e9925b7b34ae913f8eb5fa19037c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308863 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* superproject: revert not updating commit ids if remote is different.Raman Tenneti2021-06-082-55/+0
| | | | | | | | | | | | | | superproject supports multiple remotes. Get all commit ids from superproject for all projects that are in the manifest. $ ./run_tests -v Bug: [google internal] b/186395810 Change-Id: I6edce3918853a7a3a65aec5528e6a43a544eff53 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308862 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* run_tests: fix pytest selection inside tox venvMike Frysinger2021-06-031-0/+4
| | | | | | | | | | | | | Finding the "right" pytest is challenging. In Debian, `pytest` is Python 2 while `pytest-3` is the Python 3 version ... but only when outside of a virtualenv. Inside of a virtualenv (e.g. the ones that tox creates), we always want `pytest`. Change-Id: Ic1fe84c10f06227bceeb9baad6a3c4598bbe9860 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303802 Reviewed-by: Peter Kjellerstedt <peter.kjellerstedt@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* superproject: change the warning message to say it is beta.Raman Tenneti2021-06-031-2/+2
| | | | | | | | | | | | | | | $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest remote: Total 3 (delta 0), reused 3 (delta 0) NOTICE: --use-superproject is in beta; report any issues to the address described in `repo version` ... $ ./run_tests -v Bug: [google internal] b/189946009 Change-Id: Ifb3ef266a72b67f3c4a2a3ac2033b10e03b789d4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308522 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* Drop support for Python 3.5Peter Kjellerstedt2021-06-035-7/+6
| | | | | | | | | | | | | | | | | | | Running repo with Python 3.5 fails due to the use of the encoding parameter to subprocess.run(). There are also f-strings being used in some of the tests. This drops support for these systems: * Ubuntu Xenial: released Apr 2016, EOS Apr 2021, EOL Apr 2024 * Debian Stretch: released Jun 2017, EOL Jun 2022 So the minimum required distros now are: * Ubuntu Bionic: released Apr 2018 w/Python 3.6 * Debian Buster: released Jul 2019 w/Python 3.7 Change-Id: I1144f7ab6f882b10cac0131982df081fe4ac44f9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303363 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
* superproject: require git version 2.28.0 or higher.v2.15.4Raman Tenneti2021-06-031-1/+4
| | | | | | | | | | | | | | | | | | | | | Tested the code with the following commands. $ repo init --use-superproject -u https://android.googlesource.com/platform/manifest + Tested for the wrong git version. $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest WARNING: --use-superproject is experimental and not for general use superproject requires a git version 2.28 or later error: git update of superproject failed $ ./run_tests -v Bug: https://crbug.com/gerrit/14617 Bug: [google internal] b/189846687 Change-Id: I5cd4158ea29b3b3c8c81234f4e818165de346e63 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308442 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* tests: Make the tests pass for Python < 3.8Peter Kjellerstedt2021-05-262-28/+55
| | | | | | | | | | | | | | Before Python 3.8, xml.dom.minidom sorted the attributes of an element when writing it to a file, while later versions output the attributes in the order they were created. Avoid these differences by sorting the attributes for each element before comparing the generated manifests with the expected ones. Bug: https://crbug.com/gerrit/14382 Change-Id: Ie2597727afcc48f9063a7261ad970e8a549f0587 Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303326 Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: Sync submodules correctly againv2.15.3Peter Kjellerstedt2021-05-201-3/+9
| | | | | | | | | | | | | Commit b4429439 (sync: refactor main fetch loop) broke syncing of submodules with sync-s="true". The first `repo sync` would just fetch the superrepo, while the second `repo sync` would fetch the submodules. This was due to the new _FetchMain() function not passing back the all_projects variable that it had modified. Change-Id: Ie8187cde7bb894e4e9a6b76c2aed83873d9f69a4 Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/307065 Reviewed-by: Mike Frysinger <vapier@google.com>
* project: fix error display when output_redir is disabledv2.15.2Mike Frysinger2021-05-201-4/+5
| | | | | | | | | | | | | We always pass in output_redir when syncing, but that's the common case: there are a few situations (like `repo init`) where we don't pass in a buffer, and if any errors show up in that case, we'd crash. Rely on the print function to handle this logic for us. Bug: https://crbug.com/gerrit/14568 Change-Id: I8cd47e82329797ffc42534418a3dfbd8429205be Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/307222 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>