mercurial/verify.py
branchstable
changeset 49366 288de6f5d724
parent 48946 642e31cb55f0
child 49826 c84844cd523a
equal deleted inserted replaced
49364:e8ea403b1c46 49366:288de6f5d724
     3 # Copyright 2006, 2007 Olivia Mackall <olivia@selenic.com>
     3 # Copyright 2006, 2007 Olivia Mackall <olivia@selenic.com>
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from __future__ import absolute_import
       
     9 
     8 
    10 import os
     9 import os
    11 
    10 
    12 from .i18n import _
    11 from .i18n import _
    13 from .node import short
    12 from .node import short
    53 WARN_NULLID_COPY_SOURCE = _(
    52 WARN_NULLID_COPY_SOURCE = _(
    54     b"warning: %s@%s: copy source revision is nullid %s:%s\n"
    53     b"warning: %s@%s: copy source revision is nullid %s:%s\n"
    55 )
    54 )
    56 
    55 
    57 
    56 
    58 class verifier(object):
    57 class verifier:
    59     def __init__(self, repo, level=None):
    58     def __init__(self, repo, level=None):
    60         self.repo = repo.unfiltered()
    59         self.repo = repo.unfiltered()
    61         self.ui = repo.ui
    60         self.ui = repo.ui
    62         self.match = repo.narrowmatch()
    61         self.match = repo.narrowmatch()
    63         if level is None:
    62         if level is None:
   404                 self._err(None, _(b"cannot decode filename '%s'") % f)
   403                 self._err(None, _(b"cannot decode filename '%s'") % f)
   405             subdirprogress = ui.makeprogress(
   404             subdirprogress = ui.makeprogress(
   406                 _(b'checking'), unit=_(b'manifests'), total=len(subdirs)
   405                 _(b'checking'), unit=_(b'manifests'), total=len(subdirs)
   407             )
   406             )
   408 
   407 
   409         for subdir, linkrevs in pycompat.iteritems(subdirnodes):
   408         for subdir, linkrevs in subdirnodes.items():
   410             subdirfilenodes = self._verifymanifest(
   409             subdirfilenodes = self._verifymanifest(
   411                 linkrevs, subdir, storefiles, subdirprogress
   410                 linkrevs, subdir, storefiles, subdirprogress
   412             )
   411             )
   413             for f, onefilenodes in pycompat.iteritems(subdirfilenodes):
   412             for f, onefilenodes in subdirfilenodes.items():
   414                 filenodes.setdefault(f, {}).update(onefilenodes)
   413                 filenodes.setdefault(f, {}).update(onefilenodes)
   415 
   414 
   416         if not dir and subdirnodes:
   415         if not dir and subdirnodes:
   417             assert subdirprogress is not None  # help pytype
   416             assert subdirprogress is not None  # help pytype
   418             subdirprogress.complete()
   417             subdirprogress.complete()
   573                         lr, _(b"checking rename of %s") % short(n), inst, f
   572                         lr, _(b"checking rename of %s") % short(n), inst, f
   574                     )
   573                     )
   575 
   574 
   576             # cross-check
   575             # cross-check
   577             if f in filenodes:
   576             if f in filenodes:
   578                 fns = [(v, k) for k, v in pycompat.iteritems(filenodes[f])]
   577                 fns = [(v, k) for k, v in filenodes[f].items()]
   579                 for lr, node in sorted(fns):
   578                 for lr, node in sorted(fns):
   580                     msg = _(b"manifest refers to unknown revision %s")
   579                     msg = _(b"manifest refers to unknown revision %s")
   581                     self._err(lr, msg % short(node), f)
   580                     self._err(lr, msg % short(node), f)
   582         progress.complete()
   581         progress.complete()
   583 
   582