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.
hg-reviewers |
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.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/verify.py (12 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
4d6ab6d786f9 | 05521b9534d4 | Pierre-Yves David | Jun 1 2021, 3:13 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | D10805 verify: align a comment line |
HINT_FNCACHE = _( | HINT_FNCACHE = _( | ||||
b'hint: run "hg debugrebuildfncache" to recover from corrupt fncache\n' | b'hint: run "hg debugrebuildfncache" to recover from corrupt fncache\n' | ||||
) | ) | ||||
WARN_PARENT_DIR_UNKNOWN_REV = _( | WARN_PARENT_DIR_UNKNOWN_REV = _( | ||||
b"parent-directory manifest refers to unknown revision %s" | b"parent-directory manifest refers to unknown revision %s" | ||||
) | ) | ||||
WARN_UNKNOWN_COPY_SOURCE = _( | |||||
b"warning: copy source of '%s' not in parents of %s" | |||||
) | |||||
class verifier(object): | class verifier(object): | ||||
def __init__(self, repo, level=None): | def __init__(self, repo, level=None): | ||||
self.repo = repo.unfiltered() | self.repo = repo.unfiltered() | ||||
self.ui = repo.ui | self.ui = repo.ui | ||||
self.match = repo.narrowmatch() | self.match = repo.narrowmatch() | ||||
if level is None: | if level is None: | ||||
level = VERIFY_DEFAULT | level = VERIFY_DEFAULT | ||||
# though not with LFS revisions). We may want | # though not with LFS revisions). We may want | ||||
# ``verifyintegrity()`` to pass a set of nodes with | # ``verifyintegrity()`` to pass a set of nodes with | ||||
# rename metadata as an optimization. | # rename metadata as an optimization. | ||||
rp = fl.renamed(n) | rp = fl.renamed(n) | ||||
if rp: | if rp: | ||||
if lr is not None and ui.verbose: | if lr is not None and ui.verbose: | ||||
ctx = lrugetctx(lr) | ctx = lrugetctx(lr) | ||||
if not any(rp[0] in pctx for pctx in ctx.parents()): | if not any(rp[0] in pctx for pctx in ctx.parents()): | ||||
self._warn( | self._warn(WARN_UNKNOWN_COPY_SOURCE % (f, ctx)) | ||||
_( | |||||
b"warning: copy source of '%s' not" | |||||
b" in parents of %s" | |||||
) | |||||
% (f, ctx) | |||||
) | |||||
fl2 = repo.file(rp[0]) | fl2 = repo.file(rp[0]) | ||||
if not len(fl2): | if not len(fl2): | ||||
self._err( | self._err( | ||||
lr, | lr, | ||||
_( | _( | ||||
b"empty or missing copy source revlog " | b"empty or missing copy source revlog " | ||||
b"%s:%s" | b"%s:%s" | ||||
) | ) |