diff mercurial/debugcommands.py @ 48101: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 cedfe2606adf
children 78e66649cdb3
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Sep 29 14:52:44 2021 +0200
+++ b/mercurial/debugcommands.py	Thu Sep 30 12:00:15 2021 +0200
@@ -550,24 +550,9 @@
     m1 = repo[parent1].manifest()
     m2 = repo[parent2].manifest()
     errors = 0
-    for f in repo.dirstate:
-        state = repo.dirstate[f]
-        if state in b"nr" and f not in m1:
-            ui.warn(_(b"%s in state %s, but not in manifest1\n") % (f, state))
-            errors += 1
-        if state in b"a" and f in m1:
-            ui.warn(_(b"%s in state %s, but also in manifest1\n") % (f, state))
-            errors += 1
-        if state in b"m" and f not in m1 and f not in m2:
-            ui.warn(
-                _(b"%s in state %s, but not in either manifest\n") % (f, state)
-            )
-            errors += 1
-    for f in m1:
-        state = repo.dirstate[f]
-        if state not in b"nrm":
-            ui.warn(_(b"%s in manifest1, but listed as state %s") % (f, state))
-            errors += 1
+    for err in repo.dirstate.verify(m1, m2):
+        ui.warn(err[0] % err[1:])
+        errors += 1
     if errors:
         errstr = _(b".hg/dirstate inconsistent with current parent's manifest")
         raise error.Abort(errstr)