remotefilelog: call setuprepo unconditionally in clone_shallow -> pull_shallow

Summary:
Before this change, pull_shallow only calls setuprepo if the remotefilelog
requirement is not in repo. With D21011401, the remotefilelog requirement
will be added by clone.py and pull_shallow can skip calling setuprepo, causing
the pull code paths to write file logs (and fail).

Change the pull_shallow to always call `setuprepo` to solve the issue.

The final fix is probably moving more remotefilelog related clone logic to core.
Right now I just did the minimal change to fix things.

Reviewed By: sfilipco

Differential Revision: D21632429

fbshipit-source-id: 17775ac0df18cda10247419b40f9c27436b22606
This commit is contained in:
Jun Wu 2020-05-18 17:50:00 -07:00 committed by Facebook GitHub Bot
parent acfa7f4291
commit c2869d6ca9

View File

@ -345,26 +345,25 @@ def cloneshallow(orig, ui, repo, *args, **opts):
repos = []
def pull_shallow(orig, self, *args, **kwargs):
if shallowrepo.requirement not in self.requirements:
repos.append(self.unfiltered())
# set up the client hooks so the post-clone update works
setupclient(self.ui, self.unfiltered())
repos.append(self.unfiltered())
# set up the client hooks so the post-clone update works
setupclient(self.ui, self.unfiltered())
# setupclient fixed the class on the repo itself
# but we also need to fix it on the repoview
if isinstance(self, repoview.repoview):
self.__class__.__bases__ = (
self.__class__.__bases__[0],
self.unfiltered().__class__,
)
# setupclient fixed the class on the repo itself
# but we also need to fix it on the repoview
if isinstance(self, repoview.repoview):
self.__class__.__bases__ = (
self.__class__.__bases__[0],
self.unfiltered().__class__,
)
if shallowrepo.requirement not in self.requirements:
self.requirements.add(shallowrepo.requirement)
self._writerequirements()
# Since setupclient hadn't been called, exchange.pull was not
# wrapped. So we need to manually invoke our version of it.
return exchangepull(orig, self, *args, **kwargs)
else:
return orig(self, *args, **kwargs)
# Since setupclient hadn't been called, exchange.pull was not
# wrapped. So we need to manually invoke our version of it.
return exchangepull(orig, self, *args, **kwargs)
wrapfunction(exchange, "pull", pull_shallow)