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.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/verify.py (14 lines) |
| 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 |
| 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 = _( | WARN_UNKNOWN_COPY_SOURCE = _( | ||||
| b"warning: copy source of '%s' not in parents of %s" | 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): | 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 | ||||
| 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(WARN_UNKNOWN_COPY_SOURCE % (f, ctx)) | self._warn(WARN_UNKNOWN_COPY_SOURCE % (f, ctx)) | ||||
| fl2 = repo.file(rp[0]) | fl2 = repo.file(rp[0]) | ||||
| if not len(fl2): | if not len(fl2): | ||||
| m = _(b"empty or missing copy source revlog %s:%s") | m = _(b"empty or missing copy source revlog %s:%s") | ||||
| self._err(lr, m % (rp[0], short(rp[1])), f) | self._err(lr, m % (rp[0], short(rp[1])), f) | ||||
| elif rp[1] == self.repo.nullid: | elif rp[1] == self.repo.nullid: | ||||
| ui.note( | msg = WARN_NULLID_COPY_SOURCE | ||||
| _( | msg %= (f, lr, rp[0], short(rp[1])) | ||||
| b"warning: %s@%s: copy source" | ui.note(msg) | ||||
| b" revision is nullid %s:%s\n" | |||||
| ) | |||||
| % (f, lr, rp[0], short(rp[1])) | |||||
| ) | |||||
| else: | else: | ||||
| fl2.rev(rp[1]) | fl2.rev(rp[1]) | ||||
| except Exception as inst: | except Exception as inst: | ||||
| self._exc( | self._exc( | ||||
| lr, _(b"checking rename of %s") % short(n), inst, f | lr, _(b"checking rename of %s") % short(n), inst, f | ||||
| ) | ) | ||||
| # cross-check | # cross-check | ||||