annotate mercurial/verify.py @ 11161:a2c32edc407b

Merge with i18n
author Matt Mackall <mpm@selenic.com>
date Tue, 11 May 2010 17:12:10 -0500
parents 6ced27d3168a
children 12998fd17fbc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
1 # verify.py - repository integrity checking for Mercurial
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
2 #
4635
63b9d2deed48 Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4395
diff changeset
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
4 #
8225
46293a0c7e9f updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents: 8209
diff changeset
5 # This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 9690
diff changeset
6 # GNU General Public License version 2 or any later version.
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
7
6211
f89fd07fc51d Expand import * to allow Pyflakes to find problems
Joel Rosdahl <joel@rosdahl.net>
parents: 5541
diff changeset
8 from node import nullid, short
3891
6b4127c7d52a Simplify i18n imports
Matt Mackall <mpm@selenic.com>
parents: 3744
diff changeset
9 from i18n import _
9690
b33d70849a20 verify: report existence of journal
Sune Foldager <cryo@cyanite.org>
parents: 9657
diff changeset
10 import os
7832
1fce19b9b011 verify: do not abort on fully corrupted revlog
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7676
diff changeset
11 import revlog, util, error
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
12
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
13 def verify(repo):
4915
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
14 lock = repo.lock()
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
15 try:
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
16 return _verify(repo)
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
17 finally:
8109
496ae1ea4698 switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents: 7926
diff changeset
18 lock.release()
4915
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
19
97b734fb9c6f Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
20 def _verify(repo):
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
21 mflinkrevs = {}
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
22 filelinkrevs = {}
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
23 filenodes = {}
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
24 revisions = 0
8466
afb3e504b558 verify: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8394
diff changeset
25 badrevs = set()
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
26 errors = [0]
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
27 warnings = [0]
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
28 ui = repo.ui
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
29 cl = repo.changelog
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
30 mf = repo.manifest
9657
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
31 lrugetctx = util.lrucachefunc(repo.changectx)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
32
7141
8d1bdaf842de issue 1144: prevent traceback on verify of bundles
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7004
diff changeset
33 if not repo.cancopy():
8d1bdaf842de issue 1144: prevent traceback on verify of bundles
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7004
diff changeset
34 raise util.Abort(_("cannot verify bundle or remote repos"))
8d1bdaf842de issue 1144: prevent traceback on verify of bundles
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7004
diff changeset
35
5313
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
36 def err(linkrev, msg, filename=None):
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
37 if linkrev != None:
8466
afb3e504b558 verify: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8394
diff changeset
38 badrevs.add(linkrev)
5313
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
39 else:
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
40 linkrev = '?'
5313
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
41 msg = "%s: %s" % (linkrev, msg)
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
42 if filename:
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
43 msg = "%s@%s" % (filename, msg)
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
44 ui.warn(" " + msg + "\n")
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
45 errors[0] += 1
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
46
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
47 def exc(linkrev, msg, inst, filename=None):
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
48 if isinstance(inst, KeyboardInterrupt):
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
49 ui.warn(_("interrupted"))
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
50 raise
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
51 err(linkrev, "%s: %s" % (msg, inst), filename)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
52
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
53 def warn(msg):
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
54 ui.warn(msg + "\n")
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
55 warnings[0] += 1
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
56
8292
29540554def8 verify: reference the correct linkrev when a filelog is missing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8291
diff changeset
57 def checklog(obj, name, linkrev):
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
58 if not len(obj) and (havecl or havemf):
8292
29540554def8 verify: reference the correct linkrev when a filelog is missing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8291
diff changeset
59 err(linkrev, _("empty or missing %s") % name)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
60 return
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
61
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
62 d = obj.checksize()
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
63 if d[0]:
5313
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
64 err(None, _("data length off by %d bytes") % d[0], name)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
65 if d[1]:
5313
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
66 err(None, _("index contains %d extra bytes") % d[1], name)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
67
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
68 if obj.version != revlog.REVLOGV0:
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
69 if not revlogv1:
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
70 warn(_("warning: `%s' uses revlog format 1") % name)
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
71 elif revlogv1:
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
72 warn(_("warning: `%s' uses revlog format 0") % name)
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
73
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
74 def checkentry(obj, i, node, seen, linkrevs, f):
7361
9fe97eea5510 linkrev: take a revision number rather than a hash
Matt Mackall <mpm@selenic.com>
parents: 7141
diff changeset
75 lr = obj.linkrev(obj.rev(node))
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
76 if lr < 0 or (havecl and lr not in linkrevs):
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
77 if lr < 0 or lr >= len(cl):
7926
edf2d83a11aa verify, i18n: fix unmarked strings
Wagner Bruna <wbruna@yahoo.com>
parents: 7874
diff changeset
78 msg = _("rev %d points to nonexistent changeset %d")
edf2d83a11aa verify, i18n: fix unmarked strings
Wagner Bruna <wbruna@yahoo.com>
parents: 7874
diff changeset
79 else:
edf2d83a11aa verify, i18n: fix unmarked strings
Wagner Bruna <wbruna@yahoo.com>
parents: 7874
diff changeset
80 msg = _("rev %d points to unexpected changeset %d")
edf2d83a11aa verify, i18n: fix unmarked strings
Wagner Bruna <wbruna@yahoo.com>
parents: 7874
diff changeset
81 err(None, msg % (i, lr), f)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
82 if linkrevs:
9657
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
83 if f and len(linkrevs) > 1:
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
84 try:
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
85 # attempt to filter down to real linkrevs
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
86 linkrevs = [l for l in linkrevs
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
87 if lrugetctx(l)[f].filenode() == node]
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
88 except:
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
89 pass
9198
061eeb602354 coding style: use a space after comma
Martin Geisler <mg@lazybytes.net>
parents: 9033
diff changeset
90 warn(_(" (expected %s)") % " ".join(map(str, linkrevs)))
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
91 lr = None # can't be trusted
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
92
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
93 try:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
94 p1, p2 = obj.parents(node)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
95 if p1 not in seen and p1 != nullid:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
96 err(lr, _("unknown parent 1 %s of %s") %
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
97 (short(p1), short(n)), f)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
98 if p2 not in seen and p2 != nullid:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
99 err(lr, _("unknown parent 2 %s of %s") %
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
100 (short(p2), short(p1)), f)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
101 except Exception, inst:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
102 exc(lr, _("checking parents of %s") % short(node), inst, f)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
103
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
104 if node in seen:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
105 err(lr, _("duplicate revision %d (%d)") % (i, seen[n]), f)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
106 seen[n] = i
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
107 return lr
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
108
9690
b33d70849a20 verify: report existence of journal
Sune Foldager <cryo@cyanite.org>
parents: 9657
diff changeset
109 if os.path.exists(repo.sjoin("journal")):
b33d70849a20 verify: report existence of journal
Sune Foldager <cryo@cyanite.org>
parents: 9657
diff changeset
110 ui.warn(_("abandoned transaction found - run hg recover\n"))
b33d70849a20 verify: report existence of journal
Sune Foldager <cryo@cyanite.org>
parents: 9657
diff changeset
111
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
112 revlogv1 = cl.version != revlog.REVLOGV0
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
113 if ui.verbose or not revlogv1:
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
114 ui.status(_("repository uses revlog format %d\n") %
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
115 (revlogv1 and 1 or 0))
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
116
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
117 havecl = len(cl) > 0
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
118 havemf = len(mf) > 0
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
119
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
120 ui.status(_("checking changesets\n"))
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
121 seen = {}
8292
29540554def8 verify: reference the correct linkrev when a filelog is missing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8291
diff changeset
122 checklog(cl, "changelog", 0)
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
123 total = len(repo)
6750
fb42030d79d6 add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents: 6534
diff changeset
124 for i in repo:
10906
6ced27d3168a verify: improve progress descriptions
Steve Borho <steve@borho.org>
parents: 10698
diff changeset
125 ui.progress(_('changesets'), i, total=total)
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
126 n = cl.node(i)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
127 checkentry(cl, i, n, seen, [i], "changelog")
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
128
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
129 try:
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
130 changes = cl.read(n)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
131 mflinkrevs.setdefault(changes[0], []).append(i)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
132 for f in changes[3]:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
133 filelinkrevs.setdefault(f, []).append(i)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
134 except Exception, inst:
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
135 exc(i, _("unpacking changeset %s") % short(n), inst)
10906
6ced27d3168a verify: improve progress descriptions
Steve Borho <steve@borho.org>
parents: 10698
diff changeset
136 ui.progress(_('changesets'), None)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
137
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
138 ui.status(_("checking manifests\n"))
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
139 seen = {}
8292
29540554def8 verify: reference the correct linkrev when a filelog is missing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8291
diff changeset
140 checklog(mf, "manifest", 0)
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
141 total = len(mf)
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
142 for i in mf:
10906
6ced27d3168a verify: improve progress descriptions
Steve Borho <steve@borho.org>
parents: 10698
diff changeset
143 ui.progress(_('manifests'), i, total=total)
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
144 n = mf.node(i)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
145 lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest")
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
146 if n in mflinkrevs:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
147 del mflinkrevs[n]
8394
850b5a7c210d verify: detect manifest revs not in any changeset
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 8292
diff changeset
148 else:
850b5a7c210d verify: detect manifest revs not in any changeset
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 8292
diff changeset
149 err(lr, _("%s not in changesets") % short(n), "manifest")
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
150
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
151 try:
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
152 for f, fn in mf.readdelta(n).iteritems():
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
153 if not f:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
154 err(lr, _("file without name in manifest"))
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
155 elif f != "/dev/null":
9657
96c803e9018f verify: filter the candidate list for broken linkrevs
Matt Mackall <mpm@selenic.com>
parents: 9545
diff changeset
156 filenodes.setdefault(f, {}).setdefault(fn, lr)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
157 except Exception, inst:
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
158 exc(lr, _("reading manifest delta %s") % short(n), inst)
10906
6ced27d3168a verify: improve progress descriptions
Steve Borho <steve@borho.org>
parents: 10698
diff changeset
159 ui.progress(_('manifests'), None)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
160
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
161 ui.status(_("crosschecking files in changesets and manifests\n"))
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
162
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
163 total = len(mflinkrevs) + len(filelinkrevs) + len(filenodes)
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
164 count = 0
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
165 if havemf:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
166 for c, m in sorted([(c, m) for m in mflinkrevs
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
167 for c in mflinkrevs[m]]):
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
168 count += 1
10698
e930017f9e2a progress: use a verb (+noun) in present participle
Martin Geisler <mg@lazybytes.net>
parents: 10496
diff changeset
169 ui.progress(_('crosschecking'), count, total=total)
5541
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
170 err(c, _("changeset refers to unknown manifest %s") % short(m))
9033
98a5652bfed9 verify: fix scope issues with del statement
Alejandro Santos <alejolp@alejolp.com>
parents: 8993
diff changeset
171 mflinkrevs = None # del is bad here due to scope issues
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
172
8209
a1a5a57efe90 replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents: 8164
diff changeset
173 for f in sorted(filelinkrevs):
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
174 count += 1
10698
e930017f9e2a progress: use a verb (+noun) in present participle
Martin Geisler <mg@lazybytes.net>
parents: 10496
diff changeset
175 ui.progress(_('crosschecking'), count, total=total)
5541
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
176 if f not in filenodes:
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
177 lr = filelinkrevs[f][0]
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
178 err(lr, _("in changeset but not in manifest"), f)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
179
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
180 if havecl:
8209
a1a5a57efe90 replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents: 8164
diff changeset
181 for f in sorted(filenodes):
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
182 count += 1
10698
e930017f9e2a progress: use a verb (+noun) in present participle
Martin Geisler <mg@lazybytes.net>
parents: 10496
diff changeset
183 ui.progress(_('crosschecking'), count, total=total)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
184 if f not in filelinkrevs:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
185 try:
7361
9fe97eea5510 linkrev: take a revision number rather than a hash
Matt Mackall <mpm@selenic.com>
parents: 7141
diff changeset
186 fl = repo.file(f)
9fe97eea5510 linkrev: take a revision number rather than a hash
Matt Mackall <mpm@selenic.com>
parents: 7141
diff changeset
187 lr = min([fl.linkrev(fl.rev(n)) for n in filenodes[f]])
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
188 except:
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
189 lr = None
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
190 err(lr, _("in manifest but not in changeset"), f)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
191
10698
e930017f9e2a progress: use a verb (+noun) in present participle
Martin Geisler <mg@lazybytes.net>
parents: 10496
diff changeset
192 ui.progress(_('crosschecking'), None)
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
193
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
194 ui.status(_("checking files\n"))
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
195
8466
afb3e504b558 verify: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8394
diff changeset
196 storefiles = set()
6900
def492d1b592 store: change handling of decoding errors
Matt Mackall <mpm@selenic.com>
parents: 6892
diff changeset
197 for f, f2, size in repo.store.datafiles():
def492d1b592 store: change handling of decoding errors
Matt Mackall <mpm@selenic.com>
parents: 6892
diff changeset
198 if not f:
def492d1b592 store: change handling of decoding errors
Matt Mackall <mpm@selenic.com>
parents: 6892
diff changeset
199 err(None, _("cannot decode filename '%s'") % f2)
def492d1b592 store: change handling of decoding errors
Matt Mackall <mpm@selenic.com>
parents: 6892
diff changeset
200 elif size > 0:
8466
afb3e504b558 verify: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8394
diff changeset
201 storefiles.add(f)
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
202
8209
a1a5a57efe90 replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents: 8164
diff changeset
203 files = sorted(set(filenodes) | set(filelinkrevs))
10433
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
204 total = len(files)
767fbacb3ddc verify: call ui.progress()
Augie Fackler <durin42@gmail.com>
parents: 10282
diff changeset
205 for i, f in enumerate(files):
10698
e930017f9e2a progress: use a verb (+noun) in present participle
Martin Geisler <mg@lazybytes.net>
parents: 10496
diff changeset
206 ui.progress(_('checking'), i, item=f, total=total)
8291
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
207 try:
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
208 linkrevs = filelinkrevs[f]
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
209 except KeyError:
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
210 # in manifest but not in changelog
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
211 linkrevs = []
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
212
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
213 if linkrevs:
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
214 lr = linkrevs[0]
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
215 else:
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
216 lr = None
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
217
7832
1fce19b9b011 verify: do not abort on fully corrupted revlog
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7676
diff changeset
218 try:
1fce19b9b011 verify: do not abort on fully corrupted revlog
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7676
diff changeset
219 fl = repo.file(f)
1fce19b9b011 verify: do not abort on fully corrupted revlog
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7676
diff changeset
220 except error.RevlogError, e:
7833
794def2fe232 verify: find correct first corrupted cset for missing/corrupted revlogs
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7832
diff changeset
221 err(lr, _("broken revlog! (%s)") % e, f)
7832
1fce19b9b011 verify: do not abort on fully corrupted revlog
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7676
diff changeset
222 continue
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
223
6900
def492d1b592 store: change handling of decoding errors
Matt Mackall <mpm@selenic.com>
parents: 6892
diff changeset
224 for ff in fl.files():
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
225 try:
8466
afb3e504b558 verify: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8394
diff changeset
226 storefiles.remove(ff)
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
227 except KeyError:
7833
794def2fe232 verify: find correct first corrupted cset for missing/corrupted revlogs
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 7832
diff changeset
228 err(lr, _("missing revlog!"), ff)
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
229
8292
29540554def8 verify: reference the correct linkrev when a filelog is missing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8291
diff changeset
230 checklog(fl, f, lr)
5313
29be4228303b verify: report first bad changeset
Matt Mackall <mpm@selenic.com>
parents: 5179
diff changeset
231 seen = {}
6750
fb42030d79d6 add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents: 6534
diff changeset
232 for i in fl:
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
233 revisions += 1
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
234 n = fl.node(i)
8291
f5c1a9094e41 verify: avoid exception on missing file revlog
Henrik Stuart <hg@hstuart.dk>
parents: 8225
diff changeset
235 lr = checkentry(fl, i, n, seen, linkrevs, f)
5541
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
236 if f in filenodes:
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
237 if havemf and n not in filenodes[f]:
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
238 err(lr, _("%s not in manifests") % (short(n)), f)
5541
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
239 else:
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
240 del filenodes[f][n]
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
241
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
242 # verify contents
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
243 try:
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
244 t = fl.read(n)
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
245 rp = fl.renamed(n)
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
246 if len(t) != fl.size(i):
7675
011e69b96c69 verify: don't trip over binary files starting with 01 0a
Matt Mackall <mpm@selenic.com>
parents: 7361
diff changeset
247 if len(fl.revision(n)) != fl.size(i):
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
248 err(lr, _("unpacked size is %s, %s expected") %
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
249 (len(t), fl.size(i)), f)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
250 except Exception, inst:
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
251 exc(lr, _("unpacking %s") % short(n), inst, f)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
252
3744
d626fc9e3985 verify: add rename link checking
Matt Mackall <mpm@selenic.com>
parents: 3473
diff changeset
253 # check renames
d626fc9e3985 verify: add rename link checking
Matt Mackall <mpm@selenic.com>
parents: 3473
diff changeset
254 try:
d626fc9e3985 verify: add rename link checking
Matt Mackall <mpm@selenic.com>
parents: 3473
diff changeset
255 if rp:
9545
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
256 if lr is not None and ui.verbose:
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
257 ctx = lrugetctx(lr)
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
258 found = False
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
259 for pctx in ctx.parents():
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
260 if rp[0] in pctx:
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
261 found = True
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
262 break
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
263 if not found:
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
264 warn(_("warning: copy source of '%s' not"
98feea5659d9 verify: detect file copy sources not in parents with --verbose
Patrick Mezard <pmezard@gmail.com>
parents: 9198
diff changeset
265 " in parents of %s") % (f, ctx))
3744
d626fc9e3985 verify: add rename link checking
Matt Mackall <mpm@selenic.com>
parents: 3473
diff changeset
266 fl2 = repo.file(rp[0])
6750
fb42030d79d6 add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents: 6534
diff changeset
267 if not len(fl2):
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
268 err(lr, _("empty or missing copy source revlog %s:%s")
6534
9b35a9f34675 verify: check copy source revlog and nodeid
Patrick Mezard <pmezard@gmail.com>
parents: 6211
diff changeset
269 % (rp[0], short(rp[1])), f)
9b35a9f34675 verify: check copy source revlog and nodeid
Patrick Mezard <pmezard@gmail.com>
parents: 6211
diff changeset
270 elif rp[1] == nullid:
8993
46441934c585 verify: demote warning about nullid in copy to note
Matt Mackall <mpm@selenic.com>
parents: 8466
diff changeset
271 ui.note(_("warning: %s@%s: copy source"
46441934c585 verify: demote warning about nullid in copy to note
Matt Mackall <mpm@selenic.com>
parents: 8466
diff changeset
272 " revision is nullid %s:%s\n")
7004
90227c42b5f6 c0bd7d8b69ef uses err() instead of warn() but prototype doesn't match
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6900
diff changeset
273 % (f, lr, rp[0], short(rp[1])))
6534
9b35a9f34675 verify: check copy source revlog and nodeid
Patrick Mezard <pmezard@gmail.com>
parents: 6211
diff changeset
274 else:
7874
d812029cda85 cleanup: drop variables for unused return values
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7833
diff changeset
275 fl2.rev(rp[1])
3744
d626fc9e3985 verify: add rename link checking
Matt Mackall <mpm@selenic.com>
parents: 3473
diff changeset
276 except Exception, inst:
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
277 exc(lr, _("checking rename of %s") % short(n), inst, f)
3744
d626fc9e3985 verify: add rename link checking
Matt Mackall <mpm@selenic.com>
parents: 3473
diff changeset
278
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
279 # cross-check
5541
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
280 if f in filenodes:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
281 fns = [(lr, n) for n, lr in filenodes[f].iteritems()]
8209
a1a5a57efe90 replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents: 8164
diff changeset
282 for lr, node in sorted(fns):
5541
ceaa752fa316 verify: improve handling of empty or missing files
Matt Mackall <mpm@selenic.com>
parents: 5313
diff changeset
283 err(lr, _("%s in manifests not found") % short(node), f)
10698
e930017f9e2a progress: use a verb (+noun) in present participle
Martin Geisler <mg@lazybytes.net>
parents: 10496
diff changeset
284 ui.progress(_('checking'), None)
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
285
6892
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
286 for f in storefiles:
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
287 warn(_("warning: orphan revlog '%s'") % f)
dab95717058d verify: check repo.store
Adrian Buehlmann <adrian@cadifra.com>
parents: 6889
diff changeset
288
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
289 ui.status(_("%d files, %d changesets, %d total revisions\n") %
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
290 (len(files), len(cl), revisions))
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
291 if warnings[0]:
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
292 ui.warn(_("%d warnings encountered!\n") % warnings[0])
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
293 if errors[0]:
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
294 ui.warn(_("%d integrity errors encountered!\n") % errors[0])
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
295 if badrevs:
6751
7424a75f919a verify: add some local variables
Matt Mackall <mpm@selenic.com>
parents: 6750
diff changeset
296 ui.warn(_("(first damaged changeset appears to be %d)\n")
6752
e79a8f36c2a5 verify: lots of refactoring
Matt Mackall <mpm@selenic.com>
parents: 6751
diff changeset
297 % min(badrevs))
2778
fdc232d8a193 Move repo.verify
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
298 return 1