Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 3761:9433bdcaa9ae
Ignore all errors while parsing the branch cache.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 02 Dec 2006 03:38:55 -0200 |
parents | 9e67fecbfd16 |
children | 73860ffbe798 |
comparison
equal
deleted
inserted
replaced
3760:aeafd80c1e78 | 3761:9433bdcaa9ae |
---|---|
325 f = self.opener("branches.cache") | 325 f = self.opener("branches.cache") |
326 lines = f.read().split('\n') | 326 lines = f.read().split('\n') |
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 for l in lines: | 332 # invalidate the cache |
333 if not l: continue | 333 raise ValueError('Invalid branch cache: unknown tip') |
334 node, label = l.rstrip().split(" ", 1) | 334 for l in lines: |
335 partial[label] = bin(node) | 335 if not l: continue |
336 else: # invalidate the cache | 336 node, label = l.rstrip().split(" ", 1) |
337 last, lrev = nullid, nullrev | 337 partial[label] = bin(node) |
338 except IOError: | 338 except (KeyboardInterrupt, util.SignalInterrupt): |
339 last, lrev = nullid, nullrev | 339 raise |
340 except Exception, inst: | |
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): |
343 try: | 347 try: |
344 f = self.opener("branches.cache", "w") | 348 f = self.opener("branches.cache", "w") |