diff options
author | Raman Tenneti <rtenneti@google.com> | 2021-02-09 00:26:31 -0800 |
---|---|---|
committer | Raman Tenneti <rtenneti@google.com> | 2021-02-11 18:59:29 +0000 |
commit | 21dce3d8b351538d0fe8c05e6106c8b281580dda (patch) | |
tree | 771c7d005adc27acfbfdd7e6e85339766efdb810 /subcmds/sync.py | |
parent | e3315bb49a782bcf62ba9df4fc1c2690b046763f (diff) | |
download | git-repo-21dce3d8b351538d0fe8c05e6106c8b281580dda.tar.gz |
init: added --use-superproject option to clone superproject.v2.12.2
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>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 5020ea7a..eda95f96 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -294,28 +294,12 @@ later is required to fix a server side protocol bug. | |||
294 | Returns: | 294 | Returns: |
295 | Returns path to the overriding manifest file. | 295 | Returns path to the overriding manifest file. |
296 | """ | 296 | """ |
297 | if not self.manifest.superproject: | 297 | superproject = git_superproject.Superproject(self.manifest, |
298 | print('error: superproject tag is not defined in manifest.xml', | 298 | self.repodir) |
299 | file=sys.stderr) | ||
300 | sys.exit(1) | ||
301 | print('WARNING: --use-superproject is experimental and not ' | ||
302 | 'for general use', file=sys.stderr) | ||
303 | |||
304 | superproject_url = self.manifest.superproject['remote'].url | ||
305 | if not superproject_url: | ||
306 | print('error: superproject URL is not defined in manifest.xml', | ||
307 | file=sys.stderr) | ||
308 | sys.exit(1) | ||
309 | |||
310 | superproject = git_superproject.Superproject(self.manifest.repodir) | ||
311 | all_projects = self.GetProjects(args, | 299 | all_projects = self.GetProjects(args, |
312 | missing_ok=True, | 300 | missing_ok=True, |
313 | submodules_ok=opt.fetch_submodules) | 301 | submodules_ok=opt.fetch_submodules) |
314 | branch = self._GetBranch() | 302 | manifest_path = superproject.UpdateProjectsRevisionId(all_projects) |
315 | manifest_path = superproject.UpdateProjectsRevisionId(self.manifest, | ||
316 | all_projects, | ||
317 | url=superproject_url, | ||
318 | branch=branch) | ||
319 | if not manifest_path: | 303 | if not manifest_path: |
320 | print('error: Update of revsionId from superproject has failed', | 304 | print('error: Update of revsionId from superproject has failed', |
321 | file=sys.stderr) | 305 | file=sys.stderr) |