D4281: branchmap: load branchmap as an iterable

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Thu Aug 16 06:36:30 EDT 2018


yuja added a comment.


  >   def read(repo):
  >       try:
  >           f = repo.cachevfs(_filename(repo))
  > 
  > - lines = f.read().split('\n')
  > - f.close()
  > - except (IOError, OSError):
  > - return None -
  > - try:
  > - cachekey = lines.pop(0).split(" ", 2) +        cachekey = next(f).split(" ", 2)
  
  Several tests fail, probably because of missed rstrip().
  
  >   partial.setdefault(label, []).append(node)
  >   if state == 'c':
  >       partial._closednodes.add(node)
  > 
  > +
  >  +    except (IOError, OSError):
  >  +        return None
  >  +
  > 
  >   except Exception as inst:
  >       if repo.ui.debugflag:
  >           msg = 'invalid branchheads cache'
  
  Missed `finally: f.close()`?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4281

To: mjpieters, #hg-reviewers, durin42
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list