comparison mercurial/dirstate.py @ 49827:d09a57ce6fc4

verify: print short `p1` node in relevant dirstate messages This will help with debugging.
author Raphaël Gomès <rgomes@octobus.net>
date Wed, 21 Dec 2022 12:26:00 +0100
parents fdd227585d5a
children 96e526fe5fb0
comparison
equal deleted inserted replaced
49826:c84844cd523a 49827:d09a57ce6fc4
1538 o.unlink(backupname) 1538 o.unlink(backupname)
1539 1539
1540 if data_backup is not None: 1540 if data_backup is not None:
1541 o.unlink(data_backup[0]) 1541 o.unlink(data_backup[0])
1542 1542
1543 def verify(self, m1, m2, narrow_matcher=None): 1543 def verify(self, m1, m2, p1, narrow_matcher=None):
1544 """ 1544 """
1545 check the dirstate contents against the parent manifest and yield errors 1545 check the dirstate contents against the parent manifest and yield errors
1546 """ 1546 """
1547 missing_from_p1 = _( 1547 missing_from_p1 = _(
1548 b"%s marked as tracked in p1 but not in manifest1\n" 1548 b"%s marked as tracked in p1 (%s) but not in manifest1\n"
1549 ) 1549 )
1550 unexpected_in_p1 = _(b"%s marked as added, but also in manifest1\n") 1550 unexpected_in_p1 = _(b"%s marked as added, but also in manifest1\n")
1551 missing_from_ps = _( 1551 missing_from_ps = _(
1552 b"%s marked as modified, but not in either manifest\n" 1552 b"%s marked as modified, but not in either manifest\n"
1553 ) 1553 )
1554 missing_from_ds = _( 1554 missing_from_ds = _(
1555 b"%s in manifest1, but not marked as tracked in p1\n" 1555 b"%s in manifest1, but not marked as tracked in p1 (%s)\n"
1556 ) 1556 )
1557 for f, entry in self.items(): 1557 for f, entry in self.items():
1558 if entry.p1_tracked: 1558 if entry.p1_tracked:
1559 if entry.modified and f not in m1 and f not in m2: 1559 if entry.modified and f not in m1 and f not in m2:
1560 yield missing_from_ps % f 1560 yield missing_from_ps % f
1561 elif f not in m1: 1561 elif f not in m1:
1562 yield missing_from_p1 % f 1562 yield missing_from_p1 % (f, node.short(p1))
1563 if entry.added and f in m1: 1563 if entry.added and f in m1:
1564 yield unexpected_in_p1 % f 1564 yield unexpected_in_p1 % f
1565 for f in m1: 1565 for f in m1:
1566 if narrow_matcher is not None and not narrow_matcher(f): 1566 if narrow_matcher is not None and not narrow_matcher(f):
1567 continue 1567 continue
1568 entry = self.get_entry(f) 1568 entry = self.get_entry(f)
1569 if not entry.p1_tracked: 1569 if not entry.p1_tracked:
1570 yield missing_from_ds % f 1570 yield missing_from_ds % (f, node.short(p1))