comparison mercurial/debugcommands.py @ 49921:c84844cd523a

verify: also check dirstate The dirstate already is capable of verifying its integrity (although v2 features are not yet checked), let's run that code in `hg verify`.
author Rapha?l Gom?s <rgomes@octobus.net>
date Mon, 02 May 2022 11:27:20 +0200
parents fdd227585d5a
children 88b81dc2d82b
comparison
equal deleted inserted replaced
49920:2f2682f40ea0 49921:c84844cd523a
85 templater, 85 templater,
86 treediscovery, 86 treediscovery,
87 upgrade, 87 upgrade,
88 url as urlmod, 88 url as urlmod,
89 util, 89 util,
90 verify,
90 vfs as vfsmod, 91 vfs as vfsmod,
91 wireprotoframing, 92 wireprotoframing,
92 wireprotoserver, 93 wireprotoserver,
93 ) 94 )
94 from .interfaces import repository 95 from .interfaces import repository
552 553
553 554
554 @command(b'debugcheckstate', [], b'') 555 @command(b'debugcheckstate', [], b'')
555 def debugcheckstate(ui, repo): 556 def debugcheckstate(ui, repo):
556 """validate the correctness of the current dirstate""" 557 """validate the correctness of the current dirstate"""
557 parent1, parent2 = repo.dirstate.parents() 558 errors = verify.verifier(repo)._verify_dirstate()
558 m1 = repo[parent1].manifest()
559 m2 = repo[parent2].manifest()
560 errors = 0
561 for err in repo.dirstate.verify(m1, m2):
562 ui.warn(err)
563 errors += 1
564 if errors: 559 if errors:
565 errstr = _(b".hg/dirstate inconsistent with current parent's manifest") 560 errstr = _(b"dirstate inconsistent with current parent's manifest")
566 raise error.Abort(errstr) 561 raise error.Abort(errstr)
567 562
568 563
569 @command( 564 @command(
570 b'debugcolor', 565 b'debugcolor',