comparison mercurial/localrepo.py @ 4167:4574a8cb080f

Store empty (default) branch in branch cache, too. Operations on this branch don't work otherwise. Reading branches.cache had to be adjusted to allow an empty label. Adjusted reading of the cache tip for symmetry, no functional change here.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 09 Mar 2007 18:09:02 +0100
parents 43d8f7466920
children bbfe5a3fc80c
comparison
equal deleted inserted replaced
4157:bfeff6dcac7a 4167:4574a8cb080f
374 partial = {} 374 partial = {}
375 try: 375 try:
376 f = self.opener("branches.cache") 376 f = self.opener("branches.cache")
377 lines = f.read().split('\n') 377 lines = f.read().split('\n')
378 f.close() 378 f.close()
379 last, lrev = lines.pop(0).rstrip().split(" ", 1) 379 last, lrev = lines.pop(0).split(" ", 1)
380 last, lrev = bin(last), int(lrev) 380 last, lrev = bin(last), int(lrev)
381 if not (lrev < self.changelog.count() and 381 if not (lrev < self.changelog.count() and
382 self.changelog.node(lrev) == last): # sanity check 382 self.changelog.node(lrev) == last): # sanity check
383 # invalidate the cache 383 # invalidate the cache
384 raise ValueError('Invalid branch cache: unknown tip') 384 raise ValueError('Invalid branch cache: unknown tip')
385 for l in lines: 385 for l in lines:
386 if not l: continue 386 if not l: continue
387 node, label = l.rstrip().split(" ", 1) 387 node, label = l.split(" ", 1)
388 partial[label] = bin(node) 388 partial[label.strip()] = bin(node)
389 except (KeyboardInterrupt, util.SignalInterrupt): 389 except (KeyboardInterrupt, util.SignalInterrupt):
390 raise 390 raise
391 except Exception, inst: 391 except Exception, inst:
392 if self.ui.debugflag: 392 if self.ui.debugflag:
393 self.ui.warn(str(inst), '\n') 393 self.ui.warn(str(inst), '\n')
405 405
406 def _updatebranchcache(self, partial, start, end): 406 def _updatebranchcache(self, partial, start, end):
407 for r in xrange(start, end): 407 for r in xrange(start, end):
408 c = self.changectx(r) 408 c = self.changectx(r)
409 b = c.branch() 409 b = c.branch()
410 if b: 410 partial[b] = c.node()
411 partial[b] = c.node()
412 411
413 def lookup(self, key): 412 def lookup(self, key):
414 if key == '.': 413 if key == '.':
415 key = self.dirstate.parents()[0] 414 key = self.dirstate.parents()[0]
416 if key == nullid: 415 if key == nullid: