diff options
| author | LaMont Jones <lamontjones@google.com> | 2022-06-01 21:03:34 +0000 |
|---|---|---|
| committer | LaMont Jones <lamontjones@google.com> | 2022-06-08 16:49:08 +0000 |
| commit | ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460 (patch) | |
| tree | c0ffaeea5ed6ccee683f47e6cef5a8897b130cb7 /git_superproject.py | |
| parent | bdcba7dc36f1c8e6041681eb5b3b5229c93c7c5c (diff) | |
| download | git-repo-ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460.tar.gz git-repo-ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460.zip | |
Only sync superproject if it will be used.
If the user says `--no-use-superproject`, then do not bother syncing the
superproject.
Also add/update docstrings and comments throughout.
Change-Id: I9cdad706130501bab9a22d3099a1dae605e9c194
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/338975
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'git_superproject.py')
| -rw-r--r-- | git_superproject.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/git_superproject.py b/git_superproject.py index 07bc2645f..5d00bd72f 100644 --- a/git_superproject.py +++ b/git_superproject.py @@ -18,7 +18,7 @@ For more information on superproject, check out: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects Examples: - superproject = Superproject() + superproject = Superproject(manifest, name, remote, revision) UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects) """ @@ -99,8 +99,8 @@ class Superproject(object): self._work_git_name = git_name + _SUPERPROJECT_GIT_NAME self._work_git = os.path.join(self._superproject_path, self._work_git_name) - # The following are command arguemnts, rather then superproject attributes, - # and where included here originally. They should eventually become + # The following are command arguemnts, rather than superproject attributes, + # and were included here originally. They should eventually become # arguments that are passed down from the public methods, instead of being # treated as attributes. self._git_event_log = None @@ -329,7 +329,8 @@ class Superproject(object): """Update revisionId of every project in projects with the commit id. Args: - projects: List of projects whose revisionId needs to be updated. + projects: a list of projects whose revisionId needs to be updated. + git_event_log: an EventLog, for git tracing. Returns: UpdateProjectsResult @@ -431,9 +432,15 @@ def UseSuperproject(use_superproject, manifest): Args: use_superproject: option value from optparse. manifest: manifest to use. + + Returns: + Whether the superproject should be used. """ - if use_superproject is not None: + if not manifest.superproject: + # This (sub) manifest does not have a superproject definition. + return False + elif use_superproject is not None: return use_superproject else: client_value = manifest.manifestProject.use_superproject |
