From ae86a460222c34b2f9cd600e6d17f8fd4f467fae Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Tue, 27 Jul 2021 08:54:59 -0700 Subject: [PATCH] superproject: Skip updating of superproject when -l is used with sync. 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 Reviewed-by: Jonathan Nieder Tested-by: Raman Tenneti --- git_superproject.py | 5 +++++ subcmds/sync.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/git_superproject.py b/git_superproject.py index 86100960..8769355c 100644 --- a/git_superproject.py +++ b/git_superproject.py @@ -106,6 +106,11 @@ class Superproject(object): """Returns a dictionary of projects and their commit ids.""" return self._project_commit_ids + @property + def manifest_path(self): + """Returns the manifest path if the path exists or None.""" + return self._manifest_path if os.path.exists(self._manifest_path) else None + def _GetBranch(self): """Returns the branch name for getting the approved manifest.""" p = self._manifest.manifestProject diff --git a/subcmds/sync.py b/subcmds/sync.py index a770c253..74617544 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -301,6 +301,12 @@ later is required to fix a server side protocol bug. self.repodir, self.git_event_log, quiet=opt.quiet) + if opt.local_only: + manifest_path = superproject.manifest_path + if manifest_path: + self._ReloadManifest(manifest_path, load_local_manifests) + return manifest_path + all_projects = self.GetProjects(args, missing_ok=True, submodules_ok=opt.fetch_submodules)