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 |
---|---|---|---|---|
635e355e5327 | e0d3b72c0867 | Pierre-Yves David | Jun 1 2021, 3:03 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 |
def _normpath(f): | def _normpath(f): | ||||
# under hg < 2.4, convert didn't sanitize paths properly, so a | # under hg < 2.4, convert didn't sanitize paths properly, so a | ||||
# converted repo may contain repeated slashes | # converted repo may contain repeated slashes | ||||
while b'//' in f: | while b'//' in f: | ||||
f = f.replace(b'//', b'/') | f = f.replace(b'//', b'/') | ||||
return f | return f | ||||
HINT_FNCACHE = _( | |||||
b'hint: run "hg debugrebuildfncache" to recover from corrupt fncache\n' | |||||
) | |||||
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 | ||||
self._level = level | self._level = level | ||||
# final report | # final report | ||||
ui.status( | ui.status( | ||||
_(b"checked %d changesets with %d changes to %d files\n") | _(b"checked %d changesets with %d changes to %d files\n") | ||||
% (len(repo.changelog), filerevisions, totalfiles) | % (len(repo.changelog), filerevisions, totalfiles) | ||||
) | ) | ||||
if self.warnings: | if self.warnings: | ||||
ui.warn(_(b"%d warnings encountered!\n") % self.warnings) | ui.warn(_(b"%d warnings encountered!\n") % self.warnings) | ||||
if self.fncachewarned: | if self.fncachewarned: | ||||
ui.warn( | ui.warn(HINT_FNCACHE) | ||||
_( | |||||
b'hint: run "hg debugrebuildfncache" to recover from ' | |||||
b'corrupt fncache\n' | |||||
) | |||||
) | |||||
if self.errors: | if self.errors: | ||||
ui.warn(_(b"%d integrity errors encountered!\n") % self.errors) | ui.warn(_(b"%d integrity errors encountered!\n") % self.errors) | ||||
if self.badrevs: | if self.badrevs: | ||||
ui.warn( | ui.warn( | ||||
_(b"(first damaged changeset appears to be %d)\n") | _(b"(first damaged changeset appears to be %d)\n") | ||||
% min(self.badrevs) | % min(self.badrevs) | ||||
) | ) | ||||
return 1 | return 1 |