Show More
@@ -550,24 +550,9 b' def debugcheckstate(ui, repo):' | |||||
550 | m1 = repo[parent1].manifest() |
|
550 | m1 = repo[parent1].manifest() | |
551 | m2 = repo[parent2].manifest() |
|
551 | m2 = repo[parent2].manifest() | |
552 | errors = 0 |
|
552 | errors = 0 | |
553 |
for |
|
553 | for err in repo.dirstate.verify(m1, m2): | |
554 | state = repo.dirstate[f] |
|
554 | ui.warn(err[0] % err[1:]) | |
555 | if state in b"nr" and f not in m1: |
|
555 | errors += 1 | |
556 | ui.warn(_(b"%s in state %s, but not in manifest1\n") % (f, state)) |
|
|||
557 | errors += 1 |
|
|||
558 | if state in b"a" and f in m1: |
|
|||
559 | ui.warn(_(b"%s in state %s, but also in manifest1\n") % (f, state)) |
|
|||
560 | errors += 1 |
|
|||
561 | if state in b"m" and f not in m1 and f not in m2: |
|
|||
562 | ui.warn( |
|
|||
563 | _(b"%s in state %s, but not in either manifest\n") % (f, state) |
|
|||
564 | ) |
|
|||
565 | errors += 1 |
|
|||
566 | for f in m1: |
|
|||
567 | state = repo.dirstate[f] |
|
|||
568 | if state not in b"nrm": |
|
|||
569 | ui.warn(_(b"%s in manifest1, but listed as state %s") % (f, state)) |
|
|||
570 | errors += 1 |
|
|||
571 | if errors: |
|
556 | if errors: | |
572 | errstr = _(b".hg/dirstate inconsistent with current parent's manifest") |
|
557 | errstr = _(b".hg/dirstate inconsistent with current parent's manifest") | |
573 | raise error.Abort(errstr) |
|
558 | raise error.Abort(errstr) |
@@ -1525,3 +1525,22 b' class dirstate(object):' | |||||
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) |
General Comments 0
You need to be logged in to leave comments.
Login now