Mercurial > hg
changeset 27642:f6457349985b
verify: move checklog() onto class
This is part of an effort to make verify more modular so extensions can hook
into it.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 05 Jan 2016 17:08:14 -0800 |
parents | 8d0a09162d0f |
children | 62ce86fcfd06 |
files | mercurial/verify.py |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/verify.py Thu Dec 31 17:41:59 2015 +0000 +++ b/mercurial/verify.py Tue Jan 05 17:08:14 2016 -0800 @@ -80,6 +80,23 @@ inst = repr(inst) self.err(linkrev, "%s: %s" % (msg, inst), filename) + def checklog(self, obj, name, linkrev): + if not len(obj) and (self.havecl or self.havemf): + self.err(linkrev, _("empty or missing %s") % name) + return + + d = obj.checksize() + if d[0]: + self.err(None, _("data length off by %d bytes") % d[0], name) + if d[1]: + self.err(None, _("index contains %d extra bytes") % d[1], name) + + if obj.version != revlog.REVLOGV0: + if not self.revlogv1: + self.warn(_("warning: `%s' uses revlog format 1") % name) + elif self.revlogv1: + self.warn(_("warning: `%s' uses revlog format 0") % name) + def verify(self): repo = self.repo mflinkrevs = {} @@ -95,23 +112,6 @@ if not repo.url().startswith('file:'): raise error.Abort(_("cannot verify bundle or remote repos")) - def checklog(obj, name, linkrev): - if not len(obj) and (havecl or havemf): - self.err(linkrev, _("empty or missing %s") % name) - return - - d = obj.checksize() - if d[0]: - self.err(None, _("data length off by %d bytes") % d[0], name) - if d[1]: - self.err(None, _("index contains %d extra bytes") % d[1], name) - - if obj.version != revlog.REVLOGV0: - if not revlogv1: - self.warn(_("warning: `%s' uses revlog format 1") % name) - elif revlogv1: - self.warn(_("warning: `%s' uses revlog format 0") % name) - def checkentry(obj, i, node, seen, linkrevs, f): lr = obj.linkrev(obj.rev(node)) if lr < 0 or (havecl and lr not in linkrevs): @@ -162,7 +162,7 @@ ui.status(_("checking changesets\n")) seen = {} - checklog(cl, "changelog", 0) + self.checklog(cl, "changelog", 0) total = len(repo) for i in repo: ui.progress(_('checking'), i, total=total, unit=_('changesets')) @@ -187,7 +187,7 @@ if self.refersmf: # Do not check manifest if there are only changelog entries with # null manifests. - checklog(mf, "manifest", 0) + self.checklog(mf, "manifest", 0) total = len(mf) for i in mf: ui.progress(_('checking'), i, total=total, unit=_('manifests')) @@ -283,7 +283,7 @@ self.warn(_(" warning: revlog '%s' not in fncache!") % ff) self.fncachewarned = True - checklog(fl, f, lr) + self.checklog(fl, f, lr) seen = {} rp = None for i in fl: