summaryrefslogtreecommitdiffstats
path: root/git_superproject.py
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-06-01 21:03:34 +0000
committerLaMont Jones <lamontjones@google.com>2022-06-08 16:49:08 +0000
commitff6b1dae1e9f2e7405690c1aeedf7e0c7d768460 (patch)
treec0ffaeea5ed6ccee683f47e6cef5a8897b130cb7 /git_superproject.py
parentbdcba7dc36f1c8e6041681eb5b3b5229c93c7c5c (diff)
downloadgit-repo-ff6b1dae1e9f2e7405690c1aeedf7e0c7d768460.tar.gz
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.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/git_superproject.py b/git_superproject.py
index 07bc2645..5d00bd72 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -18,7 +18,7 @@ For more information on superproject, check out:
18https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects 18https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects
19 19
20Examples: 20Examples:
21 superproject = Superproject() 21 superproject = Superproject(manifest, name, remote, revision)
22 UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects) 22 UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects)
23""" 23"""
24 24
@@ -99,8 +99,8 @@ class Superproject(object):
99 self._work_git_name = git_name + _SUPERPROJECT_GIT_NAME 99 self._work_git_name = git_name + _SUPERPROJECT_GIT_NAME
100 self._work_git = os.path.join(self._superproject_path, self._work_git_name) 100 self._work_git = os.path.join(self._superproject_path, self._work_git_name)
101 101
102 # The following are command arguemnts, rather then superproject attributes, 102 # The following are command arguemnts, rather than superproject attributes,
103 # and where included here originally. They should eventually become 103 # and were included here originally. They should eventually become
104 # arguments that are passed down from the public methods, instead of being 104 # arguments that are passed down from the public methods, instead of being
105 # treated as attributes. 105 # treated as attributes.
106 self._git_event_log = None 106 self._git_event_log = None
@@ -329,7 +329,8 @@ class Superproject(object):
329 """Update revisionId of every project in projects with the commit id. 329 """Update revisionId of every project in projects with the commit id.
330 330
331 Args: 331 Args:
332 projects: List of projects whose revisionId needs to be updated. 332 projects: a list of projects whose revisionId needs to be updated.
333 git_event_log: an EventLog, for git tracing.
333 334
334 Returns: 335 Returns:
335 UpdateProjectsResult 336 UpdateProjectsResult
@@ -431,9 +432,15 @@ def UseSuperproject(use_superproject, manifest):
431 Args: 432 Args:
432 use_superproject: option value from optparse. 433 use_superproject: option value from optparse.
433 manifest: manifest to use. 434 manifest: manifest to use.
435
436 Returns:
437 Whether the superproject should be used.
434 """ 438 """
435 439
436 if use_superproject is not None: 440 if not manifest.superproject:
441 # This (sub) manifest does not have a superproject definition.
442 return False
443 elif use_superproject is not None:
437 return use_superproject 444 return use_superproject
438 else: 445 else:
439 client_value = manifest.manifestProject.use_superproject 446 client_value = manifest.manifestProject.use_superproject