From 0cd7a9cb8f7169ce7f38995c83ad3cbd5e3bab67 Mon Sep 17 00:00:00 2001 From: Xavier Deguillard Date: Thu, 5 Sep 2019 10:19:14 -0700 Subject: [PATCH] remotefilelog: add a config to use the Rust PackStore Reviewed By: quark-zju Differential Revision: D17187153 fbshipit-source-id: 57faa956598600e520dfea3cd05de981e5caae1c --- edenscm/hgext/remotefilelog/__init__.py | 2 ++ edenscm/hgext/remotefilelog/datapack.py | 5 ++++- edenscm/hgext/remotefilelog/historypack.py | 5 ++++- edenscm/hgext/remotefilelog/repack.py | 16 ++++++++++++++-- edenscm/hgext/treemanifest/__init__.py | 1 - 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/edenscm/hgext/remotefilelog/__init__.py b/edenscm/hgext/remotefilelog/__init__.py index 303a60216b..8a1bb8aa8d 100644 --- a/edenscm/hgext/remotefilelog/__init__.py +++ b/edenscm/hgext/remotefilelog/__init__.py @@ -128,6 +128,8 @@ Configs: ``remotefilelog.indexedloghistorystore`` use an IndexedLog history store. + ``remotefilelog.userustpackstore`` use the Rust PackStore. + Configs for Eden API (HTTP data fetching): ``edenapi.enabled`` specifies whether HTTP data fetching should be used. diff --git a/edenscm/hgext/remotefilelog/datapack.py b/edenscm/hgext/remotefilelog/datapack.py index f8d0c6da44..0347955471 100644 --- a/edenscm/hgext/remotefilelog/datapack.py +++ b/edenscm/hgext/remotefilelog/datapack.py @@ -83,7 +83,10 @@ class datapackstore(basepack.basepackstore): def makedatapackstore(ui, path, deletecorruptpacks=False): - return datapackstore(ui, path, deletecorruptpacks) + if ui.configbool("remotefilelog", "userustpackstore", False): + return revisionstore.datapackstore(path, deletecorruptpacks) + else: + return datapackstore(ui, path, deletecorruptpacks) class memdatapack(object): diff --git a/edenscm/hgext/remotefilelog/historypack.py b/edenscm/hgext/remotefilelog/historypack.py index 089299220c..dc3cbd5829 100644 --- a/edenscm/hgext/remotefilelog/historypack.py +++ b/edenscm/hgext/remotefilelog/historypack.py @@ -87,7 +87,10 @@ class historypackstore(basepack.basepackstore): def makehistorypackstore(ui, path, deletecorruptpacks=False): - return historypackstore(ui, path, deletecorruptpacks) + if ui.configbool("remotefilelog", "userustpackstore", False): + return revisionstore.historypackstore(path, deletecorruptpacks) + else: + return historypackstore(ui, path, deletecorruptpacks) class memhistorypack(object): diff --git a/edenscm/hgext/remotefilelog/repack.py b/edenscm/hgext/remotefilelog/repack.py index afefac7087..5d53e49e6a 100644 --- a/edenscm/hgext/remotefilelog/repack.py +++ b/edenscm/hgext/remotefilelog/repack.py @@ -355,7 +355,14 @@ def _incrementalrepack( datapacks = _topacks( packpath, _computeincrementaldatapack(repo.ui, files), revisionstore.datapack ) - datapacks.extend(s for s in datastore if not isinstance(s, datapack.datapackstore)) + datapacks.extend( + s + for s in datastore + if not ( + isinstance(s, datapack.datapackstore) + or isinstance(s, revisionstore.datapackstore) + ) + ) historypacks = _topacks( packpath, @@ -363,7 +370,12 @@ def _incrementalrepack( revisionstore.historypack, ) historypacks.extend( - s for s in historystore if not isinstance(s, historypack.historypackstore) + s + for s in historystore + if not ( + isinstance(s, historypack.historypackstore) + or isinstance(s, revisionstore.historypackstore) + ) ) # ``allhistory{files,packs}`` contains all known history packs, even ones we diff --git a/edenscm/hgext/treemanifest/__init__.py b/edenscm/hgext/treemanifest/__init__.py index 0418c8d2cc..99bc09fd2d 100644 --- a/edenscm/hgext/treemanifest/__init__.py +++ b/edenscm/hgext/treemanifest/__init__.py @@ -713,7 +713,6 @@ def setuptreestores(repo, mfl): ) # Data store - # TODO: support cstore.uniondatapackstore here datastore = makedatapackstore(ui, packpath, deletecorruptpacks=True) localdatastore = makedatapackstore(ui, localpackpath) datastores = [datastore, localdatastore, mutablelocalstore, mutablesharedstore]