250 # run it again in case of doubt |
250 # run it again in case of doubt |
251 # assert not (set(bheadrevs) & set(newheadrevs)) |
251 # assert not (set(bheadrevs) & set(newheadrevs)) |
252 newheadrevs.sort() |
252 newheadrevs.sort() |
253 bheadset.update(newheadrevs) |
253 bheadset.update(newheadrevs) |
254 |
254 |
255 # This loop prunes out two kinds of heads - heads that are |
255 # This prunes out two kinds of heads - heads that are superseded by |
256 # superseded by a head in newheadrevs, and newheadrevs that are not |
256 # a head in newheadrevs, and newheadrevs that are not heads because |
257 # heads because an existing head is their descendant. |
257 # an existing head is their descendant. |
258 while newheadrevs: |
258 ancestors = set(cl.ancestors(newheadrevs, min(bheadset))) |
259 latest = newheadrevs.pop() |
259 bheadset -= ancestors |
260 if latest not in bheadset: |
|
261 continue |
|
262 ancestors = set(cl.ancestors([latest], min(bheadset))) |
|
263 bheadset -= ancestors |
|
264 bheadrevs = sorted(bheadset) |
260 bheadrevs = sorted(bheadset) |
265 self[branch] = [cl.node(rev) for rev in bheadrevs] |
261 self[branch] = [cl.node(rev) for rev in bheadrevs] |
266 tiprev = bheadrevs[-1] |
262 tiprev = bheadrevs[-1] |
267 if tiprev > self.tiprev: |
263 if tiprev > self.tiprev: |
268 self.tipnode = cl.node(tiprev) |
264 self.tipnode = cl.node(tiprev) |