changeset 49922: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 c84844cd523a
children 9854a9adc466
files mercurial/dirstate.py mercurial/verify.py tests/test-verify.t
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Mon May 02 11:27:20 2022 +0200
+++ b/mercurial/dirstate.py	Wed Dec 21 12:26:00 2022 +0100
@@ -1540,26 +1540,26 @@
         if data_backup is not None:
             o.unlink(data_backup[0])
 
-    def verify(self, m1, m2, narrow_matcher=None):
+    def verify(self, m1, m2, p1, narrow_matcher=None):
         """
         check the dirstate contents against the parent manifest and yield errors
         """
         missing_from_p1 = _(
-            b"%s marked as tracked in p1 but not in manifest1\n"
+            b"%s marked as tracked in p1 (%s) but not in manifest1\n"
         )
         unexpected_in_p1 = _(b"%s marked as added, but also in manifest1\n")
         missing_from_ps = _(
             b"%s marked as modified, but not in either manifest\n"
         )
         missing_from_ds = _(
-            b"%s in manifest1, but not marked as tracked in p1\n"
+            b"%s in manifest1, but not marked as tracked in p1 (%s)\n"
         )
         for f, entry in self.items():
             if entry.p1_tracked:
                 if entry.modified and f not in m1 and f not in m2:
                     yield missing_from_ps % f
                 elif f not in m1:
-                    yield missing_from_p1 % f
+                    yield missing_from_p1 % (f, node.short(p1))
             if entry.added and f in m1:
                 yield unexpected_in_p1 % f
         for f in m1:
@@ -1567,4 +1567,4 @@
                 continue
             entry = self.get_entry(f)
             if not entry.p1_tracked:
-                yield missing_from_ds % f
+                yield missing_from_ds % (f, node.short(p1))
--- a/mercurial/verify.py	Mon May 02 11:27:20 2022 +0200
+++ b/mercurial/verify.py	Wed Dec 21 12:26:00 2022 +0100
@@ -612,7 +612,7 @@
         is_narrow = requirements.NARROW_REQUIREMENT in repo.requirements
         narrow_matcher = repo.narrowmatch() if is_narrow else None
 
-        for err in repo.dirstate.verify(m1, m2, narrow_matcher):
+        for err in repo.dirstate.verify(m1, m2, parent1, narrow_matcher):
             ui.error(err)
             dirstate_errors += 1
 
--- a/tests/test-verify.t	Mon May 02 11:27:20 2022 +0200
+++ b/tests/test-verify.t	Wed Dec 21 12:26:00 2022 +0100
@@ -126,7 +126,7 @@
   $ hg verify -q
   warning: orphan data file 'data/file.i'
   warning: ignoring unknown working parent c5ddb05ab828!
-  file marked as tracked in p1 but not in manifest1
+  file marked as tracked in p1 (000000000000) but not in manifest1
   1 warnings encountered!
   1 integrity errors encountered!
   dirstate inconsistent with current parent's manifest