summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
Commit message (Collapse)AuthorAgeFilesLines
* init: add --manifest-upstream-branchKaushik Lingarkar2024-09-261-0/+11
| | | | | | | | | | | | | | | When a sha1 is provided to '--manifest-branch', the ref which is expected to contain that sha1 can be provided using the new '--manifest-upstream-branch' option. This is useful with '--current-branch' to avoid having to sync all heads and tags, or with a commit that comes from a non-head/tag ref (like a Gerrit change ref). Change-Id: I46a3e255ca69ed9e809039e58b0c163e02af94ef Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/436717 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Commit-Queue: Kaushik Lingarkar <kaushik.lingarkar@linaro.org> Tested-by: Kaushik Lingarkar <kaushik.lingarkar@linaro.org>
* git_command: unify soft/hard versions with requirements.jsonMike Frysinger2024-03-211-6/+8
| | | | | | | | | | | Use the requirements logic in the wrapper to load versions out of the requirements.json file to avoid duplicating them in git_command.py. Change-Id: Ib479049fc54ebc6f52c2c30d1315cf1734ff1990 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/415617 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Commit-Queue: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo: Use the worktree when checking the repo rev.Jason R. Coombs2023-11-131-1/+1
| | | | | | | | | | | | | Avoids treating the operation as if it were acting on a bare repository, thereby triggering failures when the Git client is configured with `safe.bareRepository=explicit`. Repo doesn't actually use a bare repository, but pointing at the gitdir acts as if it had. Bug: 307559774 Change-Id: I2c142275b2726a59526729c0b2c54faf728f125d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/391554 Commit-Queue: Jason R. Coombs <jaraco@google.com> Tested-by: Jason R. Coombs <jaraco@google.com> Tested-by: Emily Shaffer <emilyshaffer@google.com> Reviewed-by: Emily Shaffer <emilyshaffer@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* cleanup: Update codebase to expect Python 3.6Jason R. Coombs2023-10-311-1/+1
| | | | | | | | | | | - Bump minimum version to Python 3.6. - Use f-strings in a lot of places. Change-Id: I2aa70197230fcec2eff8e7c8eb754f20c08075bb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389034 Tested-by: Jason R. Coombs <jaraco@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Jason R. Coombs <jaraco@google.com>
* subcmds: Use repo loggerAravind Vasudevan2023-09-141-9/+9
| | | | | | | | | Bug: b/292704435 Change-Id: Ia3a45d87fc0bf0d4a1ba53050d9c3cd2dba20e55 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386236 Reviewed-by: Jason Chang <jasonnc@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com>
* isort: format codebasev2.36Mike Frysinger2023-08-221-4/+8
| | | | | | | | Change-Id: I6f11d123b68fd077f558d3c21349c55c5f251019 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383715 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* gitc: drop supportJason Chang2023-08-151-2/+2
| | | | | | | | | Bug: b/282775958 Change-Id: Ib6383d6fd82a017d0a6670d6558a905d41be321f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/375314 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Jason Chang <jasonnc@google.com> Commit-Queue: Jason Chang <jasonnc@google.com>
* Raise repo exit errors in place of sys.exitJason Chang2023-08-071-3/+9
| | | | | | | | | Bug: b/293344017 Change-Id: I92d81c78eba8ff31b5252415f4c9a515a6c76411 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/381774 Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Joanna Wang <jojwang@google.com> Commit-Queue: Jason Chang <jasonnc@google.com>
* Add envar to replace shallow clones with partialJason Chang2023-05-251-0/+6
| | | | | | | | | | | | | | | | An investigation go/git-repo-shallow shows a number of problems when doing a shallow git fetch/clone. This change introduces an environment variable REPO_ALLOW_SHALLOW. When this environment variable is set to 1 during a repo init or repo sync all shallow git fetch commands are replaced with partial fetch commands. Any shallow repository needing update is unshallowed. This behavior continues until a subsequent repo sync command is run with REPO_ALLOW_SHALLOW set to 1. Bug: b/274340522 Change-Id: I1c3188270629359e52449788897d9d4988ebf280 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/374754 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Tested-by: Jason Chang <jasonnc@google.com>
* [git_trace2] Add logs for critical cmdsJosip Sokcevic2023-05-171-1/+3
| | | | | | | | | | | | Trace logs emitted from repo are not useful on error for many critical commands. This change adds errors for critical commands to trace logs. Change-Id: Ideb9358bee31e540bd84a94327a09ff9b0246a77 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/373814 Reviewed-by: Joanna Wang <jojwang@google.com> Tested-by: Josip Sokcevic <sokcevic@google.com> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* Format codebase with black and check formatting in CQGavin Mak2023-03-221-242/+302
| | | | | | | | | | | | Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* init: Silence the "rm -r .repo and try again" message if quietGavin Mak2023-01-061-6/+5
| | | | | | | | Bug: b/258532367 Change-Id: I53a23aa0b237b0bb5f7e58464936f8c9b0db1311 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/355915 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* Use print with flush=True instead of stdout.flushDaniel Kutik2022-12-131-9/+3
| | | | | | | | | | | Resolves multiple TODOs. Since we are requiring Python 3, we move to using print function with flush=True instead of using sys.stdout.flush(). Change-Id: I54db0344ec78ac81a8d6c6c7e43ee7d301f42f02 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354701 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* pylint: remove unused importsDaniel Kutik2022-12-131-6/+0
| | | | | | | | | Removed unused imports accross multiple files. Change-Id: Ib5ae4cebf9660e7339b11e3fa592d99f8d51e8d8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354700 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* init: add --manifest-depth for shallow manifest clonev2.29.5LaMont Jones2022-10-271-0/+4
| | | | | | | | | | | | | | | | | | | People rarely care about the history of the manifest repo. Add a parameter to specify depth for the manifest. For now, make the default behavior the same as the current behavior. At a future date, the default will be changed to 1. People who need the full history should begin passing --manifest-depth=0 to preserve the behavior when the default changes. We can't reuse the existing --depth option because that applies to all projects we clone, not just the manifest repo. Bug: https://crbug.com/gerrit/16193, https://crbug.com/gerrit/16358 Change-Id: I9130fed3eaed656435c778a85cfe9d04e3a4a6a0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349814 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Xin Li <delphij@google.com>
* Revert "init: change --depth default to 1 for manifest repo"LaMont Jones2022-10-271-4/+0
| | | | | | | | | | | | This reverts commit 076d54652e0025e1360f66e483926477b910b02e. Reason for revert: crbug.com/gerrit/16358 Change-Id: I2970eb50677cca69786f71edffe4aa5271cf139f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349834 Reviewed-by: Sam Saccone <samccone@google.com> Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Xin Li <delphij@google.com>
* init: hide identify spam when reinitializingMike Frysinger2022-08-221-3/+3
| | | | | | | | | | We don't want to keep showing the user config notice when reinitializing existing checkouts, so hide it. Change-Id: Id40610bd683396cbff7e1aefc092c8b77c397783 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343536 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: LaMont Jones <lamontjones@google.com>
* init: show a notice when reinitializingMike Frysinger2022-08-221-0/+7
| | | | | | | | | | | Make it clear to users when we're reinitializing an existing checkout in case they weren't expecting it. Bug: https://crbug.com/gerrit/12396 Change-Id: I22e89ae041a8e7b147c9d06a82f1302dd5807ae0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343535 Reviewed-by: LaMont Jones <lamontjones@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: change --depth default to 1 for manifest repoMike Frysinger2022-08-181-0/+4
| | | | | | | | | | | | | | | People rarely care about the history of the manifest repo. Change the default to 1 to speed up initial setup. If people really want the full history, they can pass --manifest-depth=0. We can't reuse the existing --depth option because that applies to all projects we clone, not just the manifest repo. Bug: https://crbug.com/gerrit/16193 Change-Id: Ideab1712e9ffc743b9bae97903e074d7d429b134 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343435 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: LaMont Jones <lamontjones@google.com>
* Fix the printed path of the ".repo" dir after a fresh init.Mateus Azis2022-07-251-1/+1
| | | | | | | | | | | | Apparently, manifest.topdir already contains a trailing slash in some cases, so a simple string concatenation may or not lead to double slashes. It is safer to use os.path.join. See https://screenshot.googleplex.com/6pSY3QewAeCdAqk Change-Id: I2411452296b7e78fc975787b675273a48d6b3d85 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/341574 Reviewed-by: LaMont Jones <lamontjones@google.com> Tested-by: Mateus Azis <azis@google.com>
* sync: add multi-manifest supportv2.26LaMont Jones2022-05-261-3/+2
| | | | | | | | | | | | | With this change, partial syncs (sync with a project list) are again supported. If the updated manifest includes new sub manifests, download them inheriting options from the parent manifestProject. Change-Id: Id952f85df2e26d34e38b251973be26434443ff56 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334819 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
* project: Add missing importsv2.24.1LaMont Jones2022-04-211-2/+0
| | | | | | | | | | | Some imports were missed when moving manifestProject to project.py Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=15861 Change-Id: Id8fffeaa3f88f344a13b5ab44e5403c7edd98f31 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/335554 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com>
* Stop passing optparse.Values to git_superprojectLaMont Jones2022-04-141-0/+3
| | | | | | | | | | | | | | Make git_superproject independent of the command line by passing the specific value instead of requiring the caller to have an optparse.Values object to pass in. Flag --use-superproject and --archive as incompatible in subcmds/init.py Change-Id: Ied7c874b312e151038df903c8af4328f070f387c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/335135 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* manifest_xml: use Superproject to hold XML contentv2.23LaMont Jones2022-04-121-1/+0
| | | | | | | | | | | | | | | Always create Superproject when there is a <superproject> tag, and have it hold the XML content, similar to how other manifest elements are handled. This also adds SetQuiet and SetPrintMessages to Superproject consistent with manifest.SetUseLocalManifests. Change-Id: I522bf3da542006575799f0640c67f7052704f266 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334641 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
* Fix sub manifest handlingLaMont Jones2022-04-061-0/+1
| | | | | | | | | Also fixes some typos Change-Id: Id2ba5834ba3a74ed3f29c36d2c0030737dc63e35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334579 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* init: add multi-manifest supportLaMont Jones2022-04-061-38/+3
| | | | | | | | | This moves more of the manifest project handling into ManifestProject. Change-Id: Iecdafbec18cccdfd8e625753c3bd1bcddf2b227f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334520 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Move manifest config logic into ManifestProjectLaMont Jones2022-04-061-1/+1
| | | | | | | | | Use ManifestProject properties for config values. Change-Id: Ib4ad90b0d9a089916e35615b8058942e6d01dc04 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334519 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* project: add ManifestProject.Sync()LaMont Jones2022-04-011-240/+26
| | | | | | | | | Move the logic to sync a ManifestProject out of subcmds/init.py Change-Id: Ia9d00f3da1dc3c5dada84c4d19cf9802c2346cb0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334140 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Add multi-manifest support with <submanifest> elementv2.22LaMont Jones2022-02-171-0/+12
| | | | | | | | | | | To be addressed in another change: - a partial `repo sync` (with a list of projects/paths to sync) requires `--this-tree-only`. Change-Id: I6c7400bf001540e9d7694fa70934f8f204cb5f57 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/322657 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* init: add an option --enable-git-lfs-filterXD Trol2022-01-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | It was reported that git-lfs did not work with git-repo. Specifically, `git read-tree -u` run by `repo sync` would fail git-lfs's smudge filter. See https://github.com/github/git-lfs/issues/1422. In fact, by the time `git read-tree -u` is run, the repository is not bare. It is just that, the working directory is not the same as the .git directory. git-lfs's filter should work. No one seems to have delved into that issue. Today, with newer versions of git-repo and git-lfs, that issue will not reproduce. Tested with - git 2.33, git-lfs 2.13 on macOS - git 2.17, git-lfs 2.3 on ubuntu So, it seems fine to add an option --enable-git-lfs-filter, default to false, and stat that it may not work with older versions of git and git-lfs in the help doc. Bug: https://crbug.com/gerrit/14516 Change-Id: I8d21854eeeea541e072f63d6b10ad1253b1a9826 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/328359 Tested-by: XD Trol <milestonejxd@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* init: make bad --repo-rev settings more clearMike Frysinger2022-01-251-2/+6
| | | | | | | | | | | | | | | | If the user passes a bad --repo-rev setting in a new checkout, add a tip to the error message that their option is probably bad instead of just saying "unable to resolve". If the user has already initialized a checkout, we'd display a raw traceback which would confuse them. Swallow that and also include the --repo-rev tip. Bug: https://crbug.com/gerrit/15610 Change-Id: I5d72513c7b37bf9bb5d19862fcdfaf0d1f44e886 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/328820 Reviewed-by: Jack Neus <jackneus@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init, sync: fixed flake8 warnings.v2.18Raman Tenneti2021-11-181-5/+4
| | | | | | | | | | | | Tested: + run_tests + flake8 subcmds/init.py + flake8 subcmds/sync.py Change-Id: Ie337481d8a210bfc49b0745f75c05a308a0e74d3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/324155 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* superproject: Inherit --no-use-superproject with --mirror option.Raman Tenneti2021-11-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | init.py + Similar to opt.archive, gave an error if --mirror option is used with --use-superproject. sync.py + Defaulted to --no-use-superproject if manifest is a mirror or archive (similar to error at line# 1067). Tested: + run_tests + flake8 (will fix known errors in another CL). $ repo_dev init -u sso://googleplex-android.git.corp.google.com/platform/manifest --use-superproject --mirror Usage: repo init [options] [manifest url] main.py: error: --mirror and --use-superproject cannot be used together. + repo init and repo sync with --mirror and without --mirror options. $ repo_dev init -u https://android.googlesource.com/platform/manifest $ repo_dev sync ...superproject.git: Initial setup for superproject completed. + With --mirror option, verfied there are no exceptions in git_superproject.py Bug: [google internal] b/206537893 Change-Id: I059f20e76f0ab36f0587f29779bb53ede4663bd4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/323955 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* fetch: Fix stderr handling for gsutilJack Neus2021-10-261-1/+1
| | | | | | | | | | | | | | | | | Previously gsutil stderr was getting piped into stdout, which yields bad results if there are non-fatal warnings in stderr. Additionally, we should fail outright if gsutil fails (by adding `check = True`) rather than fail later on when we try to sync to a manifest that is in fact just a stderr dump. BUG=none TEST=manual runs with bad gs urls Change-Id: Id71791d0c3f180bd0601ef2c783a8e8e4afa8f59 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/321935 Tested-by: Jack Neus <jackneus@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* repo: more arg checking for --standalone-manifest re-initsv2.17.1Jack Neus2021-10-111-0/+5
| | | | | | | | | | | | | | | | `repo init` doesn't do anything on re-init when the checkout has been initialized using --standalone manifest. Rather than let the tool run through its existing flows (which happen to noop), check the args and explicitly quit if a bare `repo init` is run on a standalone checkout. BUG=none TEST=manual tests Change-Id: Ie4346ef6df1282ec3e3f8045a08138c93653fece Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/320735 Tested-by: Jack Neus <jackneus@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* repo: fix bug with --standalone-manifestJack Neus2021-10-111-2/+4
| | | | | | | | | | | | | We were accidentally always setting manifest.standlone in config, which was messing up behavior for standard use cases. BUG=gerrit:15160 TEST=manual runs Change-Id: Ic80f084ae97de5721aced3bb52d3ea9115f8d833 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/320715 Tested-by: Jack Neus <jackneus@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* repo: Add support for standalone manifestsJack Neus2021-09-281-15/+68
| | | | | | | | | | | | | | | | | | Added --standalone_manifest to repo tool. If set, the manifest is downloaded directly from the appropriate source (currently, we only support GS) and used instead of creating a manifest git checkout. The manifests.git repo is still created to keep track of various config but is marked as being for a standalone manifest so that the repo tool doesn't try to run networked git commands in it. BUG=b:192664812 TEST=existing tests (no coverage), manual runs Change-Id: I84378cbc7f8e515eabeccdde9665efc8cd2a9d21 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312942 Tested-by: Jack Neus <jackneus@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* superproject - More friendly user message when superproject failed.v2.16.1Raman Tenneti2021-07-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* superproject: Don't exit if superproject tag doesn't exist in manifest.v2.16Raman Tenneti2021-06-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* commands: document the "common" class attributeMike Frysinger2021-06-151-1/+1
| | | | | | | | | | 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>
* command: make --verbose/--quiet available to all subcommandsMike Frysinger2021-04-131-3/+3
| | | | | | | | | | | 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-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* init: merge subcmd & wrapper parsersMike Frysinger2021-04-091-102/+1
| | | | | | | | | | These are manually kept in sync which is a pain. Have the init subcmd reuse the wrapper code directly. Change-Id: Ica73211422c64377bacc9bb3b1d1a8d9d5f7f4ca Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302762 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* repo init: Added --no-partial-clone and made it persist. Bumped version to 2.14.Raman Tenneti2021-04-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Saved the repo.partialclone when --no-partial-clone option is passed to init, so repo sync will honor the no-partial-clone option. $ ./run_tests -v Bug: [google internal] b/175712967 $ mkdir androidx-main && cd androidx-main $ repo init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M $ repo sync -c -j32 $ cd frameworks/support/ && /google/bin/releases/android/git_repack/git_unpartial $ git config -l | grep 'partialclonefilter=blob' Observe partialclone is not enabled. $ cd ../.. $ repo init -u https://android.googlesource.com/platform/manifest -b androidx-main $ repo sync -c -j32 $ cd frameworks/support/ && git config -l | grep 'partialclonefilter=blob' Observe partialclone is enabled. $ /google/bin/releases/android/git_repack/git_unpartial Observe partialclone is not enabled. $ cd ../.. $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --no-partial-clone $ repo sync -c -j32 $ cd frameworks/support/ && git config -l | grep 'partialclonefilter=blob' Observe partialclone is not enabled. Change-Id: I4400ad7803b106319856bcd0fffe00bafcdf014e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302122 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* superproject: pass groups to ToXml method.Raman Tenneti2021-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added the following methods to XmlManifest class. + GetDefaultGroupsStr() - return 'default,platform-' + platform.system().lower() + GetGroupsStr() - Same as gitc_utils.py's _manifest_groups func. + Replaced gitc_utils.py's_manifest_groups calls with GetGroupsStr. + Used the above methods to get groups in command.py::GetProjects and part of init.py. TODO: clean up these funcs to take structured group data more instead of passing strings around everywhere that need parsing. Tested the code with the following commands. $ ./run_tests -v Tested the sync code by using repo_dev alias and pointing to this CL and verified prebuilts/fullsdk-linux directory has all the folders. Tested repo init and repo sync with --use-superproject and without --use-superproject argument. $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject $ repo_dev sync -c -j32 Bug: [google internal] b/181804931 Bug: https://crbug.com/gerrit/13707 Change-Id: Ia98585cbfa3a1449710655af55d56241794242b6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299422 Reviewed-by: Jonathan Nieder <jrn@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* init: expose --worktree optionMike Frysinger2021-03-091-3/+1
| | | | | | | | | | | There's a few rough edges here still, but no known corruption ones, so open it up a bit for people to experiment with. Bug: https://crbug.com/gerrit/11486 Change-Id: I81e0122ab6d3e032c546c8239dd4f03740676e80 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299242 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* superproject: Display status messages during repo init/sync.v2.13.3Raman Tenneti2021-03-041-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Superproject objects accept the optional argument “quiet”. The following progress messages are displayed if quiet is false. Displayed the following message whenever we find we have to make a new folder (aka new remote), because if you started with repo init android and later do googleplex-android that is when it will be slow. "<location>: Performing initial setup for superproject; this might take several minutes.". After fetch completion, added the following notification: "<location>: Initial setup for superproject completed." Tested the code with the following commands. $ ./run_tests -v Tested the sync code by using repo_dev alias and pointing to this CL. $ repo_dev init -u persistent-https://googleplex-android.git.corp.google.com/platform/manifest -b rvc-dev --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject Bug: [google internal] b/181178282 Bug: https://crbug.com/gerrit/13707 Change-Id: Ia7fb85c6fb934faaa90c48fc0c55e7f41055f48a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299122 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* init: support -b HEAD as a shortcut to "the default"Mike Frysinger2021-02-251-4/+8
| | | | | | | | | | | When people switch to non-default branches, they sometimes want to switch back to the default, but don't know the exact name for that branch. Add a -b HEAD shortcut for that. Change-Id: I090230da25f9f5a169608115d483f660f555624f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297843 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: make --manifest-url flag optionalMike Frysinger2021-02-181-4/+16
| | | | | | | | | | | Since the --manifest-url flag is always required when creating a new checkout, allow the url to be specified via a positional argument. This brings it a little closer to the `git clone` UI. Change-Id: Iaf18e794ae2fa38b20579243d067205cae5fae2f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297322 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* init: added --use-superproject option to clone superproject.v2.12.2Raman Tenneti2021-02-111-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added --no-use-superproject to repo and init.py to disable use of manifest superprojects. Replaced the term "sha" with "commit id". Added _GetBranch method to Superproject object. Moved shared code between init and sync into SyncSuperproject function. This function either does git clone or git fetch. If git fetch fails it does git clone. Changed Superproject constructor to accept manifest, repodir and branch to avoid passing them to multiple functions as argument. Changed functions that were raising exceptions to return either True or False. Saved the --use-superproject option in config as repo.superproject. Updated internal-fs-layout.md document. Updated the tests to work with the new API changes in Superproject. Performance for the first time sync has improved from 20 minutes to around 15 minutes. Tested the code with the following commands. $ ./run_tests -v Tested the sync code by using repo_dev alias and pointing to this CL. $ repo init took around 20 seconds longer because of cloning of superproject. $ time 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 ... real 0m35.919s user 0m21.947s sys 0m8.977s First run $ time repo sync --use-superproject ... real 16m41.982s user 100m6.916s sys 19m18.753s No difference in repo sync time after the first run. Bug: [google internal] b/179090734 Bug: https://crbug.com/gerrit/13709 Bug: https://crbug.com/gerrit/13707 Change-Id: I12df92112f46e001dfbc6f12cd633c3a15cf924b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/296382 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>