clone: add option to enable nativecheckout during clone

Summary:
Native checkout avoids the initial large prefetch, and instead does
small batch prefetches and immediately writes them to disk. This will prevent
the issue where data in the cache is evicted before it's used and has to be
redownloaded in a non-batch fashion later.

In a future diff, using native checkout will also allow us to serialize and
deserialize it's CheckoutPlan, so we can make clones resumable.

Reviewed By: quark-zju

Differential Revision: D26825773

fbshipit-source-id: 6fde90cd7578f6af5fdd4ac78004f7f63af4f287
This commit is contained in:
Durham Goode 2021-03-04 17:20:18 -08:00 committed by Facebook GitHub Bot
parent 1fc4abff87
commit ee45deeeb2

View File

@ -2264,7 +2264,11 @@ def update(
fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
if repo.ui.configbool("experimental", "nativecheckout"):
# If we're doing the initial checkout from null, let's use the new fancier
# nativecheckout, since it has more efficient fetch mechanics.
if repo.ui.configbool("experimental", "nativecheckout") or (
repo.ui.configbool("clone", "nativecheckout") and repo["."].node() == nullid
):
if branchmerge:
fallbackcheckout = "branchmerge is not supported: %s" % branchmerge
elif ancestor is not None: