[Request] [+ ] D10821: verify: use some intermediate variables instead of a multi-liner
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Tue Jun 1 09:55:13 UTC 2021
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
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:
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210601/af96ee8d/attachment-0001.html>
More information about the Mercurial-patches
mailing list