mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
treemanifest: remove non-treeonly conditionals
Summary: All our production clients have been treeonly for years. Let's remove all the non-treeonly paths. This diff just removes all the conditional logic. A later diff will remove the classes and functions that are no longer used because the conditions are gone. Reviewed By: andll Differential Revision: D29140647 fbshipit-source-id: 381195d7b48dee33e8540eb428b8061845e13ced
This commit is contained in:
parent
14b3b10632
commit
ba25f1d416
@ -68,15 +68,6 @@ default values are 0 and len(changelog) - 1, respectively.
|
||||
repackstartrev = 0
|
||||
repackendrev = 1000
|
||||
|
||||
Setting `treemanifest.treeonly` to True will force all manifest reads to use the
|
||||
tree format. This is useful in the final stages of a migration to treemanifest
|
||||
to prevent accesses of flat manifests.
|
||||
|
||||
::
|
||||
|
||||
[treemanifest]
|
||||
treeonly = True
|
||||
|
||||
`treemanifest.simplecacheserverstore` causes the treemanifest server to store a cache
|
||||
of treemanifest revisions in simplecache. This is a replacement for treemanifest.cacheserverstore
|
||||
Simplecache can be configured to use memcache as a store or a local disk.
|
||||
@ -241,7 +232,6 @@ configitem("treemanifest", "servermaxcachesize", default=1000000)
|
||||
configitem("treemanifest", "servercacheevictionpercent", default=50)
|
||||
configitem("treemanifest", "fetchdepth", default=TREE_DEPTH_MAX)
|
||||
configitem("treemanifest", "stickypushpath", default=True)
|
||||
configitem("treemanifest", "treeonly", default=True)
|
||||
configitem("treemanifest", "prefetchdraftparents", default=True)
|
||||
configitem("treemanifest", "ondemandfetch", default=True)
|
||||
configitem("treemanifest", "useruststore", default=True)
|
||||
@ -435,19 +425,18 @@ def getrepocaps(orig, repo, *args, **kwargs):
|
||||
caps = orig(repo, *args, **kwargs)
|
||||
if treeenabled(repo.ui):
|
||||
caps["treemanifest"] = ("True",)
|
||||
if repo.ui.configbool("treemanifest", "treeonly"):
|
||||
caps["treeonly"] = ("True",)
|
||||
caps["treeonly"] = ("True",)
|
||||
return caps
|
||||
|
||||
|
||||
def _collectmanifest(orig, repo, striprev):
|
||||
if treeenabled(repo.ui) and repo.ui.configbool("treemanifest", "treeonly"):
|
||||
if treeenabled(repo.ui):
|
||||
return []
|
||||
return orig(repo, striprev)
|
||||
|
||||
|
||||
def stripmanifest(orig, repo, striprev, tr, files):
|
||||
if treeenabled(repo.ui) and repo.ui.configbool("treemanifest", "treeonly"):
|
||||
if treeenabled(repo.ui):
|
||||
repair.striptrees(repo, tr, striprev, files)
|
||||
return
|
||||
orig(repo, striprev, tr, files)
|
||||
@ -599,8 +588,7 @@ def wraprepo(repo):
|
||||
def _restrictcapabilities(self, caps):
|
||||
caps = super(treerepository, self)._restrictcapabilities(caps)
|
||||
caps.add("gettreepack")
|
||||
if repo.ui.configbool("treemanifest", "treeonly"):
|
||||
caps.add("treeonly")
|
||||
caps.add("treeonly")
|
||||
return caps
|
||||
|
||||
def getdesignatednodes(self, keys):
|
||||
@ -722,10 +710,6 @@ def setuptreestores(repo, mfl):
|
||||
localpackpath = shallowutil.getlocalpackpath(repo.svfs.vfs.base, PACK_CATEGORY)
|
||||
|
||||
demanddownload = ui.configbool("treemanifest", "demanddownload", True)
|
||||
demandgenerate = (
|
||||
ui.configbool("treemanifest", "treeonly")
|
||||
or ui.configbool("treemanifest", "sendtrees")
|
||||
) and ui.configbool("treemanifest", "demandgenerate", True)
|
||||
remotestore = remotetreestore(repo)
|
||||
ondemandstore = ondemandtreedatastore(repo)
|
||||
|
||||
@ -743,8 +727,7 @@ def setuptreestores(repo, mfl):
|
||||
if demanddownload:
|
||||
datastores.append(remotestore)
|
||||
|
||||
if demandgenerate:
|
||||
datastores.append(ondemandstore)
|
||||
datastores.append(ondemandstore)
|
||||
|
||||
mfl.datastore = unioncontentstore(*datastores)
|
||||
|
||||
@ -769,9 +752,6 @@ def setuptreestores(repo, mfl):
|
||||
if demanddownload:
|
||||
histstores.append(remotestore)
|
||||
|
||||
if demandgenerate:
|
||||
histstores.append(ondemandstore)
|
||||
|
||||
mfl.historystore = unionmetadatastore(*histstores)
|
||||
shallowutil.reportpackmetrics(ui, "treestore", mfl.datastore, mfl.historystore)
|
||||
|
||||
@ -1238,11 +1218,8 @@ def getmanifestlog(orig, self):
|
||||
if not treeenabled(self.ui):
|
||||
return orig(self)
|
||||
|
||||
if self.ui.configbool("treemanifest", "treeonly"):
|
||||
mfl = treeonlymanifestlog(self.svfs, self)
|
||||
setuptreestores(self, mfl)
|
||||
else:
|
||||
mfl = hybridmanifestlog(self.svfs, self)
|
||||
mfl = treeonlymanifestlog(self.svfs, self)
|
||||
setuptreestores(self, mfl)
|
||||
|
||||
return mfl
|
||||
|
||||
@ -1566,44 +1543,21 @@ def _unpackmanifestscg3(orig, self, repo, *args, **kwargs):
|
||||
if not treeenabled(repo.ui):
|
||||
return orig(self, repo, *args, **kwargs)
|
||||
|
||||
if repo.ui.configbool("treemanifest", "treeonly"):
|
||||
self.manifestheader()
|
||||
_convertdeltastotrees(repo, self.deltaiter())
|
||||
# Handle sub-tree manifests
|
||||
for chunkdata in iter(self.filelogheader, {}):
|
||||
raise error.ProgrammingError(
|
||||
"sub-trees are not supported in a " "changegroup"
|
||||
)
|
||||
return
|
||||
return orig(self, repo, *args, **kwargs)
|
||||
self.manifestheader()
|
||||
_convertdeltastotrees(repo, self.deltaiter())
|
||||
# Handle sub-tree manifests
|
||||
for chunkdata in iter(self.filelogheader, {}):
|
||||
raise error.ProgrammingError("sub-trees are not supported in a " "changegroup")
|
||||
return
|
||||
|
||||
|
||||
def _unpackmanifestscg1(orig, self, repo, revmap, trp, numchanges):
|
||||
if not treeenabled(repo.ui):
|
||||
return orig(self, repo, revmap, trp, numchanges)
|
||||
|
||||
if repo.ui.configbool("treemanifest", "treeonly"):
|
||||
self.manifestheader()
|
||||
_convertdeltastotrees(repo, self.deltaiter())
|
||||
return
|
||||
|
||||
mfrevlog = repo.manifestlog._revlog
|
||||
oldtip = len(mfrevlog)
|
||||
|
||||
mfnodes = orig(self, repo, revmap, trp, numchanges)
|
||||
|
||||
if util.safehasattr(repo.manifestlog, "datastore") and repo.ui.configbool(
|
||||
"treemanifest", "autocreatetrees"
|
||||
):
|
||||
|
||||
# TODO: only put in cache if pulling from main server
|
||||
packpath = shallowutil.getcachepackpath(repo, PACK_CATEGORY)
|
||||
with mutablestores.mutabledatastore(repo, packpath) as dpack:
|
||||
with mutablestores.mutablehistorystore(repo, packpath) as hpack:
|
||||
recordmanifest(dpack, hpack, repo, oldtip, len(mfrevlog))
|
||||
|
||||
# Alert the store that there may be new packs
|
||||
repo.manifestlog.datastore.markforrefresh()
|
||||
self.manifestheader()
|
||||
_convertdeltastotrees(repo, self.deltaiter())
|
||||
return
|
||||
|
||||
|
||||
def _convertdeltastotrees(repo, deltas):
|
||||
@ -2102,18 +2056,6 @@ def getfallbackpath(repo):
|
||||
|
||||
|
||||
def pull(orig, ui, repo, *pats, **opts):
|
||||
# If we're not in treeonly mode, and we're missing public commits from the
|
||||
# revlog, backfill them.
|
||||
if treeenabled(ui) and not ui.configbool("treemanifest", "treeonly"):
|
||||
tippublicrevs = repo.revs("last(public())")
|
||||
if tippublicrevs:
|
||||
ctx = repo[tippublicrevs.first()]
|
||||
mfnode = ctx.manifestnode()
|
||||
mfrevlog = repo.manifestlog._revlog
|
||||
if mfnode not in mfrevlog.nodemap:
|
||||
ui.status(_("backfilling missing flat manifests\n"))
|
||||
backfillmanifestrevlog(ui, repo)
|
||||
|
||||
result = orig(ui, repo, *pats, **opts)
|
||||
if treeenabled(repo.ui):
|
||||
try:
|
||||
@ -2922,6 +2864,6 @@ class vfscachestore(cachestorecommon):
|
||||
|
||||
def pullbundle2extraprepare(orig, pullop, kwargs):
|
||||
repo = pullop.repo
|
||||
if treeenabled(repo.ui) and repo.ui.configbool("treemanifest", "treeonly"):
|
||||
if treeenabled(repo.ui):
|
||||
bundlecaps = kwargs.get("bundlecaps", set())
|
||||
bundlecaps.add("treeonly")
|
||||
|
@ -1,94 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
$ CACHEDIR=`pwd`/hgcache
|
||||
$ setconfig treemanifest.treeonly=False
|
||||
|
||||
$ hg init master
|
||||
$ cd master
|
||||
$ echo x > x
|
||||
$ hg commit -qAm 'add x'
|
||||
$ mkdir subdir
|
||||
$ echo z > subdir/z
|
||||
$ hg commit -qAm 'add subdir/z'
|
||||
$ echo x >> x
|
||||
$ hg commit -qAm 'modify x'
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [extensions]
|
||||
> treemanifest=$TESTDIR/../edenscm/hgext/treemanifestserver.py
|
||||
>
|
||||
> [remotefilelog]
|
||||
> name=master
|
||||
> cachepath=$CACHEDIR
|
||||
>
|
||||
> [fastmanifest]
|
||||
> usetree=True
|
||||
> usecache=False
|
||||
>
|
||||
> [treemanifest]
|
||||
> server=True
|
||||
> EOF
|
||||
$ hg backfilltree -l 1 --traceback
|
||||
$ ls .hg/store/00m*
|
||||
.hg/store/00manifest.i
|
||||
.hg/store/00manifesttree.i
|
||||
$ hg debugindex .hg/store/00manifesttree.i
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
|
||||
$ hg debugindex .hg/store/00manifest.i
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
|
||||
1 44 62 0 1 70f2c6726cec bc0c2c938b92 000000000000
|
||||
2 106 55 1 2 68221fc1644f 70f2c6726cec 000000000000
|
||||
|
||||
$ hg backfilltree -l 1 --traceback
|
||||
$ ls .hg/store/00m*
|
||||
.hg/store/00manifest.i
|
||||
.hg/store/00manifesttree.i
|
||||
$ ls .hg/store/meta
|
||||
subdir
|
||||
$ hg debugindex .hg/store/00manifesttree.i
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
|
||||
1 44 61 0 1 70f2c6726cec bc0c2c938b92 000000000000
|
||||
$ hg debugindex .hg/store/00manifest.i
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
|
||||
1 44 62 0 1 70f2c6726cec bc0c2c938b92 000000000000
|
||||
2 106 55 1 2 68221fc1644f 70f2c6726cec 000000000000
|
||||
|
||||
$ hg debugdata .hg/store/00manifesttree.i 0
|
||||
x\x001406e74118627694268417491f018a4a883152f0 (esc)
|
||||
$ hg debugdata .hg/store/00manifesttree.i 1
|
||||
subdir\x00ddb35f099a648a43a997aef53123bce309c794fdt (esc)
|
||||
x\x001406e74118627694268417491f018a4a883152f0 (esc)
|
||||
|
||||
Test backfilling all at once
|
||||
$ rm -rf .hg/store/00manifesttree.i .hg/store/meta
|
||||
$ hg backfilltree
|
||||
$ hg debugindex .hg/store/00manifesttree.i
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
|
||||
1 44 61 0 1 70f2c6726cec bc0c2c938b92 000000000000
|
||||
2 105 55 1 2 68221fc1644f 70f2c6726cec 000000000000
|
||||
|
||||
Test backfilling a commit with a null manifest
|
||||
$ cd ../
|
||||
$ hg init nullrepo
|
||||
$ cd nullrepo
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [extensions]
|
||||
> treemanifest=$TESTDIR/../edenscm/hgext/treemanifestserver.py
|
||||
>
|
||||
> [remotefilelog]
|
||||
> name=master
|
||||
> cachepath=$CACHEDIR
|
||||
>
|
||||
> [fastmanifest]
|
||||
> usetree=True
|
||||
> usecache=False
|
||||
>
|
||||
> [treemanifest]
|
||||
> server=True
|
||||
> EOF
|
||||
$ hg commit --config ui.allowemptycommit=True -m "Initial commit"
|
||||
$ hg backfilltree
|
@ -143,10 +143,6 @@ Test pulling new commits from a hybrid server
|
||||
adding file changes
|
||||
added 1 changesets with 0 changes to 0 files
|
||||
|
||||
$ hg debugindex -m --config treemanifest.treeonly=False
|
||||
hg debugindex: invalid arguments
|
||||
(use 'hg debugindex -h' to get help)
|
||||
[255]
|
||||
$ hg log -r tip --stat --pager=off
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
||||
fetching tree '' 7e265a5dc5229c2b237874c6bd19f6ef4120f949, found via 098a163f13ea
|
||||
@ -197,9 +193,6 @@ Test {manifest} template
|
||||
Test turning treeonly off and making sure we can still commit on top of treeonly
|
||||
commits
|
||||
$ echo >> subdir/x
|
||||
$ hg debugindex -m --config treemanifest.treeonly=False | tail -1
|
||||
hg debugindex: invalid arguments
|
||||
(use 'hg debugindex -h' to get help)
|
||||
$ hg commit -m 'treeonly from hybrid repo'
|
||||
$ hg log -r . -T '{desc}\n' --stat
|
||||
treeonly from hybrid repo
|
||||
@ -211,9 +204,6 @@ commits
|
||||
subdir/x | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
$ hg debugindex -m --config treemanifest.treeonly=False | tail -1
|
||||
hg debugindex: invalid arguments
|
||||
(use 'hg debugindex -h' to get help)
|
||||
$ hg debugstrip -r .
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user