doctor: provide svfs.metalog

Summary:
In a future change we'll require `svfs.metalog`. Let's move metalog fix to
before other stuff and attach fixed metalog to `svfs`.

Reviewed By: markbt

Differential Revision: D30974285

fbshipit-source-id: 3be89d1f1cda3d29dd5746940959ee47c1dd674d
This commit is contained in:
Jun Wu 2021-09-24 10:56:54 -07:00 committed by Facebook GitHub Bot
parent 47fe779b2b
commit 10e7ff0d3e
2 changed files with 16 additions and 13 deletions

View File

@ -70,6 +70,10 @@ def doctor(ui, **opts):
svfs = vfsmod.vfs(os.path.join(sharedhgpath, "store"))
ui.write(_("checking internal storage\n"))
ml = repairsvfs(ui, svfs, "metalog", metalog.metalog)
svfs.metalog = ml
if ui.configbool("mutation", "enabled"):
repairsvfs(ui, svfs, "mutation", mutationstore.mutationstore)
@ -85,7 +89,6 @@ def doctor(ui, **opts):
ui.write_err(_("changelog: cannot fix automatically (consider reclone)\n"))
return 1
ml = repairsvfs(ui, svfs, "metalog", metalog.metalog)
repairvisibleheads(ui, ml, cl)
repairtreestate(ui, vfs, repopath, cl)

View File

@ -66,18 +66,6 @@ Test that 'hg doctor' can fix them:
$ hg doctor -v
checking internal storage
mutation:
Processing IndexedLog: Filesystem(*) (glob)
Fixed header in log
Extended log to 82 bytes required by meta
Verified first 0 entries, 12 of 82 bytes in log
Backed up corrupted log to "*" (glob)
Reset log size to 12
Rebuilt index "pred"
Rebuilt index "succ"
Rebuilt index "split"
metalog:
Checking blobs at "*": (glob)
Processing IndexedLog: Filesystem("*") (glob)
@ -94,6 +82,18 @@ Test that 'hg doctor' can fix them:
All Roots are verified.
mutation:
Processing IndexedLog: Filesystem("*") (glob)
Fixed header in log
Extended log to 82 bytes required by meta
Verified first 0 entries, 12 of 82 bytes in log
Backed up corrupted log to "*" (glob)
Reset log size to 12
Rebuilt index "pred"
Rebuilt index "succ"
Rebuilt index "split"
allheads:
Processing IndexedLog: Filesystem("*") (glob)
Rebuilt metadata