Mercurial > hg-stable
comparison mercurial/branchmap.py @ 39175:8547c8590ac1
branchmap: explicitly convert file into iterator
Follows up 2a4bfbb52111. This is required for httprangereader, which is not
an iterable itself.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 17 Aug 2018 10:51:05 +0900 |
parents | dd1614906a20 |
children | d99a588d8515 |
comparison
equal
deleted
inserted
replaced
39174:dd1614906a20 | 39175:8547c8590ac1 |
---|---|
39 | 39 |
40 def read(repo): | 40 def read(repo): |
41 f = None | 41 f = None |
42 try: | 42 try: |
43 f = repo.cachevfs(_filename(repo)) | 43 f = repo.cachevfs(_filename(repo)) |
44 cachekey = next(f).rstrip('\n').split(" ", 2) | 44 lineiter = iter(f) |
45 cachekey = next(lineiter).rstrip('\n').split(" ", 2) | |
45 last, lrev = cachekey[:2] | 46 last, lrev = cachekey[:2] |
46 last, lrev = bin(last), int(lrev) | 47 last, lrev = bin(last), int(lrev) |
47 filteredhash = None | 48 filteredhash = None |
48 if len(cachekey) > 2: | 49 if len(cachekey) > 2: |
49 filteredhash = bin(cachekey[2]) | 50 filteredhash = bin(cachekey[2]) |
51 filteredhash=filteredhash) | 52 filteredhash=filteredhash) |
52 if not partial.validfor(repo): | 53 if not partial.validfor(repo): |
53 # invalidate the cache | 54 # invalidate the cache |
54 raise ValueError(r'tip differs') | 55 raise ValueError(r'tip differs') |
55 cl = repo.changelog | 56 cl = repo.changelog |
56 for l in f: | 57 for l in lineiter: |
57 l = l.rstrip('\n') | 58 l = l.rstrip('\n') |
58 if not l: | 59 if not l: |
59 continue | 60 continue |
60 node, state, label = l.split(" ", 2) | 61 node, state, label = l.split(" ", 2) |
61 if state not in 'oc': | 62 if state not in 'oc': |