Show More
@@ -18,6 +18,7 b' from .node import (' | |||||
18 | from . import ( |
|
18 | from . import ( | |
19 | error, |
|
19 | error, | |
20 | revlog, |
|
20 | revlog, | |
|
21 | scmutil, | |||
21 | util, |
|
22 | util, | |
22 | ) |
|
23 | ) | |
23 |
|
24 | |||
@@ -32,21 +33,13 b' def _normpath(f):' | |||||
32 | f = f.replace('//', '/') |
|
33 | f = f.replace('//', '/') | |
33 | return f |
|
34 | return f | |
34 |
|
35 | |||
35 | def _validpath(repo, path): |
|
|||
36 | """Returns False if a path should NOT be treated as part of a repo. |
|
|||
37 |
|
||||
38 | For all in-core cases, this returns True, as we have no way for a |
|
|||
39 | path to be mentioned in the history but not actually be |
|
|||
40 | relevant. For narrow clones, this is important because many |
|
|||
41 | filelogs will be missing, and changelog entries may mention |
|
|||
42 | modified files that are outside the narrow scope. |
|
|||
43 | """ |
|
|||
44 | return True |
|
|||
45 |
|
||||
46 | class verifier(object): |
|
36 | class verifier(object): | |
47 | def __init__(self, repo): |
|
37 | # The match argument is always None in hg core, but e.g. the narrowhg | |
|
38 | # extension will pass in a matcher here. | |||
|
39 | def __init__(self, repo, match=None): | |||
48 | self.repo = repo.unfiltered() |
|
40 | self.repo = repo.unfiltered() | |
49 | self.ui = repo.ui |
|
41 | self.ui = repo.ui | |
|
42 | self.match = match or scmutil.matchall(repo) | |||
50 | self.badrevs = set() |
|
43 | self.badrevs = set() | |
51 | self.errors = 0 |
|
44 | self.errors = 0 | |
52 | self.warnings = 0 |
|
45 | self.warnings = 0 | |
@@ -170,6 +163,7 b' class verifier(object):' | |||||
170 | def _verifychangelog(self): |
|
163 | def _verifychangelog(self): | |
171 | ui = self.ui |
|
164 | ui = self.ui | |
172 | repo = self.repo |
|
165 | repo = self.repo | |
|
166 | match = self.match | |||
173 | cl = repo.changelog |
|
167 | cl = repo.changelog | |
174 |
|
168 | |||
175 | ui.status(_("checking changesets\n")) |
|
169 | ui.status(_("checking changesets\n")) | |
@@ -189,7 +183,7 b' class verifier(object):' | |||||
189 | mflinkrevs.setdefault(changes[0], []).append(i) |
|
183 | mflinkrevs.setdefault(changes[0], []).append(i) | |
190 | self.refersmf = True |
|
184 | self.refersmf = True | |
191 | for f in changes[3]: |
|
185 | for f in changes[3]: | |
192 |
if |
|
186 | if match(f): | |
193 | filelinkrevs.setdefault(_normpath(f), []).append(i) |
|
187 | filelinkrevs.setdefault(_normpath(f), []).append(i) | |
194 | except Exception as inst: |
|
188 | except Exception as inst: | |
195 | self.refersmf = True |
|
189 | self.refersmf = True | |
@@ -201,6 +195,7 b' class verifier(object):' | |||||
201 | progress=None): |
|
195 | progress=None): | |
202 | repo = self.repo |
|
196 | repo = self.repo | |
203 | ui = self.ui |
|
197 | ui = self.ui | |
|
198 | match = self.match | |||
204 | mfl = self.repo.manifestlog |
|
199 | mfl = self.repo.manifestlog | |
205 | mf = mfl._revlog.dirlog(dir) |
|
200 | mf = mfl._revlog.dirlog(dir) | |
206 |
|
201 | |||
@@ -243,12 +238,14 b' class verifier(object):' | |||||
243 | elif f == "/dev/null": # ignore this in very old repos |
|
238 | elif f == "/dev/null": # ignore this in very old repos | |
244 | continue |
|
239 | continue | |
245 | fullpath = dir + _normpath(f) |
|
240 | fullpath = dir + _normpath(f) | |
246 | if not _validpath(repo, fullpath): |
|
|||
247 | continue |
|
|||
248 | if fl == 't': |
|
241 | if fl == 't': | |
|
242 | if not match.visitdir(fullpath): | |||
|
243 | continue | |||
249 | subdirnodes.setdefault(fullpath + '/', {}).setdefault( |
|
244 | subdirnodes.setdefault(fullpath + '/', {}).setdefault( | |
250 | fn, []).append(lr) |
|
245 | fn, []).append(lr) | |
251 | else: |
|
246 | else: | |
|
247 | if not match(fullpath): | |||
|
248 | continue | |||
252 | filenodes.setdefault(fullpath, {}).setdefault(fn, lr) |
|
249 | filenodes.setdefault(fullpath, {}).setdefault(fn, lr) | |
253 | except Exception as inst: |
|
250 | except Exception as inst: | |
254 | self.exc(lr, _("reading delta %s") % short(n), inst, label) |
|
251 | self.exc(lr, _("reading delta %s") % short(n), inst, label) |
General Comments 0
You need to be logged in to leave comments.
Login now