##// END OF EJS Templates
Ignore all errors while parsing the branch cache.
Alexis S. L. Carvalho -
r3761:9433bdca default
parent child Browse files
Show More
@@ -327,16 +327,20 b' class localrepository(repo.repository):'
327 f.close()
327 f.close()
328 last, lrev = lines.pop(0).rstrip().split(" ", 1)
328 last, lrev = lines.pop(0).rstrip().split(" ", 1)
329 last, lrev = bin(last), int(lrev)
329 last, lrev = bin(last), int(lrev)
330 if (lrev < self.changelog.count() and
330 if not (lrev < self.changelog.count() and
331 self.changelog.node(lrev) == last): # sanity check
331 self.changelog.node(lrev) == last): # sanity check
332 # invalidate the cache
333 raise ValueError('Invalid branch cache: unknown tip')
332 for l in lines:
334 for l in lines:
333 if not l: continue
335 if not l: continue
334 node, label = l.rstrip().split(" ", 1)
336 node, label = l.rstrip().split(" ", 1)
335 partial[label] = bin(node)
337 partial[label] = bin(node)
336 else: # invalidate the cache
338 except (KeyboardInterrupt, util.SignalInterrupt):
337 last, lrev = nullid, nullrev
339 raise
338 except IOError:
340 except Exception, inst:
339 last, lrev = nullid, nullrev
341 if self.ui.debugflag:
342 self.ui.warn(str(inst), '\n')
343 partial, last, lrev = {}, nullid, nullrev
340 return partial, last, lrev
344 return partial, last, lrev
341
345
342 def _writebranchcache(self, branches, tip, tiprev):
346 def _writebranchcache(self, branches, tip, tiprev):
@@ -30,4 +30,11 b' hg branches -q'
30
30
31 echo % test for invalid branch cache
31 echo % test for invalid branch cache
32 hg rollback
32 hg rollback
33 cp .hg/branches.cache .hg/bc-invalid
33 hg log -r foo
34 hg log -r foo
35 cp .hg/bc-invalid .hg/branches.cache
36 hg --debug log -r foo
37 rm .hg/branches.cache
38 echo corrupted > .hg/branches.cache
39 hg log -qr foo
40 cat .hg/branches.cache
@@ -56,3 +56,22 b' user: test'
56 date: Mon Jan 12 13:46:40 1970 +0000
56 date: Mon Jan 12 13:46:40 1970 +0000
57 summary: modify a branch
57 summary: modify a branch
58
58
59 Invalid branch cache: unknown tip
60 changeset: 4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
61 branch: foo
62 tag: tip
63 parent: 1:b699b1cec9c2966b3700de4fef0dc123cd754c31
64 parent: -1:0000000000000000000000000000000000000000
65 manifest: 4:d01b250baaa05909152f7ae07d7a649deea0df9a
66 user: test
67 date: Mon Jan 12 13:46:40 1970 +0000
68 files: a
69 extra: branch=foo
70 description:
71 modify a branch
72
73
74 4:4909a3732169
75 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4
76 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
77 67ec16bde7f1575d523313b9bca000f6a6f12dca bar
General Comments 0
You need to be logged in to leave comments. Login now