summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manifest_xml.py9
-rw-r--r--project.py105
-rw-r--r--subcmds/init.py1
3 files changed, 60 insertions, 55 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 022cad20..02f09db9 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -243,12 +243,13 @@ class _XmlSubmanifest:
243 manifestFile = parent.SubmanifestInfoDir( 243 manifestFile = parent.SubmanifestInfoDir(
244 os.path.join(parent.path_prefix, self.relpath), 244 os.path.join(parent.path_prefix, self.relpath),
245 os.path.join('manifests', manifestName or 'default.xml')) 245 os.path.join('manifests', manifestName or 'default.xml'))
246 linkFile = parent.SubmanifestInfoDir(
247 os.path.join(parent.path_prefix, self.relpath), MANIFEST_FILE_NAME)
246 rc = self.repo_client = RepoClient( 248 rc = self.repo_client = RepoClient(
247 parent.repodir, manifestFile, parent_groups=','.join(groups) or '', 249 parent.repodir, linkFile, parent_groups=','.join(groups) or '',
248 submanifest_path=self.relpath, outer_client=outer_client) 250 submanifest_path=self.relpath, outer_client=outer_client)
249 251
250 self.present = os.path.exists(os.path.join(self.repo_client.subdir, 252 self.present = os.path.exists(manifestFile)
251 MANIFEST_FILE_NAME))
252 253
253 def __eq__(self, other): 254 def __eq__(self, other):
254 if not isinstance(other, _XmlSubmanifest): 255 if not isinstance(other, _XmlSubmanifest):
@@ -1051,7 +1052,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
1051 tree.present = present 1052 tree.present = present
1052 elif not os.path.exists(self.subdir): 1053 elif not os.path.exists(self.subdir):
1053 tree.present = False 1054 tree.present = False
1054 if tree.present: 1055 if present and tree.present:
1055 tree.repo_client._Load(initial_client=initial_client, 1056 tree.repo_client._Load(initial_client=initial_client,
1056 submanifest_depth=submanifest_depth + 1) 1057 submanifest_depth=submanifest_depth + 1)
1057 1058
diff --git a/project.py b/project.py
index 6d8784e1..a60a8582 100644
--- a/project.py
+++ b/project.py
@@ -32,10 +32,11 @@ from color import Coloring
32from git_command import GitCommand, git_require 32from git_command import GitCommand, git_require
33from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \ 33from git_config import GitConfig, IsId, GetSchemeFromUrl, GetUrlCookieFile, \
34 ID_RE 34 ID_RE
35from git_trace2_event_log import EventLog
35from error import GitError, UploadError, DownloadError 36from error import GitError, UploadError, DownloadError
36from error import ManifestInvalidRevisionError, ManifestInvalidPathError 37from error import ManifestInvalidRevisionError, ManifestInvalidPathError
37from error import NoManifestException, ManifestParseError 38from error import NoManifestException, ManifestParseError
38import git_superproject 39from git_superproject import Superproject
39import platform_utils 40import platform_utils
40import progress 41import progress
41from repo_trace import IsTrace, Trace 42from 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
diff --git a/subcmds/init.py b/subcmds/init.py
index 2cb3ff38..65b63efd 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -135,6 +135,7 @@ to update the working directory files.
135 current_branch_only=opt.current_branch_only, 135 current_branch_only=opt.current_branch_only,
136 tags=opt.tags, 136 tags=opt.tags,
137 depth=opt.depth, 137 depth=opt.depth,
138 git_event_log=self.git_event_log,
138 manifest_name=opt.manifest_name): 139 manifest_name=opt.manifest_name):
139 sys.exit(1) 140 sys.exit(1)
140 141