mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
remotefilelog: add make{datapackstore, historypackstore}
Summary: Let's consolidate these 2 to allow easy switching the the Rust based one. Reviewed By: quark-zju Differential Revision: D17187154 fbshipit-source-id: 5ccadabac2e2e4b684ca44917f1502e9a05d41d6
This commit is contained in:
parent
cf64b3dc99
commit
375d91a518
@ -1063,8 +1063,8 @@ def packparthandler(op, part):
|
||||
|
||||
|
||||
def _createpackstore(ui, packpath):
|
||||
datastore = datapack.datapackstore(ui, packpath)
|
||||
histstore = historypack.historypackstore(ui, packpath)
|
||||
datastore = datapack.makedatapackstore(ui, packpath)
|
||||
histstore = historypack.makehistorypackstore(ui, packpath)
|
||||
return datastore, histstore
|
||||
|
||||
|
||||
|
@ -82,6 +82,10 @@ class datapackstore(basepack.basepackstore):
|
||||
revisionstore.repackincrementaldatapacks(self.path, self.path)
|
||||
|
||||
|
||||
def makedatapackstore(ui, path, deletecorruptpacks=False):
|
||||
return datapackstore(ui, path, deletecorruptpacks)
|
||||
|
||||
|
||||
class memdatapack(object):
|
||||
def __init__(self):
|
||||
self.data = {}
|
||||
|
@ -86,6 +86,10 @@ class historypackstore(basepack.basepackstore):
|
||||
revisionstore.repackincrementalhistpacks(self.path, self.path)
|
||||
|
||||
|
||||
def makehistorypackstore(ui, path, deletecorruptpacks=False):
|
||||
return historypackstore(ui, path, deletecorruptpacks)
|
||||
|
||||
|
||||
class memhistorypack(object):
|
||||
def __init__(self):
|
||||
self.history = {}
|
||||
|
@ -21,8 +21,8 @@ from .contentstore import (
|
||||
remotefilelogcontentstore,
|
||||
unioncontentstore,
|
||||
)
|
||||
from .datapack import datapackstore
|
||||
from .historypack import historypackstore
|
||||
from .datapack import makedatapackstore
|
||||
from .historypack import makehistorypackstore
|
||||
from .metadatastore import (
|
||||
remotefilelogmetadatastore,
|
||||
remotemetadatastore,
|
||||
@ -644,10 +644,10 @@ class remotefileslog(filelog.fileslog):
|
||||
repo = self.repo
|
||||
|
||||
def makepackstore(datastores, historystores, packpath, deletecorrupt=False):
|
||||
packcontentstore = datapackstore(
|
||||
packcontentstore = makedatapackstore(
|
||||
repo.ui, packpath, deletecorruptpacks=deletecorrupt
|
||||
)
|
||||
packmetadatastore = historypackstore(
|
||||
packmetadatastore = makehistorypackstore(
|
||||
repo.ui, packpath, deletecorruptpacks=deletecorrupt
|
||||
)
|
||||
datastores.append(packcontentstore)
|
||||
|
@ -19,8 +19,6 @@ from .contentstore import (
|
||||
remotefilelogcontentstore,
|
||||
unioncontentstore,
|
||||
)
|
||||
from .datapack import datapackstore
|
||||
from .historypack import historypackstore
|
||||
from .metadatastore import (
|
||||
remotefilelogmetadatastore,
|
||||
remotemetadatastore,
|
||||
|
@ -202,8 +202,8 @@ from ..remotefilelog import (
|
||||
wirepack,
|
||||
)
|
||||
from ..remotefilelog.contentstore import manifestrevlogstore, unioncontentstore
|
||||
from ..remotefilelog.datapack import datapackstore, memdatapack
|
||||
from ..remotefilelog.historypack import historypackstore, memhistorypack
|
||||
from ..remotefilelog.datapack import makedatapackstore, memdatapack
|
||||
from ..remotefilelog.historypack import makehistorypackstore, memhistorypack
|
||||
from ..remotefilelog.metadatastore import unionmetadatastore
|
||||
from ..remotefilelog.repack import (
|
||||
_computeincrementaldatapack,
|
||||
@ -650,7 +650,7 @@ def setuptreestores(repo, mfl):
|
||||
ondemandstore = ondemandtreedatastore(repo)
|
||||
|
||||
# Data store
|
||||
datastore = datapackstore(ui, packpath)
|
||||
datastore = makedatapackstore(ui, packpath)
|
||||
revlogstore = manifestrevlogstore(repo)
|
||||
mfl.revlogstore = revlogstore
|
||||
|
||||
@ -676,7 +676,7 @@ def setuptreestores(repo, mfl):
|
||||
)
|
||||
|
||||
# History store
|
||||
historystore = historypackstore(ui, packpath)
|
||||
historystore = makehistorypackstore(ui, packpath)
|
||||
mfl.historystore = unionmetadatastore(
|
||||
historystore, revlogstore, mutablelocalstore, ondemandstore
|
||||
)
|
||||
@ -714,8 +714,8 @@ def setuptreestores(repo, mfl):
|
||||
|
||||
# Data store
|
||||
# TODO: support cstore.uniondatapackstore here
|
||||
datastore = datapackstore(ui, packpath, deletecorruptpacks=True)
|
||||
localdatastore = datapackstore(ui, localpackpath)
|
||||
datastore = makedatapackstore(ui, packpath, deletecorruptpacks=True)
|
||||
localdatastore = makedatapackstore(ui, localpackpath)
|
||||
datastores = [datastore, localdatastore, mutablelocalstore, mutablesharedstore]
|
||||
if demanddownload:
|
||||
datastores.append(remotestore)
|
||||
@ -730,8 +730,8 @@ def setuptreestores(repo, mfl):
|
||||
mfl.localdatastores = [localdatastore]
|
||||
|
||||
# History store
|
||||
sharedhistorystore = historypackstore(ui, packpath, deletecorruptpacks=True)
|
||||
localhistorystore = historypackstore(ui, localpackpath)
|
||||
sharedhistorystore = makehistorypackstore(ui, packpath, deletecorruptpacks=True)
|
||||
localhistorystore = makehistorypackstore(ui, localpackpath)
|
||||
mfl.sharedhistorystores = [sharedhistorystore]
|
||||
mfl.localhistorystores = [localhistorystore]
|
||||
|
||||
@ -2611,7 +2611,7 @@ def serverrepack(repo, incremental=False, options=None):
|
||||
files = []
|
||||
|
||||
# Data store
|
||||
fulldatapackstore = datapackstore(repo.ui, packpath)
|
||||
fulldatapackstore = makedatapackstore(repo.ui, packpath)
|
||||
if incremental:
|
||||
datastores = _topacks(
|
||||
packpath,
|
||||
@ -2631,7 +2631,7 @@ def serverrepack(repo, incremental=False, options=None):
|
||||
revisionstore.historypack,
|
||||
)
|
||||
else:
|
||||
historystores = [historypackstore(repo.ui, packpath)]
|
||||
historystores = [makehistorypackstore(repo.ui, packpath)]
|
||||
historystores.append(revlogstore)
|
||||
histstore = unionmetadatastore(*historystores)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user