50 filteredhash = bin(cachekey[2]) |
51 filteredhash = bin(cachekey[2]) |
51 partial = branchcache(tipnode=last, tiprev=lrev, |
52 partial = branchcache(tipnode=last, tiprev=lrev, |
52 filteredhash=filteredhash) |
53 filteredhash=filteredhash) |
53 if not partial.validfor(repo): |
54 if not partial.validfor(repo): |
54 # invalidate the cache |
55 # invalidate the cache |
55 raise ValueError('tip differs') |
56 raise ValueError(r'tip differs') |
56 cl = repo.changelog |
57 cl = repo.changelog |
57 for l in lines: |
58 for l in lines: |
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': |
62 raise ValueError('invalid branch state') |
63 raise ValueError(r'invalid branch state') |
63 label = encoding.tolocal(label.strip()) |
64 label = encoding.tolocal(label.strip()) |
64 node = bin(node) |
65 node = bin(node) |
65 if not cl.hasnode(node): |
66 if not cl.hasnode(node): |
66 raise ValueError('node %s does not exist' % hex(node)) |
67 raise ValueError( |
|
68 r'node %s does not exist' % pycompat.sysstr(hex(node))) |
67 partial.setdefault(label, []).append(node) |
69 partial.setdefault(label, []).append(node) |
68 if state == 'c': |
70 if state == 'c': |
69 partial._closednodes.add(node) |
71 partial._closednodes.add(node) |
70 except Exception as inst: |
72 except Exception as inst: |
71 if repo.ui.debugflag: |
73 if repo.ui.debugflag: |
72 msg = 'invalid branchheads cache' |
74 msg = 'invalid branchheads cache' |
73 if repo.filtername is not None: |
75 if repo.filtername is not None: |
74 msg += ' (%s)' % repo.filtername |
76 msg += ' (%s)' % repo.filtername |
75 msg += ': %s\n' |
77 msg += ': %s\n' |
76 repo.ui.debug(msg % inst) |
78 repo.ui.debug(msg % pycompat.bytestr(inst)) |
77 partial = None |
79 partial = None |
78 return partial |
80 return partial |
79 |
81 |
80 ### Nearest subset relation |
82 ### Nearest subset relation |
81 # Nearest subset of filter X is a filter Y so that: |
83 # Nearest subset of filter X is a filter Y so that: |