verify: use some intermediate variables instead of a multi-liner
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 01 Jun 2021 09:18:20 +0200
changeset 47369 041d6515bb0f
parent 47368 1a0f177b300a
child 47370 ab5fd39cb402
verify: use some intermediate variables instead of a multi-liner 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. Differential Revision: https://phab.mercurial-scm.org/D10821
mercurial/verify.py
--- a/mercurial/verify.py	Tue Jun 01 09:14:58 2021 +0200
+++ b/mercurial/verify.py	Tue Jun 01 09:18:20 2021 +0200
@@ -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: