Mercurial > public > mercurial-scm > hg
comparison mercurial/verify.py @ 47369:041d6515bb0f
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 01 Jun 2021 09:18:20 +0200 |
parents | 1a0f177b300a |
children | ab5fd39cb402 |
comparison
equal
deleted
inserted
replaced
47368:1a0f177b300a | 47369:041d6515bb0f |
---|---|
46 b"parent-directory manifest refers to unknown revision %s" | 46 b"parent-directory manifest refers to unknown revision %s" |
47 ) | 47 ) |
48 | 48 |
49 WARN_UNKNOWN_COPY_SOURCE = _( | 49 WARN_UNKNOWN_COPY_SOURCE = _( |
50 b"warning: copy source of '%s' not in parents of %s" | 50 b"warning: copy source of '%s' not in parents of %s" |
51 ) | |
52 | |
53 WARN_NULLID_COPY_SOURCE = _( | |
54 b"warning: %s@%s: copy source revision is nullid %s:%s\n" | |
51 ) | 55 ) |
52 | 56 |
53 | 57 |
54 class verifier(object): | 58 class verifier(object): |
55 def __init__(self, repo, level=None): | 59 def __init__(self, repo, level=None): |
555 fl2 = repo.file(rp[0]) | 559 fl2 = repo.file(rp[0]) |
556 if not len(fl2): | 560 if not len(fl2): |
557 m = _(b"empty or missing copy source revlog %s:%s") | 561 m = _(b"empty or missing copy source revlog %s:%s") |
558 self._err(lr, m % (rp[0], short(rp[1])), f) | 562 self._err(lr, m % (rp[0], short(rp[1])), f) |
559 elif rp[1] == self.repo.nullid: | 563 elif rp[1] == self.repo.nullid: |
560 ui.note( | 564 msg = WARN_NULLID_COPY_SOURCE |
561 _( | 565 msg %= (f, lr, rp[0], short(rp[1])) |
562 b"warning: %s@%s: copy source" | 566 ui.note(msg) |
563 b" revision is nullid %s:%s\n" | |
564 ) | |
565 % (f, lr, rp[0], short(rp[1])) | |
566 ) | |
567 else: | 567 else: |
568 fl2.rev(rp[1]) | 568 fl2.rev(rp[1]) |
569 except Exception as inst: | 569 except Exception as inst: |
570 self._exc( | 570 self._exc( |
571 lr, _(b"checking rename of %s") % short(n), inst, f | 571 lr, _(b"checking rename of %s") % short(n), inst, f |