comparison mercurial/dirstate.py @ 48089:c87844960a35

dirstate: move verification code within the dirstate itself This move implementation details further down the stack and make it the verification code easier to discover. Differential Revision: https://phab.mercurial-scm.org/D11526
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 30 Sep 2021 12:00:15 +0200
parents 6a78715e56c8
children dcd97b082b3b
comparison
equal deleted inserted replaced
48088:418611f18fd8 48089:c87844960a35
1523 o.rename(backupname, filename, checkambig=True) 1523 o.rename(backupname, filename, checkambig=True)
1524 1524
1525 def clearbackup(self, tr, backupname): 1525 def clearbackup(self, tr, backupname):
1526 '''Clear backup file''' 1526 '''Clear backup file'''
1527 self._opener.unlink(backupname) 1527 self._opener.unlink(backupname)
1528
1529 def verify(self, m1, m2):
1530 """check the dirstate content again the parent manifest and yield errors"""
1531 missing_from_p1 = b"%s in state %s, but not in manifest1\n"
1532 unexpected_in_p1 = b"%s in state %s, but also in manifest1\n"
1533 missing_from_ps = b"%s in state %s, but not in either manifest\n"
1534 missing_from_ds = b"%s in manifest1, but listed as state %s\n"
1535 for f, entry in self.items():
1536 state = entry.state
1537 if state in b"nr" and f not in m1:
1538 yield (missing_from_p1, f, state)
1539 if state in b"a" and f in m1:
1540 yield (unexpected_in_p1, f, state)
1541 if state in b"m" and f not in m1 and f not in m2:
1542 yield (missing_from_ps, f, state)
1543 for f in m1:
1544 state = self.get_entry(f).state
1545 if state not in b"nrm":
1546 yield (missing_from_ds, f, state)