dirstate: clarify the message in nonnormal checking
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Sep 2021 00:16:37 +0200
changeset 47943 fea24454f919
parent 47942 9beea3a023ac
child 47944 e02f9af7aed1
dirstate: clarify the message in nonnormal checking The previous message was quite verbose and hard to understand. The new one should be friendlier. Differential Revision: https://phab.mercurial-scm.org/D11382
contrib/dirstatenonnormalcheck.py
--- a/contrib/dirstatenonnormalcheck.py	Wed Sep 08 15:59:48 2021 -0400
+++ b/contrib/dirstatenonnormalcheck.py	Thu Sep 02 00:16:37 2021 +0200
@@ -24,17 +24,27 @@
     return res
 
 
+INCONSISTENCY_MESSAGE = b"""%s call to %s
+  inconsistency in nonnormalset
+  result from dirstatemap: %s
+  expected nonnormalset:   %s
+"""
+
+
 def checkconsistency(ui, orig, dmap, _nonnormalset, label):
     """Compute nonnormalset from dmap, check that it matches _nonnormalset"""
     nonnormalcomputedmap = nonnormalentries(dmap)
     if _nonnormalset != nonnormalcomputedmap:
         b_orig = pycompat.sysbytes(repr(orig))
-        ui.develwarn(b"%s call to %s\n" % (label, b_orig), config=b'dirstate')
-        ui.develwarn(b"inconsistency in nonnormalset\n", config=b'dirstate')
         b_nonnormal = pycompat.sysbytes(repr(_nonnormalset))
-        ui.develwarn(b"[nonnormalset] %s\n" % b_nonnormal, config=b'dirstate')
         b_nonnormalcomputed = pycompat.sysbytes(repr(nonnormalcomputedmap))
-        ui.develwarn(b"[map] %s\n" % b_nonnormalcomputed, config=b'dirstate')
+        msg = INCONSISTENCY_MESSAGE % (
+            label,
+            b_orig,
+            b_nonnormal,
+            b_nonnormalcomputed,
+        )
+        ui.develwarn(msg, config=b'dirstate')
 
 
 def _checkdirstate(orig, self, *args, **kwargs):