diff options
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 105 |
1 files changed, 54 insertions, 51 deletions
@@ -32,10 +32,11 @@ from color import Coloring | |||
32 | from git_command import GitCommand, git_require | 32 | from git_command import GitCommand, git_require |
33 | from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \ | 33 | from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \ |
34 | ID_RE | 34 | ID_RE |
35 | from git_trace2_event_log import EventLog | ||
35 | from error import GitError, UploadError, DownloadError | 36 | from error import GitError, UploadError, DownloadError |
36 | from error import ManifestInvalidRevisionError, ManifestInvalidPathError | 37 | from error import ManifestInvalidRevisionError, ManifestInvalidPathError |
37 | from error import NoManifestException, ManifestParseError | 38 | from error import NoManifestException, ManifestParseError |
38 | import git_superproject | 39 | from git_superproject import Superproject |
39 | import platform_utils | 40 | import platform_utils |
40 | import progress | 41 | import progress |
41 | from repo_trace import IsTrace, Trace | 42 | from repo_trace import IsTrace, Trace |
@@ -3361,7 +3362,7 @@ class ManifestProject(MetaProject): | |||
3361 | @property | 3362 | @property |
3362 | def standalone_manifest_url(self): | 3363 | def standalone_manifest_url(self): |
3363 | """The URL of the standalone manifest, or None.""" | 3364 | """The URL of the standalone manifest, or None.""" |
3364 | return self.config.getString('manifest.standalone') | 3365 | return self.config.GetString('manifest.standalone') |
3365 | 3366 | ||
3366 | @property | 3367 | @property |
3367 | def manifest_groups(self): | 3368 | def manifest_groups(self): |
@@ -3444,8 +3445,8 @@ class ManifestProject(MetaProject): | |||
3444 | partial_clone=None, depth=None, clone_filter='blob:none', | 3445 | partial_clone=None, depth=None, clone_filter='blob:none', |
3445 | partial_clone_exclude=None, clone_bundle=None, git_lfs=None, | 3446 | partial_clone_exclude=None, clone_bundle=None, git_lfs=None, |
3446 | use_superproject=None, verbose=False, current_branch_only=False, | 3447 | use_superproject=None, verbose=False, current_branch_only=False, |
3447 | platform='', tags='', manifest_name='default.xml', | 3448 | git_event_log=None, platform='', manifest_name='default.xml', |
3448 | this_manifest_only=False, outer_manifest=True): | 3449 | tags='', this_manifest_only=False, outer_manifest=True): |
3449 | """Sync the manifest and all submanifests. | 3450 | """Sync the manifest and all submanifests. |
3450 | 3451 | ||
3451 | Args: | 3452 | Args: |
@@ -3478,6 +3479,7 @@ class ManifestProject(MetaProject): | |||
3478 | branch from the server. | 3479 | branch from the server. |
3479 | platform: a string, restrict the checkout to projects with the specified | 3480 | platform: a string, restrict the checkout to projects with the specified |
3480 | platform group. | 3481 | platform group. |
3482 | git_event_log: an EventLog, for git tracing. | ||
3481 | tags: a boolean, whether to fetch tags., | 3483 | tags: a boolean, whether to fetch tags., |
3482 | manifest_name: a string, the name of the manifest file to use. | 3484 | manifest_name: a string, the name of the manifest file to use. |
3483 | this_manifest_only: a boolean, whether to only operate on the current sub | 3485 | this_manifest_only: a boolean, whether to only operate on the current sub |
@@ -3489,6 +3491,7 @@ class ManifestProject(MetaProject): | |||
3489 | """ | 3491 | """ |
3490 | assert _kwargs_only == (), 'Sync only accepts keyword arguments.' | 3492 | assert _kwargs_only == (), 'Sync only accepts keyword arguments.' |
3491 | 3493 | ||
3494 | git_event_log = git_event_log or EventLog() | ||
3492 | if outer_manifest and self.manifest.is_submanifest: | 3495 | if outer_manifest and self.manifest.is_submanifest: |
3493 | # In a multi-manifest checkout, use the outer manifest unless we are told | 3496 | # In a multi-manifest checkout, use the outer manifest unless we are told |
3494 | # not to. | 3497 | # not to. |
@@ -3514,6 +3517,7 @@ class ManifestProject(MetaProject): | |||
3514 | current_branch_only=current_branch_only, | 3517 | current_branch_only=current_branch_only, |
3515 | tags=tags, | 3518 | tags=tags, |
3516 | depth=depth, | 3519 | depth=depth, |
3520 | git_event_log=git_event_log, | ||
3517 | manifest_name=manifest_name, | 3521 | manifest_name=manifest_name, |
3518 | this_manifest_only=this_manifest_only, | 3522 | this_manifest_only=this_manifest_only, |
3519 | outer_manifest=False) | 3523 | outer_manifest=False) |
@@ -3670,7 +3674,7 @@ class ManifestProject(MetaProject): | |||
3670 | self.config.SetBoolean('repo.partialclone', partial_clone) | 3674 | self.config.SetBoolean('repo.partialclone', partial_clone) |
3671 | if clone_filter: | 3675 | if clone_filter: |
3672 | self.config.SetString('repo.clonefilter', clone_filter) | 3676 | self.config.SetString('repo.clonefilter', clone_filter) |
3673 | elif self.partialclone: | 3677 | elif self.partial_clone: |
3674 | clone_filter = self.clone_filter | 3678 | clone_filter = self.clone_filter |
3675 | else: | 3679 | else: |
3676 | clone_filter = None | 3680 | clone_filter = None |
@@ -3747,52 +3751,51 @@ class ManifestProject(MetaProject): | |||
3747 | print('fatal: %s' % str(e), file=sys.stderr) | 3751 | print('fatal: %s' % str(e), file=sys.stderr) |
3748 | return False | 3752 | return False |
3749 | 3753 | ||
3750 | # Lastly, clone the superproject. | 3754 | if not this_manifest_only: |
3751 | superproject = git_superproject.Superproject(self.manifest, | 3755 | for submanifest in self.manifest.submanifests.values(): |
3752 | self.repodir, | 3756 | spec = submanifest.ToSubmanifestSpec(root=self.manifest.outer_client) |
3753 | self.git_event_log, | 3757 | submanifest.repo_client.manifestProject.Sync( |
3754 | quiet=not verbose) | 3758 | manifest_url=spec.manifestUrl, |
3755 | sync_result = superproject.Sync() | 3759 | manifest_branch=spec.revision, |
3756 | if not sync_result.success: | 3760 | standalone_manifest=standalone_manifest, |
3757 | print('warning: git update of superproject failed, repo sync will not ' | 3761 | groups=self.manifest_groups, |
3758 | 'use superproject to fetch source; while this error is not fatal, ' | 3762 | platform=platform, |
3759 | 'and you can continue to run repo sync, please run repo init with ' | 3763 | mirror=mirror, |
3760 | 'the --no-use-superproject option to stop seeing this warning', | 3764 | dissociate=dissociate, |
3761 | file=sys.stderr) | 3765 | reference=reference, |
3762 | if sync_result.fatal and use_superproject is not None: | 3766 | worktree=worktree, |
3763 | return False | 3767 | submodules=submodules, |
3764 | 3768 | archive=archive, | |
3765 | if this_manifest_only: | 3769 | partial_clone=partial_clone, |
3766 | return True | 3770 | clone_filter=clone_filter, |
3767 | 3771 | partial_clone_exclude=partial_clone_exclude, | |
3768 | for submanifest in self.manifest.submanifests.values(): | 3772 | clone_bundle=clone_bundle, |
3769 | spec = submanifest.ToSubmanifestSpec(root=self.manifest.outer_client) | 3773 | git_lfs=git_lfs, |
3770 | submanifest.repo_client.manifestProject.Sync( | 3774 | use_superproject=use_superproject, |
3771 | manifest_url=spec.manifestUrl, | 3775 | verbose=verbose, |
3772 | manifest_branch=spec.revision, | 3776 | current_branch_only=current_branch_only, |
3773 | standalone_manifest=standalone_manifest, | 3777 | tags=tags, |
3774 | groups=self.manifest_groups, | 3778 | depth=depth, |
3775 | platform=platform, | 3779 | git_event_log=git_event_log, |
3776 | mirror=mirror, | 3780 | manifest_name=spec.manifestName, |
3777 | dissociate=dissociate, | 3781 | this_manifest_only=False, |
3778 | reference=reference, | 3782 | outer_manifest=False, |
3779 | worktree=worktree, | 3783 | ) |
3780 | submodules=submodules, | 3784 | |
3781 | archive=archive, | 3785 | # Lastly, clone the superproject(s). |
3782 | partial_clone=partial_clone, | 3786 | if outer_manifest and not self.manifest.is_submanifest: |
3783 | clone_filter=clone_filter, | 3787 | for m in self.manifest.all_manifests: |
3784 | partial_clone_exclude=partial_clone_exclude, | 3788 | sync_result = Superproject( |
3785 | clone_bundle=clone_bundle, | 3789 | m, m.repodir, git_event_log, quiet=not verbose).Sync() |
3786 | git_lfs=git_lfs, | 3790 | if not sync_result.success: |
3787 | use_superproject=use_superproject, | 3791 | print(f'warning: git update of superproject for {m.path_prefix} failed, ' |
3788 | verbose=verbose, | 3792 | 'repo sync will not ' |
3789 | current_branch_only=current_branch_only, | 3793 | 'use superproject to fetch source; while this error is not fatal, ' |
3790 | tags=tags, | 3794 | 'and you can continue to run repo sync, please run repo init with ' |
3791 | depth=depth, | 3795 | 'the --no-use-superproject option to stop seeing this warning', |
3792 | manifest_name=spec.manifestName, | 3796 | file=sys.stderr) |
3793 | this_manifest_only=False, | 3797 | if sync_result.fatal and use_superproject is not None: |
3794 | outer_manifest=False, | 3798 | return False |
3795 | ) | ||
3796 | 3799 | ||
3797 | return True | 3800 | return True |
3798 | 3801 | ||