treemanifest: move tree store setup to a function

Summary:
In a future patch we will move tree store setup to be part of manifestlog
creation, instead of part of repo setup. Let's move the logic to it's own
function for now.

Test Plan: Ran the tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D232
This commit is contained in:
Durham Goode 2017-08-07 19:27:17 -07:00
parent ba4766820a
commit 44b2f83b7d

View File

@ -173,6 +173,25 @@ def clientreposetup(repo):
except KeyError:
raise error.Abort(_("cannot use treemanifest without fastmanifest"))
setuptreestores(repo)
def setuptreestores(repo):
if repo.ui.configbool("treemanifest", "server"):
packpath = repo.vfs.join('cache/packs/%s' % PACK_CATEGORY)
# Data store
datastore = cstore.datapackstore(packpath)
revlogstore = manifestrevlogstore(repo)
repo.svfs.manifestdatastore = unioncontentstore(datastore, revlogstore)
# History store
historystore = historypackstore(repo.ui, packpath)
repo.svfs.manifesthistorystore = unionmetadatastore(
historystore,
revlogstore,
)
return
usecdatapack = repo.ui.configbool('remotefilelog', 'fastdatapack')
packpath = shallowutil.getcachepackpath(repo, PACK_CATEGORY)
@ -350,19 +369,7 @@ def serverreposetup(repo):
return caps
extensions.wrapfunction(wireproto, '_capabilities', _capabilities)
packpath = repo.vfs.join('cache/packs/%s' % PACK_CATEGORY)
# Data store
datastore = cstore.datapackstore(packpath)
revlogstore = manifestrevlogstore(repo)
repo.svfs.manifestdatastore = unioncontentstore(datastore, revlogstore)
# History store
historystore = historypackstore(repo.ui, packpath)
repo.svfs.manifesthistorystore = unionmetadatastore(
historystore,
revlogstore,
)
setuptreestores(repo)
def _addmanifestgroup(*args, **kwargs):
raise error.Abort(_("cannot push commits to a treemanifest transition "