summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* superproject: Use bugurl from contactinfo in the missing commits error message.v2.15.1Raman Tenneti2021-05-183-7/+12
| | | | | | | | | | | | | | | | | | + In XmlManifest._Unload set 'bugurl' to Wrapper().BUG_URL. + contactinfo returns a namedtuple. + bug_url can be accessed as self._manifest.contactinfo.bugurl. Tested the code with the following commands. $ ./run_tests -v Added contactinfo tag to default.xml and verified that bugurl is used. Bug: [google internal] b/186220520. Change-Id: Iaafd6465e072b2e47a0a0b548bf6cb608a0b0a04 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/306342 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* ssh: rewrite proxy management for multiprocessing usagev2.15Mike Frysinger2021-05-106-158/+225
| | | | | | | | | | | | | | | | We changed sync to use multiprocessing for parallel work. This broke the ssh proxy code as it's all based on threads. Rewrite the logic to be multiprocessing safe. Now instead of the module acting as a stateful object, callers have to instantiate a new ProxyManager class that holds all the state, an pass that down to any users. Bug: https://crbug.com/gerrit/12389 Change-Id: I4b1af116f7306b91e825d3c56fb4274c9b033562 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305486 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
* ssh: move proxy usage to the sync subcommandMike Frysinger2021-05-104-22/+32
| | | | | | | | | | | | | | | | | | | | | | | | The only time we really need ssh proxies is when we want to run many connections and reuse them. That only happens when running sync. Every other command makes at most two connections, and even then it's only one or none. So the effort of setting up & tearing down ssh proxies isn't worth it most of the time. The big reason we want to move this logic to sync is that it's now using multiprocessing for parallel work. The current ssh proxy code is all based on threads, which means none of the logic is working correctly. The current ssh design makes it hard to fix when all of the state lives in the global/module scope. So the first step to fixing this is top move the setup & teardown to the one place that really needs it: sync. No other commands will use proxies anymore, just direct connections. Bug: https://crbug.com/gerrit/12389 Change-Id: Ibd351acdec39a87562b3013637c5df4ea34e03c6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305485 Reviewed-by: Chris Mcdonald <cjmcdonald@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* launcher: bump version for new releaseMike Frysinger2021-05-101-1/+1
| | | | | | | Change-Id: I1f204bb1e5ce6b13c623215236deef01efbc0f6c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305822 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Handle 400 error code when attempting to fetch clone bundle.Craig Northway2021-05-101-6/+5
| | | | | | | | | | | | Gitlab returns a 400 error when trying to fetch clone.bundle from a repository containing the git-repo tool. The repo launcher doesn't then fall back to not using a clone.bundle file and the repo init fails. Change-Id: Ia3390d0638ef9a39fb2fab84625b269d28caf1cc Signed-off-by: Craig Northway <cnorthway@codeaurora.org> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305382 Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: added --no-use-superproject to disable superproject.Raman Tenneti2021-05-081-3/+7
| | | | | | | | | | | | | | | | | | | Tested the code with the following commands. $ ./run_tests -v $ repo_dev sync -c -j8 --no-use-superproject Fetching: 100% (1041/1041), done in 1m22.743s $ repo_dev sync -c -j8 --use-superproject WARNING: --use-superproject is experimental and not for general use .. Bug: [google internal] b/187459275 Change-Id: I3f4269df38cd24a21723e8b2be5a1f013e7b5a91 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305682 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: Recommend using --no-use-superproject if sync fails.Raman Tenneti2021-05-071-1/+2
| | | | | | | | | | | | | | | | | | If superproject was not available for a branch, then the next repo sync would also fail because --use-superproject is remembered across repo init. In such cases, hoping the hint to to use --no-use-superproject will help. Tested the code with the following commands and by forcing a failure. $ ./run_tests -v Bug: [google internal] b/187459275 Change-Id: Ie250812b7ba83afc230b5b1d154ba11f245f8b8a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305622 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* sync: refactor main fetch loopMike Frysinger2021-05-061-42/+59
| | | | | | | | | | | | This is a large chunk of code that is largely isolated. Move it into a class method to make it easier to manage & reason about, and in a follow up CL, easier to scope. Bug: https://crbug.com/gerrit/12389 Change-Id: I0c69d95a9e03478d347b761580b2343bffa012d5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305484 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
* ssh: move all ssh logic to a common placeMike Frysinger2021-05-066-275/+320
| | | | | | | | | | | | We had ssh logic sprinkled between two git modules, and neither was quite the right home for it. This largely moves the logic as-is to its new home. We'll leave major refactoring to followup commits. Bug: https://crbug.com/gerrit/12389 Change-Id: I300a8f7dba74f2bd132232a5eb1e856a8490e0e9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305483 Reviewed-by: Chris Mcdonald <cjmcdonald@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* git_command: switch version caches to functoolsMike Frysinger2021-05-062-21/+20
| | | | | | | | | Simplifies the code a bit to use the stdlib cache helper. Change-Id: I778e90100ce748a71cc3a5a5d67dda403334315e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305482 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* manifest_xml: cleanup of contactinfo test for readability with f-strings.Raman Tenneti2021-05-051-1/+3
| | | | | | | | | | | | Tested the code with the following commands. $ ./run_tests -v Bug: [google internal] b/186220520. Change-Id: I1c0f8958ff4c615707eec218250e8de753ec6562 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305282 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* sync: fix recursive fetchingMike Frysinger2021-05-051-1/+1
| | | | | | | | | | | | | Commit b2fa30a2b891b22c173c960a67bf38ccbba8de1b ("sync: switch network fetch to multiprocessing") accidentally changed the variable passed to the 2nd fetch call from |missing| to |to_fetch| due to a copy & paste of the earlier changed logic. Undo that to fix git submodule fetching. Bug: https://crbug.com/gerrit/14489 Change-Id: I627954f80fd2e80d9d5809b530aa6b0ef9260abb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305262 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* git_config: hoist Windows ssh check earlierMike Frysinger2021-05-041-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The ssh master logic has never worked under Windows which is why this code always returned False when running there (including cygwin). But the OS check was still done while holding the threading lock. While it might be a little slower than necessary, it still worked. The switch from the threading module to the multiprocessing module changed global behavior subtly under Windows and broke things: the globals previously would stay valid, but now they get cleared. So the lock is reset to None in children workers. We could tweak the logic to pass the lock through, but there isn't much point when the rest of the code is still disabled in Windows. So perform the platform check before we grab the lock. This fixes the crash, and probably speeds things up a few nanoseconds. This shouldn't be a problem on Linux systems as the platform fork will duplicate the existing process memory (including globals). Bug: https://crbug.com/gerrit/14480 Change-Id: I1d1da82c6d7bd6b8cdc1f03f640a520ecd047063 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305149 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* manifest_xml: initial support for <contactinfo>Raman Tenneti2021-05-043-23/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | It will be used to let manifest authors self-register contact info. This element can be repeated, and any later entries will clobber earlier ones. This would allow manifest authors who extend manifests to specify their own contact info. It would have 1 required attribute: bugurl. "bugurl" specifies the URL to file a bug against the manifest owner. <contactinfo bugurl="bug-url"/> TODO: This CL only implements the parsing logic and further work will be in followup CLs. Tested the code with the following commands. $ ./run_tests tests/test_manifest_xml.py $ ./run_tests -v Bug: [google internal] b/186220520. Change-Id: I47e765ba2dab5cdf850191129f4d4cd6b803f451 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305203 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: use manifest_name passed inMike Frysinger2021-05-041-1/+1
| | | | | | | | | | | | | | Commit fb527e3f522a9f6ae05ee1fd707fb0b45c9190f2 ("sync: create dedicated manifest project update func") refactored code from the main body into a dedicated method. The manifest_name was passed as an argument, but never used it, and instead reaches back out to the command line options. This ignores the logic in the main loop where manifest_name might have changed (like when using smart sync). Change-Id: I4b84638fbb10c2b6f8f4b555e1475b0669c2daf4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305148 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: switch to multiprocessing.EventMike Frysinger2021-05-041-1/+1
| | | | | | | | | | | We've switched most of this command over to multiprocessing and off of _threading, so do the Event object too. The APIs are the same between the modules, so we shouldn't need to update anything else. Change-Id: I52d31f1c6ef2bcbe7bbc1dd1add79a8d5d08784a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305147 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: fix logic error with linkfile errorsMike Frysinger2021-05-041-2/+2
| | | | | | | | | | Make sure err_update_linkfiles is always initalized. Bug: https://crbug.com/gerrit/11008 Change-Id: I7bdd91f82507608ef967daf0fa0f9c859454e19f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305146 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* release-process: document the rate limiting in automatic updatesMike Frysinger2021-05-041-1/+7
| | | | | | | | | We check for updates only once per day, so clarify the docs. Change-Id: Ib669ca6ebc67bc13204996fa40e1a3a82012295e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305145 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* subcmds: force consistent help text formatMike Frysinger2021-05-0412-60/+91
| | | | | | | | | | | | We're inconsistent with help text as to whether it uses title case and whether it ends in a period. Add a test to enforce a standard, and use the style that Python optparse & argparse use themselves (e.g. with the --help option): always lowercase, and never trailing period. Change-Id: Ic1defae23daeac0ac9116aaf487427f50b34050d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305144 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: fix print error when handling server errorMike Frysinger2021-05-041-1/+1
| | | | | | | | | | | When converting this logic from print() to the output buffer, this error codepath should have dropped the use of the file= redirect. Bug: https://crbug.com/gerrit/14482 Change-Id: Ib484924a2031ba3295c1c1a5b9a2d816b9912279 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305142 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* superproject: skip updating commit ids if remote's fetchUrl don't match.Raman Tenneti2021-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | Tested the code with the following commands. $ ./run_tests -v + Test with local.xml $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b master --use-superproject --partial-clone --clone-filter=blob:limit=10M && mkdir -p .repo/local_manifests && (gcertstatus -quiet=true || gcert) && ln -s /google/src/head/depot/google3/wireless/android/build_tools/aosp/manifests/mirror-aosp-master-with-vendor/local.xml .repo/local_manifests/local.xml $ repo_dev sync -c -j8 + Test without local.xml $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b master --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject $ repo_dev sync -c -j8 Bug: [google internal] b/186395810 Change-Id: Id618113a91c12bcb90a30a3c23d3d6842bcb49e1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304942 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* init/sync: add --no-tags to match --tagsMike Frysinger2021-05-043-5/+11
| | | | | | | | | | | | | While this provides a way to undo earlier command line options (e.g. `repo sync --tags --no-tags`) which can be helpful for scripting & automation, this more importantly allows the user to override the manifest settings for syncing tags from a project. Bug: https://crbug.com/gerrit/12401 Change-Id: Id4c36cd82e6ca7cb073b5d63a09f6c7ccdebba83 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304904 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* add --no-current-branch option to invert --current-branchMike Frysinger2021-05-046-2/+17
| | | | | | | | | | | | | | | | | For most commands, this is more about providing a way to undo earlier command line options (e.g. `repo info -c --no-current-branch`) which can be helpful for scripting & automation. But for the sync command, this is helpful to undo the setting that exists in the manifest itself. With this in place, tweak the sync current_branch_only logic to only apply the manifest settings when the user hasn't specified a command line option. Bug: https://crbug.com/gerrit/12401 Change-Id: I21e2384624680cc740d1b5d1e49c50589d2fe6a0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304903 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* harmonize --current-branch short option across subcommandsMike Frysinger2021-05-033-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | We're inconsistent with the short option for this flag: * gitc-init: <none as -c is already used> * info: -b * init: -c * overview: -b * sync: -c * upload: --cbr Since info & overview are not as heavily used as the others, switch them from -b to -c. We leave -b in as a hidden alias for now. Similarly, switch upload from --cbr to just -c. A lot of people use --cbr, so we leave this as a hidden alias for now too. Ideally gitc-init wouldn't use -c, but that ship has sailed, and we're more likely to deprecate gitc entirely at this point. This provides a consistent set of options across subcommands. Bug: https://crbug.com/gerrit/12401 Change-Id: Iec249729223866fe1ea0ebabed12ca851cc38b35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304902 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* superproject: Don't update the commit ids of projects if remote is different.Raman Tenneti2021-05-034-19/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Skip setting the revision id (commit id) for the projects whose remote doesn't match superproject's remote. 2) exp-superproject/superproject_override.xml includes local_manfiest's projects. When we load this XML, don't reload projects from local.xml (otherwise we will get duplicate projects errors). Tested the code with the following commands. $ ./run_tests -v + Test with local.xml $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b master --use-superproject --partial-clone --clone-filter=blob:limit=10M && mkdir -p .repo/local_manifests && (gcertstatus -quiet=true || gcert) && ln -s /google/src/head/depot/google3/wireless/android/build_tools/aosp/manifests/mirror-aosp-master-with-vendor/local.xml .repo/local_manifests/local.xml $ repo_dev sync -c -j8 + Test without local.xml $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b master --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject $ repo_dev sync -c -j8 Bug: [google internal] b/186395810 Change-Id: I4e9d4ac2d94a9fc0cef0ccd787b6310758009e86 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304882 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* upload: search local projects in parallelMike Frysinger2021-05-021-31/+37
| | | | | | | | | | | | | Search for project branches to upload in parallel. This can cut the lookup time in half for large projects. We still run the actual hooks in serial once we have the list of projects to process, but we would need to rethink things quite a bit before we could handle running them in parallel too. Change-Id: I8da0cbc5010566aa860e1a158f3dc07f0709dcff Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304842 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* project: fix m/ generation when switching manifest branchesMike Frysinger2021-05-021-8/+8
| | | | | | | | | | | | | We were updating the per-checkout m/ pseudo ref when syncing, but we only created the common m/ redirect when initializing a project for the first time. This is fine unless the user switches the manifest branch in an existing project, then we never create that redirect. Bug: https://crbug.com/gerrit/14468 Change-Id: I5325e7e602dcb4ce150bef258901ba5e9fdea461 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304822 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* upload: include the project in error messagesMike Frysinger2021-05-021-2/+2
| | | | | | | | | | | When running upload across multiple projects, include the project in any error messages that come up. This lets users figure out where the problem might be. Change-Id: I09470c9a1b512baf910d6d97b747816d1a6f3a87 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304783 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Update copyfile and linkfile if manifest updatedjiajia tang2021-05-012-0/+66
| | | | | | | | | | | | | | | | | | | | | Currently, copyfiles and linkfiles which marked by "<copyfile/>" and "<linkfile/>" in manifest will be created by first exec 'repo sync'. But if some "<copyfile/>" or "<linkfile/>" are removed in manifest, then 'repo sync', these removed item dest can not be removed in the sourcecode workspace. This patch is intent to fix this issue, by save a 'copy-link-files.json' in .repo and then compared with new dest path when next sync. If any "<copyfile/>" or "<linkfile/>" were removed, the dest path will be removed in sourcecode at the same time. Bug: https://crbug.com/gerrit/11008 Change-Id: I6b7b41e94df0f9e6e52801ec755951a4c572d05d Signed-off-by: jiajia tang <tangjiajia@xiaomi.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304202 Reviewed-by: Mike Frysinger <vapier@google.com>
* manifest_xml: ban use of newlines in pathsMike Frysinger2021-04-302-1/+26
| | | | | | | | | | | | There should be no valid use of these anywhere, so just ban them to make things easier for people. Bug: https://crbug.com/gerrit/14156 Bug: https://crbug.com/gerrit/14200 Change-Id: I8d2cf988c510c98194c43a329a2b9bf313a3f0a8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304662 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: Fix a corner case when both superproject and depth used.Xin Li2021-04-291-0/+5
| | | | | | | | | | | | | | | | When depth is used, we would fetch only SHA1 when superproject is used, as the result, only the manifest branch is being recorded, and commands like repo start would fail. Fix this by saving the upstream branch value in the overlay manifest and add the upstream branch to fetch list. Bug: [google internal] b/185951360 Change-Id: Ib36f56067723f2572ed817785b31cc928ddfec0a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304562 Reviewed-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Xin Li <delphij@google.com>
* help/version: sprinkle bug report URL aroundMike Frysinger2021-04-265-6/+10
| | | | | | | | | Make it a bit easier for people to locate bug reporting info. Change-Id: If9c8939c84ebd52eb96b353c1797afa25868bb85 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303943 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com>
* sync: Fix exception in an exsiting clone (without partial-clone).v2.14.2Raman Tenneti2021-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default the partial_clone_exclude argument to an empty set. Fixes the following report by Emil Medve. With this change (up to v2.14.1), on an existing "normal" clone (without partial-clone options) I'm seeing this traceback during `repo selfupdate`: Traceback (most recent call last): File ".../.repo/repo/main.py", line 630, in <module> _Main(sys.argv[1:]) File ".../.repo/repo/main.py", line 604, in _Main result = run() File ".../.repo/repo/main.py", line 597, in <lambda> run = lambda: repo._Run(name, gopts, argv) or 0 File ".../.repo/repo/main.py", line 261, in _Run result = cmd.Execute(copts, cargs) File ".../.repo/repo/subcmds/selfupdate.py", line 54, in Execute if not rp.Sync_NetworkHalf(): File ".../.repo/repo/project.py", line 1091, in Sync_NetworkHalf if self.name in partial_clone_exclude: TypeError: argument of type 'NoneType' is not iterable $ ./run_tests -v Change-Id: I71e744e4ef2a37b13aa9ba42eba3935e78c4e40a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/304082 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* sync: fix missing import for -qv2.14.1Mike Frysinger2021-04-211-1/+1
| | | | | | | | | | Some refactors during review dropped this import when it was reworked, but it's still needed when using the --quiet setting. Change-Id: I6d9302ef5a056e52415ea63f35bad592b9dfa75d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303942 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: restore default --manifest-nameMike Frysinger2021-04-211-1/+1
| | | | | | | | | | | | | The merge of the repo & init parser missed this default. When running `repo init ...` in an existing checkout but w/out the -m option, then repo would error out complaining that -m is required when it didn't do this before. Change-Id: I58035d48cc413b5d373702b9dc3b9ecd3fd1e900 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303945 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* sync: cleanup sleep+retry logic a bitv2.14Mike Frysinger2021-04-191-14/+18
| | | | | | | | | | | | | | | | | | | Make sure we print a message whenever we retry so it's clear to the user why repo is pausing for a long time, and why repo might have passed even though it displayed some errors earlier. Also unify the sleep logic so we don't have two independent methods. This makes it easier to reason about. Also don't sleep if we're in the last iteration of the for loop. It doesn't make sense to and needlessly slows things down when there are real errors. Bug: https://crbug.com/gerrit/12494 Change-Id: Ifceace5b2dde75c2dac39ea5388527dd37376336 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303402 Reviewed-by: Sam Saccone 🐐 <samccone@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: only print error.GitError, don't raise that exception.Raman Tenneti2021-04-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* command: add a helper for the parallel execution boilerplateMike Frysinger2021-04-1510-143/+145
| | | | | | | | | | | Now that we have a bunch of subcommands doing parallel execution, a common pattern arises that we can factor out for most of them. We leave forall alone as it's a bit too complicated atm to cut over. Change-Id: I3617a4f7c66142bcd1ab030cb4cca698a65010ac Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/301942 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
* tests: Make ReviewableBranchTests.test_smoke work with git < 2.28.0Peter Kjellerstedt2021-04-141-1/+1
| | | | | | | | Bug: https://crbug.com/gerrit/14380 Change-Id: Id015bd98b008e1530ada2c7e4332c67e8e208e25 Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303325 Reviewed-by: Mike Frysinger <vapier@google.com>
* list: fix help grammarMike Frysinger2021-04-141-3/+3
| | | | | | | Change-Id: Ia642e38532173d59868e0101cc098eab706d715e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303302 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* help: switch from formatter module to textwrapMike Frysinger2021-04-142-8/+14
| | | | | | | | | | | | | | | | Since Python has deprecated the formatter module, switch to the textwrap module instead for reflowing text. We weren't really using any other feature anyways. Verified by diffing the output before & after the change and making sure it was the same. Then made a few tweaks to tighten up the output. Change-Id: I0be1bc2a6661a311b1a4693c80d0f8366320ba55 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303282 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* list: add option to show non-checkedout projects tooMike Frysinger2021-04-131-3/+12
| | | | | | | | | | | | | Currently, list only shows projects that exist in the checkout, and doesn't offer any way to list all projects in the manifest (based on the current settings, or on the options passed to list). This seems to be the opposite of what (at least some) users expect, so let's add an option to show all of them regardless of checkout state. Change-Id: I94bbdc5bd0ff2a411704fa215e7fc2b60fa3360e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/301263 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* progress: hide progress bar when --quietMike Frysinger2021-04-135-8/+16
| | | | | | | | | | | | We want progress bars in the default output mode, but not when the user specifies --quiet. Add a setting to the Progress bar class so it takes care of not displaying anything itself rather than having to update every subcommand to conditionally setup & call the object. Change-Id: I1134993bffc5437bc22e26be11a512125f10597f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303225 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* command: make --verbose/--quiet available to all subcommandsMike Frysinger2021-04-1314-40/+41
| | | | | | | | | | | Add new CommonOptions entry points to move the existing --jobs to, and relocate all --verbose/--quiet options to that. This provides both a consistent interface for users as well as for code. Change-Id: Ifaf83b88872421f4749b073c472b4a67ca6c0437 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303224 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: Added --partial-clone-exclude option.Raman Tenneti2021-04-136-21/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partial-clone-exclude option excludes projects during partial clone. This is a comma-delimited project names (from manifest.xml). This option is persisted and it is used by the sync command. A project that has been unparital'ed will remain unpartial if that project's name is specified in the --partial-clone-exclude option. The project name should match exactly. Added $ ./run_tests -v Bug: [google internal] b/175712967 "I can't "unpartial" my androidx-main checkout" $ rm -rf androidx-main/ $ mkdir androidx-main/ $ cd androidx-main/ $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M -m default.xml $ repo_dev sync -c -j8 + Verify a project is partial $ cd frameworks/support/ $ git config -l | grep 'partial' + Unpartial a project. $ /google/bin/releases/android/git_repack/git_unpartial + Verify project is unpartial $ git config -l | grep 'partial' $ cd ../.. + Exclude the project from being unparial'ed after init and sync. $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --partial-clone-exclude="platform/frameworks/support,platform/frameworks/support-golden" -m default.xml + Verify project is unpartial $ cd frameworks/support/ $ git config -l | grep 'partial' $ cd ../.. $ repo_dev sync -c -j8 $ cd frameworks/support/ $ git config -l | grep 'partial' $ cd ../.. + Remove the project from exclude list and verify that project is partially cloned. $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --partial-clone-exclude= -m default.xml $ repo_dev sync -c -j8 $ cd frameworks/support/ $ git config -l | grep 'partial' Change-Id: Id5dba418eba1d3f54b54e826000406534c0ec196 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303162 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* sync: add separate --jobs options for different stepsMike Frysinger2021-04-091-4/+11
| | | | | | | | | | | | | | | The number of jobs one wants to run against the network tends to factor differently from the number of jobs one wants to run when checking out local projects. The former is constrained by your internet connection & server limits while the later is constrained by your local computer's CPU & storage I/O. People with beefier computers probably want to keep the network/server jobs bounded a bit lower than the local/checkout jobs. Change-Id: Ia27ab682c62c09d244a8a1427b1c65acf0116c1c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302804 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: organize command line options a bitMike Frysinger2021-04-091-18/+28
| | | | | | | | | | We've grown a lot of options in here and it's hard to make sense of them. Add more groups to try and make it easier to pick things out. Change-Id: I6b9dc0e83f96137f974baf82d3fb86992b857bd2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302803 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: add progress bar to garbage collection phaseMike Frysinger2021-04-091-6/+14
| | | | | | | | | | This can take a few seconds, if not a lot more, so add a progress bar so users understand what's going on. Change-Id: I5b4b54c1bbb9ec18728f979521310f7087afaa5c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302802 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>