deprecate 4 commits at a time limitation for unhydrated pulls

Summary:
deprecate 4 commits at a time limitation for unhydrated pulls

This could speedify cloud join commands significantly (by many X times) and hg cloud sync --full command.

Reviewed By: farnz

Differential Revision: D28351849

fbshipit-source-id: f9f3d7a5c07d61cb51a5bb6284afaad963662c94
This commit is contained in:
Liubov Dmitrieva 2021-05-11 12:39:37 -07:00 committed by Facebook GitHub Bot
parent dd72cd4c2d
commit 2c3edb0989
2 changed files with 21 additions and 3 deletions

View File

@ -102,6 +102,9 @@ Configs::
# Enable reporting of background sync progress in the smartlog.
enableprogress = True
# Limit for number of commits in a group when pull (if unhydratedcommits enabled)
unhydratedpullsizelimit = 5000
[infinitepushbackup]
# Whether to enable automatic backups. If this option is True then a backup
# process will be started after every mercurial command that modifies the
@ -188,6 +191,7 @@ configitem("commitcloud", "automigratehostworkspace", default=False)
configitem("commitcloud", "synccheckoutlocations", default=False)
configitem("commitcloud", "enablestatus", default=True)
configitem("commitcloud", "enableprogress", default=True)
configitem("commitcloud", "unhydratedpullsizelimit", 5000)
configitem(
"commitcloud", "get_command", default="jf download --filepath {filename} {handle}"
)

View File

@ -484,7 +484,7 @@ def _applycloudchanges(repo, remotepath, lastsyncstate, cloudrefs, maxage, state
if remotebookmarknewnodes or newheads:
# Partition the heads into groups we can pull together.
headgroups = _partitionheads(
list(remotebookmarknewnodes) + newheads, cloudrefs.headdates
repo.ui, list(remotebookmarknewnodes) + newheads, cloudrefs.headdates
)
_pullheadgroups(repo, remotepath, headgroups)
@ -605,7 +605,21 @@ def _pullheadgroups(repo, remotepath, headgroups):
repo.connectionpool.close()
def _partitionheads(heads, headdates=None, sizelimit=4, spanlimit=86400):
def _partitionheads(ui, heads, headdates=None):
if ui.configbool("infinitepush", "wantsunhydratedcommits"):
# partition commits to larger groups because unhydratedcommits is faster and easier to pull
# split by 6 month timespans with some reasonably high (configurable) sizelimit
return _partitionheadsgroups(
heads,
headdates,
sizelimit=ui.config("commitcloud", "unhydratedpullsizelimit"),
spanlimit=86400 * 30 * 6,
)
else:
return _partitionheadsgroups(heads, headdates)
def _partitionheadsgroups(heads, headdates=None, sizelimit=4, spanlimit=86400):
"""partition a list of heads into groups limited by size and timespan
Partitions the list of heads into a list of head groups. Each head group
@ -779,7 +793,7 @@ def _forcesyncremotebookmarks(repo, cloudrefs, lastsyncstate, remotepath, tr):
repo, cloudremotebookmarks, lastsyncstate
)
if newnodes:
_pullheadgroups(repo, remotepath, _partitionheads(newnodes))
_pullheadgroups(repo, remotepath, _partitionheads(repo.ui, newnodes))
omittedremotebookmarks = _updateremotebookmarks(repo, tr, updates)
# We have now synced the repo to the cloud version. Store this.