superproject: Don't update the commit ids of projects if remote is different.
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>
diff --git a/git_superproject.py b/git_superproject.py
index 2516545..031f45c 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -262,10 +262,20 @@
return None
projects_missing_commit_ids = []
+ superproject_remote_name = self._manifest.superproject['remote'].name
for project in projects:
path = project.relpath
if not path:
continue
+ # Some manifests that pull projects from the "chromium" GoB
+ # (remote="chromium"), and have a private manifest that pulls projects
+ # from both the chromium GoB and "chrome-internal" GoB (remote="chrome").
+ # For such projects, one of the remotes will be different from
+ # superproject's remote. Until superproject, supports multiple remotes,
+ # don't update the commit ids of remotes that don't match superproject's
+ # remote.
+ if project.remote.name != superproject_remote_name:
+ continue
commit_id = commit_ids.get(path)
if commit_id:
project.SetRevisionId(commit_id)