147 """Given a branchhead cache, self, that may have extra nodes or be |
147 """Given a branchhead cache, self, that may have extra nodes or be |
148 missing heads, and a generator of nodes that are at least a superset of |
148 missing heads, and a generator of nodes that are at least a superset of |
149 heads missing, this function updates self to be correct. |
149 heads missing, this function updates self to be correct. |
150 """ |
150 """ |
151 cl = repo.changelog |
151 cl = repo.changelog |
152 ctxgen = (repo[r] for r in revgen) |
|
153 # collect new branch entries |
152 # collect new branch entries |
154 newbranches = {} |
153 newbranches = {} |
155 for c in ctxgen: |
154 getbranch = cl.branch |
156 newbranches.setdefault(c.branch(), []).append(c.node()) |
155 for r in revgen: |
|
156 newbranches.setdefault(getbranch(r), []).append(cl.node(r)) |
157 # if older branchheads are reachable from new ones, they aren't |
157 # if older branchheads are reachable from new ones, they aren't |
158 # really branchheads. Note checking parents is insufficient: |
158 # really branchheads. Note checking parents is insufficient: |
159 # 1 (branch a) -> 2 (branch b) -> 3 (branch a) |
159 # 1 (branch a) -> 2 (branch b) -> 3 (branch a) |
160 for branch, newnodes in newbranches.iteritems(): |
160 for branch, newnodes in newbranches.iteritems(): |
161 bheads = self.setdefault(branch, []) |
161 bheads = self.setdefault(branch, []) |