Patchwork D11382: dirstate: clarify the message in nonnormal checking

login
register
mail settings
Submitter phabricator
Date Sept. 1, 2021, 11:35 p.m.
Message ID <differential-rev-PHID-DREV-svrpztlkjxiztwtfy2so-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49698/
State Superseded
Headers show

Comments

phabricator - Sept. 1, 2021, 11:35 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The previous message was quite verbose and hard to understand. The new one
  should be friendlier.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11382

AFFECTED FILES
  contrib/dirstatenonnormalcheck.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/contrib/dirstatenonnormalcheck.py b/contrib/dirstatenonnormalcheck.py
--- a/contrib/dirstatenonnormalcheck.py
+++ b/contrib/dirstatenonnormalcheck.py
@@ -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):