summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/project.py b/project.py
index faa6b32b..8668bae9 100644
--- a/project.py
+++ b/project.py
@@ -3467,6 +3467,67 @@ class ManifestProject(MetaProject):
3467 """Return the name of the platform.""" 3467 """Return the name of the platform."""
3468 return platform.system().lower() 3468 return platform.system().lower()
3469 3469
3470 def SyncWithPossibleInit(self, submanifest, verbose=False,
3471 current_branch_only=False, tags='', git_event_log=None):
3472 """Sync a manifestProject, possibly for the first time.
3473
3474 Call Sync() with arguments from the most recent `repo init`. If this is a
3475 new sub manifest, then inherit options from the parent's manifestProject.
3476
3477 This is used by subcmds.Sync() to do an initial download of new sub
3478 manifests.
3479
3480 Args:
3481 submanifest: an XmlSubmanifest, the submanifest to re-sync.
3482 verbose: a boolean, whether to show all output, rather than only errors.
3483 current_branch_only: a boolean, whether to only fetch the current manifest
3484 branch from the server.
3485 tags: a boolean, whether to fetch tags.
3486 git_event_log: an EventLog, for git tracing.
3487 """
3488 # TODO(lamontjones): when refactoring sync (and init?) consider how to
3489 # better get the init options that we should use when syncing uncovers a new
3490 # submanifest.
3491 git_event_log = git_event_log or EventLog()
3492 spec = submanifest.ToSubmanifestSpec()
3493 # Use the init options from the existing manifestProject, or the parent if
3494 # it doesn't exist.
3495 #
3496 # Today, we only support changing manifest_groups on the sub-manifest, with
3497 # no supported-for-the-user way to change the other arguments from those
3498 # specified by the outermost manifest.
3499 #
3500 # TODO(lamontjones): determine which of these should come from the outermost
3501 # manifest and which should come from the parent manifest.
3502 mp = self if self.Exists else submanifest.parent.manifestProject
3503 return self.Sync(
3504 manifest_url=spec.manifestUrl,
3505 manifest_branch=spec.revision,
3506 standalone_manifest=mp.standalone_manifest_url,
3507 groups=mp.manifest_groups,
3508 platform=mp.manifest_platform,
3509 mirror=mp.mirror,
3510 dissociate=mp.dissociate,
3511 reference=mp.reference,
3512 worktree=mp.use_worktree,
3513 submodules=mp.submodules,
3514 archive=mp.archive,
3515 partial_clone=mp.partial_clone,
3516 clone_filter=mp.clone_filter,
3517 partial_clone_exclude=mp.partial_clone_exclude,
3518 clone_bundle=mp.clone_bundle,
3519 git_lfs=mp.git_lfs,
3520 use_superproject=mp.use_superproject,
3521 verbose=verbose,
3522 current_branch_only=current_branch_only,
3523 tags=tags,
3524 depth=mp.depth,
3525 git_event_log=git_event_log,
3526 manifest_name=spec.manifestName,
3527 this_manifest_only=True,
3528 outer_manifest=False,
3529 )
3530
3470 def Sync(self, _kwargs_only=(), manifest_url='', manifest_branch=None, 3531 def Sync(self, _kwargs_only=(), manifest_url='', manifest_branch=None,
3471 standalone_manifest=False, groups='', mirror=False, reference='', 3532 standalone_manifest=False, groups='', mirror=False, reference='',
3472 dissociate=False, worktree=False, submodules=False, archive=False, 3533 dissociate=False, worktree=False, submodules=False, archive=False,