diff options
author | LaMont Jones <lamontjones@google.com> | 2022-04-11 22:50:11 +0000 |
---|---|---|
committer | LaMont Jones <lamontjones@google.com> | 2022-05-26 00:03:37 +0000 |
commit | bdcba7dc36f1c8e6041681eb5b3b5229c93c7c5c (patch) | |
tree | ef0dbd149d7e5cd35c4d007a5052ba42bcc1c881 /project.py | |
parent | 1d00a7e2ae64b6c08aff60c2e7ed5c2d89caf8d6 (diff) | |
download | git-repo-bdcba7dc36f1c8e6041681eb5b3b5229c93c7c5c.tar.gz |
sync: add multi-manifest supportv2.26
With this change, partial syncs (sync with a project list) are again
supported.
If the updated manifest includes new sub manifests, download them
inheriting options from the parent manifestProject.
Change-Id: Id952f85df2e26d34e38b251973be26434443ff56
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/334819
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: LaMont Jones <lamontjones@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 61 |
1 files changed, 61 insertions, 0 deletions
@@ -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, |