##// END OF EJS Templates
verify: check repo.store
Adrian Buehlmann -
r6892:dab95717 default
parent child Browse files
Show More
@@ -5,6 +5,7 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 from i18n import _
8 import os, stat, osutil, util
9 import os, stat, osutil, util
9
10
10 def _buildencodefun():
11 def _buildencodefun():
@@ -77,14 +78,14 b' class _store:'
77 if (len(f) > 2) and f[-2:] in filetypes:
78 if (len(f) > 2) and f[-2:] in filetypes:
78 yield util.pconvert(f[striplen:]), size
79 yield util.pconvert(f[striplen:]), size
79
80
80 def _datafiles(self):
81 def datafiles(self, reporterror=None):
81 for x in self._revlogfiles('data', True):
82 for x in self._revlogfiles('data', True):
82 yield x
83 yield x
83
84
84 def walk(self):
85 def walk(self):
85 '''yields (direncoded filename, size)'''
86 '''yields (direncoded filename, size)'''
86 # yield data files first
87 # yield data files first
87 for x in self._datafiles():
88 for x in self.datafiles():
88 yield x
89 yield x
89 # yield manifest before changelog
90 # yield manifest before changelog
90 meta = util.sort(self._revlogfiles())
91 meta = util.sort(self._revlogfiles())
@@ -95,7 +96,6 b' class _store:'
95 class directstore(_store):
96 class directstore(_store):
96 def __init__(self, path):
97 def __init__(self, path):
97 _store.__init__(self, path)
98 _store.__init__(self, path)
98 self.encodefn = lambda x: x
99 self.opener = util.opener(self.path)
99 self.opener = util.opener(self.path)
100 self.opener.createmode = self.createmode
100 self.opener.createmode = self.createmode
101
101
@@ -107,9 +107,14 b' class encodedstore(_store):'
107 op.createmode = self.createmode
107 op.createmode = self.createmode
108 self.opener = lambda f, *args, **kw: op(self.encodefn(f), *args, **kw)
108 self.opener = lambda f, *args, **kw: op(self.encodefn(f), *args, **kw)
109
109
110 def _datafiles(self):
110 def datafiles(self, reporterror=None):
111 for f, size in self._revlogfiles('data', True):
111 for f, size in self._revlogfiles('data', True):
112 yield decodefilename(f), size
112 try:
113 yield decodefilename(f), size
114 except KeyError:
115 if not reporterror:
116 raise
117 reporterror(_("cannot decode filename '%s'") % f)
113
118
114 def join(self, f):
119 def join(self, f):
115 return os.path.join(self.path, self.encodefn(f))
120 return os.path.join(self.path, self.encodefn(f))
@@ -158,9 +158,22 b' def _verify(repo):'
158 err(lr, _("in manifest but not in changeset"), f)
158 err(lr, _("in manifest but not in changeset"), f)
159
159
160 ui.status(_("checking files\n"))
160 ui.status(_("checking files\n"))
161
162 storefiles = {}
163 for f, size in repo.store.datafiles(lambda m: err(None, m)):
164 if size > 0:
165 storefiles[f] = True
166
161 files = util.sort(util.unique(filenodes.keys() + filelinkrevs.keys()))
167 files = util.sort(util.unique(filenodes.keys() + filelinkrevs.keys()))
162 for f in files:
168 for f in files:
163 fl = repo.file(f)
169 fl = repo.file(f)
170
171 for ff in fl.files():
172 try:
173 del storefiles[ff]
174 except KeyError:
175 err(0, _("missing revlog!"), ff)
176
164 checklog(fl, f)
177 checklog(fl, f)
165 seen = {}
178 seen = {}
166 for i in fl:
179 for i in fl:
@@ -205,6 +218,9 b' def _verify(repo):'
205 for lr, node in util.sort(fns):
218 for lr, node in util.sort(fns):
206 err(lr, _("%s in manifests not found") % short(node), f)
219 err(lr, _("%s in manifests not found") % short(node), f)
207
220
221 for f in storefiles:
222 warn(_("warning: orphan revlog '%s'") % f)
223
208 ui.status(_("%d files, %d changesets, %d total revisions\n") %
224 ui.status(_("%d files, %d changesets, %d total revisions\n") %
209 (len(files), len(cl), revisions))
225 (len(files), len(cl), revisions))
210 if warnings[0]:
226 if warnings[0]:
General Comments 0
You need to be logged in to leave comments. Login now