summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-04-27 17:34:42 +0000
committerLaMont Jones <lamontjones@google.com>2022-04-29 17:13:49 +0000
commit0165e20fcc4533ae0dc48531cfa9cbf3662cc999 (patch)
tree3a047fa0f904dd7ebe20c1378f64a1404e57840a /project.py
parent0de4fc3001b36db7e107e61586296ca25bbf6d6d (diff)
downloadgit-repo-0165e20fcc4533ae0dc48531cfa9cbf3662cc999.tar.gz
project: Do not exit early on --standalone-manifest.
After we successfully download the standalone manifest file, we cannot exit early. Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=15861 Change-Id: Ic47c9f7e9921851f94c6f24fd82b896eff524037 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/335974 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py67
1 files changed, 33 insertions, 34 deletions
diff --git a/project.py b/project.py
index ad296de2..7afd6a79 100644
--- a/project.py
+++ b/project.py
@@ -3710,46 +3710,45 @@ class ManifestProject(MetaProject):
3710 if use_superproject is not None: 3710 if use_superproject is not None:
3711 self.config.SetBoolean('repo.superproject', use_superproject) 3711 self.config.SetBoolean('repo.superproject', use_superproject)
3712 3712
3713 if standalone_manifest: 3713 if not standalone_manifest:
3714 if is_new: 3714 if not self.Sync_NetworkHalf(
3715 manifest_name = 'default.xml' 3715 is_new=is_new, quiet=not verbose, verbose=verbose,
3716 manifest_data = fetch.fetch_file(manifest_url, verbose=verbose) 3716 clone_bundle=clone_bundle, current_branch_only=current_branch_only,
3717 dest = os.path.join(self.worktree, manifest_name) 3717 tags=tags, submodules=submodules, clone_filter=clone_filter,
3718 os.makedirs(os.path.dirname(dest), exist_ok=True) 3718 partial_clone_exclude=self.manifest.PartialCloneExclude):
3719 with open(dest, 'wb') as f: 3719 r = self.GetRemote(self.remote.name)
3720 f.write(manifest_data) 3720 print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
3721 return 3721
3722 3722 # Better delete the manifest git dir if we created it; otherwise next
3723 if not self.Sync_NetworkHalf(is_new=is_new, quiet=not verbose, verbose=verbose, 3723 # time (when user fixes problems) we won't go through the "is_new" logic.
3724 clone_bundle=clone_bundle, 3724 if is_new:
3725 current_branch_only=current_branch_only, 3725 platform_utils.rmtree(self.gitdir)
3726 tags=tags, submodules=submodules, 3726 return False
3727 clone_filter=clone_filter,
3728 partial_clone_exclude=self.manifest.PartialCloneExclude):
3729 r = self.GetRemote(self.remote.name)
3730 print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
3731 3727
3732 # Better delete the manifest git dir if we created it; otherwise next 3728 if manifest_branch:
3733 # time (when user fixes problems) we won't go through the "is_new" logic. 3729 self.MetaBranchSwitch(submodules=submodules)
3734 if is_new:
3735 platform_utils.rmtree(self.gitdir)
3736 return False
3737 3730
3738 if manifest_branch: 3731 syncbuf = SyncBuffer(self.config)
3739 self.MetaBranchSwitch(submodules=submodules) 3732 self.Sync_LocalHalf(syncbuf, submodules=submodules)
3733 syncbuf.Finish()
3740 3734
3741 syncbuf = SyncBuffer(self.config) 3735 if is_new or self.CurrentBranch is None:
3742 self.Sync_LocalHalf(syncbuf, submodules=submodules) 3736 if not self.StartBranch('default'):
3743 syncbuf.Finish() 3737 print('fatal: cannot create default in manifest', file=sys.stderr)
3738 return False
3744 3739
3745 if is_new or self.CurrentBranch is None: 3740 if not manifest_name:
3746 if not self.StartBranch('default'): 3741 print('fatal: manifest name (-m) is required.', file=sys.stderr)
3747 print('fatal: cannot create default in manifest', file=sys.stderr)
3748 return False 3742 return False
3749 3743
3750 if not manifest_name: 3744 elif is_new:
3751 print('fatal: manifest name (-m) is required.', file=sys.stderr) 3745 # This is a new standalone manifest.
3752 return False 3746 manifest_name = 'default.xml'
3747 manifest_data = fetch.fetch_file(manifest_url, verbose=verbose)
3748 dest = os.path.join(self.worktree, manifest_name)
3749 os.makedirs(os.path.dirname(dest), exist_ok=True)
3750 with open(dest, 'wb') as f:
3751 f.write(manifest_data)
3753 3752
3754 try: 3753 try:
3755 self.manifest.Link(manifest_name) 3754 self.manifest.Link(manifest_name)