Show More
@@ -221,7 +221,7 b' class branchcache(dict):' | |||
|
221 | 221 | |
|
222 | 222 | def update(self, repo, revgen): |
|
223 | 223 | """Given a branchhead cache, self, that may have extra nodes or be |
|
224 |
missing heads, and a generator of nodes that are |
|
|
224 | missing heads, and a generator of nodes that are strictly a superset of | |
|
225 | 225 | heads missing, this function updates self to be correct. |
|
226 | 226 | """ |
|
227 | 227 | cl = repo.changelog |
@@ -239,32 +239,26 b' class branchcache(dict):' | |||
|
239 | 239 | for branch, newheadrevs in newbranches.iteritems(): |
|
240 | 240 | bheads = self.setdefault(branch, []) |
|
241 | 241 | bheadrevs = [cl.rev(node) for node in bheads] |
|
242 | ctxisnew = bheadrevs and min(newheadrevs) > max(bheadrevs) | |
|
243 | # Remove duplicates - nodes that are in newheadrevs and are already | |
|
244 | # in bheadrevs. This can happen if you strip a node whose parent | |
|
245 | # was already a head (because they're on different branches). | |
|
246 | bheadrevs = sorted(set(bheadrevs).union(newheadrevs)) | |
|
247 | 242 | |
|
248 | # Starting from tip means fewer passes over reachable. If we know | |
|
249 | # the new candidates are not ancestors of existing heads, we don't | |
|
250 | # have to examine ancestors of existing heads | |
|
251 | if ctxisnew: | |
|
252 |
|
|
|
253 |
|
|
|
254 | iterrevs = list(bheadrevs) | |
|
243 | # This have been tested True on all internal usage of this function. | |
|
244 | # run it again in case of doubt | |
|
245 | # assert not (set(bheadrevs) & set(newheadrevs)) | |
|
246 | newheadrevs.sort() | |
|
247 | bheadrevs.extend(newheadrevs) | |
|
248 | bheadrevs.sort() | |
|
255 | 249 | |
|
256 | 250 | # This loop prunes out two kinds of heads - heads that are |
|
257 | 251 | # superseded by a head in newheadrevs, and newheadrevs that are not |
|
258 | 252 | # heads because an existing head is their descendant. |
|
259 |
while |
|
|
260 |
latest = |
|
|
253 | while newheadrevs: | |
|
254 | latest = newheadrevs.pop() | |
|
261 | 255 | if latest not in bheadrevs: |
|
262 | 256 | continue |
|
263 | 257 | ancestors = set(cl.ancestors([latest], bheadrevs[0])) |
|
264 | 258 | if ancestors: |
|
265 | 259 | bheadrevs = [b for b in bheadrevs if b not in ancestors] |
|
266 | 260 | self[branch] = [cl.node(rev) for rev in bheadrevs] |
|
267 |
tiprev = |
|
|
261 | tiprev = bheadrevs[-1] | |
|
268 | 262 | if tiprev > self.tiprev: |
|
269 | 263 | self.tipnode = cl.node(tiprev) |
|
270 | 264 | self.tiprev = tiprev |
|
1 | NO CONTENT: modified file, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now