diff options
author | Raman Tenneti <rtenneti@google.com> | 2021-07-27 08:54:59 -0700 |
---|---|---|
committer | Raman Tenneti <rtenneti@google.com> | 2021-07-28 16:12:53 +0000 |
commit | ae86a460222c34b2f9cd600e6d17f8fd4f467fae (patch) | |
tree | 44e195e3a99f01ca1d4a27324365a3a67bcd95a5 | |
parent | 73c43b839fe2ff974f13b7b06f9538762ce0b0d8 (diff) | |
download | git-repo-ae86a460222c34b2f9cd600e6d17f8fd4f467fae.tar.gz |
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 <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
Tested-by: Raman Tenneti <rtenneti@google.com>
-rw-r--r-- | git_superproject.py | 5 | ||||
-rw-r--r-- | subcmds/sync.py | 6 |
2 files changed, 11 insertions, 0 deletions
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): | |||
106 | """Returns a dictionary of projects and their commit ids.""" | 106 | """Returns a dictionary of projects and their commit ids.""" |
107 | return self._project_commit_ids | 107 | return self._project_commit_ids |
108 | 108 | ||
109 | @property | ||
110 | def manifest_path(self): | ||
111 | """Returns the manifest path if the path exists or None.""" | ||
112 | return self._manifest_path if os.path.exists(self._manifest_path) else None | ||
113 | |||
109 | def _GetBranch(self): | 114 | def _GetBranch(self): |
110 | """Returns the branch name for getting the approved manifest.""" | 115 | """Returns the branch name for getting the approved manifest.""" |
111 | p = self._manifest.manifestProject | 116 | 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. | |||
301 | self.repodir, | 301 | self.repodir, |
302 | self.git_event_log, | 302 | self.git_event_log, |
303 | quiet=opt.quiet) | 303 | quiet=opt.quiet) |
304 | if opt.local_only: | ||
305 | manifest_path = superproject.manifest_path | ||
306 | if manifest_path: | ||
307 | self._ReloadManifest(manifest_path, load_local_manifests) | ||
308 | return manifest_path | ||
309 | |||
304 | all_projects = self.GetProjects(args, | 310 | all_projects = self.GetProjects(args, |
305 | missing_ok=True, | 311 | missing_ok=True, |
306 | submodules_ok=opt.fetch_submodules) | 312 | submodules_ok=opt.fetch_submodules) |