mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Revert "project: initialize new manifests in temp dirs"
This reverts commit 07d21e6bde
.
Reason for revert: crbug.com/gerrit/16230, b/244467766 - breaks aosp-master-with-phones case
Change-Id: Id967d92f8622c2c13356b09e46ece9f20040aabc
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/344314
Tested-by: LaMont Jones <lamontjones@google.com>
Reviewed-by: Xin Li <delphij@google.com>
This commit is contained in:
parent
4112c07688
commit
af8fb132d5
42
project.py
42
project.py
@ -2794,35 +2794,6 @@ class Project(object):
|
|||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _InitialCheckoutStart(self):
|
|
||||||
"""Called when checking out a project for the first time.
|
|
||||||
|
|
||||||
This will use temporary non-visible paths so we can be safely interrupted
|
|
||||||
without leaving incomplete state behind.
|
|
||||||
"""
|
|
||||||
paths = [f'{x}.tmp' for x in (self.relpath, self.worktree, self.gitdir, self.objdir)]
|
|
||||||
for p in paths:
|
|
||||||
platform_utils.rmtree(p, ignore_errors=True)
|
|
||||||
self.UpdatePaths(*paths)
|
|
||||||
|
|
||||||
def _InitialCheckoutFinalizeNetworkHalf(self):
|
|
||||||
"""Finalize the object dirs after network syncing works."""
|
|
||||||
# Once the network half finishes, we can move the objects into the right
|
|
||||||
# place by removing the ".tmp" suffix on the dirs.
|
|
||||||
platform_utils.rmtree(self.gitdir[:-4], ignore_errors=True)
|
|
||||||
os.rename(self.gitdir, self.gitdir[:-4])
|
|
||||||
self.UpdatePaths(self.relpath, self.worktree, self.gitdir[:-4], self.objdir[:-4])
|
|
||||||
|
|
||||||
def _InitialCheckoutFinalizeLocalHalf(self):
|
|
||||||
"""Finalize the initial checkout and make it available."""
|
|
||||||
assert self.gitdir == self.objdir
|
|
||||||
# Once the local half finishes, we can move the manifest dir into the right
|
|
||||||
# place by removing the ".tmp" suffix on the dirs.
|
|
||||||
platform_utils.rmtree(self.worktree[:-4], ignore_errors=True)
|
|
||||||
os.rename(self.worktree, self.worktree[:-4])
|
|
||||||
self.UpdatePaths(
|
|
||||||
self.relpath[:-4], self.worktree[:-4], self.gitdir, self.objdir)
|
|
||||||
|
|
||||||
def _InitGitWorktree(self):
|
def _InitGitWorktree(self):
|
||||||
"""Init the project using git worktrees."""
|
"""Init the project using git worktrees."""
|
||||||
self.bare_git.worktree('prune')
|
self.bare_git.worktree('prune')
|
||||||
@ -3709,8 +3680,6 @@ class ManifestProject(MetaProject):
|
|||||||
(GitConfig.ForUser().UrlInsteadOf(manifest_url),),
|
(GitConfig.ForUser().UrlInsteadOf(manifest_url),),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
|
||||||
self._InitialCheckoutStart()
|
|
||||||
|
|
||||||
# The manifest project object doesn't keep track of the path on the
|
# The manifest project object doesn't keep track of the path on the
|
||||||
# server where this git is located, so let's save that here.
|
# server where this git is located, so let's save that here.
|
||||||
mirrored_manifest_git = None
|
mirrored_manifest_git = None
|
||||||
@ -3870,14 +3839,16 @@ class ManifestProject(MetaProject):
|
|||||||
partial_clone_exclude=self.manifest.PartialCloneExclude):
|
partial_clone_exclude=self.manifest.PartialCloneExclude):
|
||||||
r = self.GetRemote()
|
r = self.GetRemote()
|
||||||
print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
|
print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
|
||||||
|
|
||||||
|
# Better delete the manifest git dir if we created it; otherwise next
|
||||||
|
# time (when user fixes problems) we won't go through the "is_new" logic.
|
||||||
|
if is_new:
|
||||||
|
platform_utils.rmtree(self.gitdir)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if manifest_branch:
|
if manifest_branch:
|
||||||
self.MetaBranchSwitch(submodules=submodules)
|
self.MetaBranchSwitch(submodules=submodules)
|
||||||
|
|
||||||
if is_new:
|
|
||||||
self._InitialCheckoutFinalizeNetworkHalf()
|
|
||||||
|
|
||||||
syncbuf = SyncBuffer(self.config)
|
syncbuf = SyncBuffer(self.config)
|
||||||
self.Sync_LocalHalf(syncbuf, submodules=submodules)
|
self.Sync_LocalHalf(syncbuf, submodules=submodules)
|
||||||
syncbuf.Finish()
|
syncbuf.Finish()
|
||||||
@ -3900,9 +3871,6 @@ class ManifestProject(MetaProject):
|
|||||||
with open(dest, 'wb') as f:
|
with open(dest, 'wb') as f:
|
||||||
f.write(manifest_data)
|
f.write(manifest_data)
|
||||||
|
|
||||||
if is_new:
|
|
||||||
self._InitialCheckoutFinalizeLocalHalf()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.manifest.Link(manifest_name)
|
self.manifest.Link(manifest_name)
|
||||||
except ManifestParseError as e:
|
except ManifestParseError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user