Patchwork D10821: verify: use some intermediate variables instead of a multi-liner

login
register
mail settings
Submitter phabricator
Date June 1, 2021, 9:55 a.m.
Message ID <differential-rev-PHID-DREV-e4nqluvddp6637bcmfe4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49141/
State Superseded
Headers show

Comments

phabricator - June 1, 2021, 9:55 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is shorter and easier to read as the indentation remains the same.
  
  We extract the long message in a module level constant for clarity.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/verify.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -50,6 +50,10 @@ 
     b"warning: copy source of '%s' not in parents of %s"
 )
 
+WARN_NULLID_COPY_SOURCE = _(
+    b"warning: %s@%s: copy source revision is nullid %s:%s\n"
+)
+
 
 class verifier(object):
     def __init__(self, repo, level=None):
@@ -557,13 +561,9 @@ 
                             m = _(b"empty or missing copy source revlog %s:%s")
                             self._err(lr, m % (rp[0], short(rp[1])), f)
                         elif rp[1] == self.repo.nullid:
-                            ui.note(
-                                _(
-                                    b"warning: %s@%s: copy source"
-                                    b" revision is nullid %s:%s\n"
-                                )
-                                % (f, lr, rp[0], short(rp[1]))
-                            )
+                            msg = WARN_NULLID_COPY_SOURCE
+                            msg %= (f, lr, rp[0], short(rp[1]))
+                            ui.note(msg)
                         else:
                             fl2.rev(rp[1])
                 except Exception as inst: