mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
doctor: skip unknown visibleheads format
Summary: When I run `hg doctor` in my www checkout it fails the assertion check of the first line of visibleheads is "v1". Make it graceful so doctor can check and fix other components. Reviewed By: DurhamG Differential Revision: D20147969 fbshipit-source-id: 6aee2cab962fcd0ef06a0611d288021e86621249
This commit is contained in:
parent
7e0c6397c4
commit
5ba323af16
@ -239,7 +239,10 @@ def repairvisibleheads(ui, metalog, cl):
|
||||
"""Attempt to fix visibleheads by removing invalid commit hashes"""
|
||||
oldtext = decodeutf8(metalog.get("visibleheads") or b"")
|
||||
oldlines = oldtext.splitlines()
|
||||
assert oldlines[0] == "v1"
|
||||
# Only support v1 right now.
|
||||
if oldlines[0:1] != ["v1"]:
|
||||
ui.write_err(_("visibleheads: skipped\n"))
|
||||
return
|
||||
nodemap = cl.nodemap
|
||||
newlines = [oldlines[0]] + [
|
||||
hexnode
|
||||
|
@ -119,6 +119,23 @@ Check changelog repiar:
|
||||
|
||||
$ hg status
|
||||
|
||||
Check unknown visibleheads format:
|
||||
|
||||
$ newrepo
|
||||
$ hg dbsh << 'EOS'
|
||||
> ml = repo.svfs.metalog
|
||||
> ml.set("visibleheads", "v-1")
|
||||
> ml.commit("break visibleheads")
|
||||
> EOS
|
||||
$ hg doctor
|
||||
checking internal storage
|
||||
mutation: looks okay
|
||||
changelog: looks okay
|
||||
metalog: looks okay
|
||||
visibleheads: skipped
|
||||
treestate: looks okay
|
||||
allheads: looks okay
|
||||
|
||||
Check dirstate pointing to a stripped commit:
|
||||
|
||||
$ newrepo
|
||||
@ -203,4 +220,14 @@ Try other kinds of dirstate corruptions:
|
||||
visibleheads: looks okay
|
||||
treestate: repaired
|
||||
allheads: looks okay
|
||||
$ hg status
|
||||
M A2
|
||||
A A0
|
||||
A X
|
||||
R A
|
||||
R A1
|
||||
? B
|
||||
? C
|
||||
? Y
|
||||
? Z
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user