##// 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 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
238 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
239 for branch, newheadrevs in newbranches.iteritems():
239 for branch, newheadrevs in newbranches.iteritems():
240 bheads = self.setdefault(branch, [])
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 # This have been tested True on all internal usage of this function.
243 # This have been tested True on all internal usage of this function.
244 # run it again in case of doubt
244 # run it again in case of doubt
245 # assert not (set(bheadrevs) & set(newheadrevs))
245 # assert not (set(bheadrevs) & set(newheadrevs))
246 newheadrevs.sort()
246 newheadrevs.sort()
247 bheadrevs.extend(newheadrevs)
247 bheadset.update(newheadrevs)
248 bheadrevs.sort()
249
248
250 # This loop prunes out two kinds of heads - heads that are
249 # This loop prunes out two kinds of heads - heads that are
251 # superseded by a head in newheadrevs, and newheadrevs that are not
250 # superseded by a head in newheadrevs, and newheadrevs that are not
252 # heads because an existing head is their descendant.
251 # heads because an existing head is their descendant.
253 while newheadrevs:
252 while newheadrevs:
254 latest = newheadrevs.pop()
253 latest = newheadrevs.pop()
255 if latest not in bheadrevs:
254 if latest not in bheadset:
256 continue
255 continue
257 ancestors = set(cl.ancestors([latest], bheadrevs[0]))
256 ancestors = set(cl.ancestors([latest], min(bheadset)))
258 if ancestors:
257 bheadset -= ancestors
259 bheadrevs = [b for b in bheadrevs if b not in ancestors]
258 bheadrevs = sorted(bheadset)
260 self[branch] = [cl.node(rev) for rev in bheadrevs]
259 self[branch] = [cl.node(rev) for rev in bheadrevs]
261 tiprev = bheadrevs[-1]
260 tiprev = bheadrevs[-1]
262 if tiprev > self.tiprev:
261 if tiprev > self.tiprev:
General Comments 0
You need to be logged in to leave comments. Login now