treemanifest: strip trees from revlog even in treeonly mode

Summary:
On the server, once we enter treeonly mode we still want to be able to
strip trees from the revlog.

Reviewed By: quark-zju

Differential Revision: D10248895

fbshipit-source-id: 15faec870370d4c28f6a83058eb1bf19cb414d29
This commit is contained in:
Durham Goode 2018-10-09 07:53:24 -07:00 committed by Facebook Github Bot
parent 6370e8882b
commit 589f254150
2 changed files with 12 additions and 3 deletions

View File

@ -323,6 +323,7 @@ def _collectmanifest(orig, repo, striprev):
def stripmanifest(orig, repo, striprev, tr, files):
if treeenabled(repo.ui) and repo.ui.configbool("treemanifest", "treeonly"):
repair.striptrees(repo, tr, striprev, files)
return
orig(repo, striprev, tr, files)
@ -2528,7 +2529,15 @@ def striptrees(orig, repo, tr, striprev, files):
return orig(repo, tr, striprev, files)
if repo.ui.configbool("treemanifest", "server"):
treerevlog = repo.manifestlog.treemanifestlog._revlog
mfl = repo.manifestlog
if isinstance(mfl, hybridmanifestlog):
treemfl = repo.manifestlog.treemanifestlog
elif isinstance(mfl, treemanifestlog):
treemfl = mfl
else:
raise RuntimeError("cannot strip trees from %s type manifestlog" % mfl)
treerevlog = treemfl._revlog
for dir in util.dirs(files):
# If the revlog doesn't exist, this returns an empty revlog and is a
# no-op.

View File

@ -452,6 +452,6 @@ Stripping in a treeonly server
$ hg strip -r tip --config treemanifest.blocksendflat=False
saved backup bundle to $TESTTMP/master/.hg/strip-backup/ab5f5b4a91cf-cb006139-backup.hg
$ ls -l .hg/store/meta/subdir2/00manifest.i
* 216 * .hg/store/meta/subdir2/00manifest.i (glob)
* 108 * .hg/store/meta/subdir2/00manifest.i (glob)
$ ls -l .hg/store/00manifesttree.i
* 366 * .hg/store/00manifesttree.i (glob)
* 240 * .hg/store/00manifesttree.i (glob)