##// END OF EJS Templates
branchmap: use set for update code...
Pierre-Yves David -
r20264:d9e1c167 default
parent child Browse files
Show More
@@ -238,25 +238,24 b' class branchcache(dict):'
238 238 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
239 239 for branch, newheadrevs in newbranches.iteritems():
240 240 bheads = self.setdefault(branch, [])
241 bheadrevs = [cl.rev(node) for node in bheads]
241 bheadset = set(cl.rev(node) for node in bheads)
242 242
243 243 # This have been tested True on all internal usage of this function.
244 244 # run it again in case of doubt
245 245 # assert not (set(bheadrevs) & set(newheadrevs))
246 246 newheadrevs.sort()
247 bheadrevs.extend(newheadrevs)
248 bheadrevs.sort()
247 bheadset.update(newheadrevs)
249 248
250 249 # This loop prunes out two kinds of heads - heads that are
251 250 # superseded by a head in newheadrevs, and newheadrevs that are not
252 251 # heads because an existing head is their descendant.
253 252 while newheadrevs:
254 253 latest = newheadrevs.pop()
255 if latest not in bheadrevs:
254 if latest not in bheadset:
256 255 continue
257 ancestors = set(cl.ancestors([latest], bheadrevs[0]))
258 if ancestors:
259 bheadrevs = [b for b in bheadrevs if b not in ancestors]
256 ancestors = set(cl.ancestors([latest], min(bheadset)))
257 bheadset -= ancestors
258 bheadrevs = sorted(bheadset)
260 259 self[branch] = [cl.node(rev) for rev in bheadrevs]
261 260 tiprev = bheadrevs[-1]
262 261 if tiprev > self.tiprev:
General Comments 0
You need to be logged in to leave comments. Login now