diff --git a/eden/scm/edenscm/hgext/commitcloud/__init__.py b/eden/scm/edenscm/hgext/commitcloud/__init__.py index 21d9c2ba6b..f1e58fa360 100644 --- a/eden/scm/edenscm/hgext/commitcloud/__init__.py +++ b/eden/scm/edenscm/hgext/commitcloud/__init__.py @@ -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}" ) diff --git a/eden/scm/edenscm/hgext/commitcloud/sync.py b/eden/scm/edenscm/hgext/commitcloud/sync.py index 685580a842..9f7f2e930e 100644 --- a/eden/scm/edenscm/hgext/commitcloud/sync.py +++ b/eden/scm/edenscm/hgext/commitcloud/sync.py @@ -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.