##// END OF EJS Templates
dagop: simplify dict/set reuse condition in subsetparentswalker...
Yuya Nishihara -
r45146:25436f83 default
parent child Browse files
Show More
@@ -449,12 +449,18 b' class subsetparentswalker(object):'
449 # - one of the parents is not active,
449 # - one of the parents is not active,
450 # - or descendants' parents are unresolved.
450 # - or descendants' parents are unresolved.
451 if not bothparentsactive or unresolved or resolved:
451 if not bothparentsactive or unresolved or resolved:
452 if len(parentrevs) > 1:
452 if len(parentrevs) <= 1:
453 # can avoid copying the tracking pointer
454 parentpointers = [(unresolved, resolved)]
455 else:
456 parentpointers = [
457 (unresolved, resolved),
458 (unresolved.copy(), resolved.copy()),
459 ]
453 # 'rev' is a merge revision. increment the pending count
460 # 'rev' is a merge revision. increment the pending count
454 # as the 'unresolved' dict will be duplicated.
461 # as the 'unresolved' dict will be duplicated.
455 for r in unresolved:
462 for r in unresolved:
456 pendingcnt[r] += 1
463 pendingcnt[r] += 1
457 reusable = True # can we avoid copying the tracking pointer?
458 for i, p in enumerate(parentrevs):
464 for i, p in enumerate(parentrevs):
459 assert p < rev
465 assert p < rev
460 heapq.heappush(tovisit, -p)
466 heapq.heappush(tovisit, -p)
@@ -462,6 +468,7 b' class subsetparentswalker(object):'
462 # 'p' is a fork revision. concatenate tracking pointers
468 # 'p' is a fork revision. concatenate tracking pointers
463 # and decrement the pending count accordingly.
469 # and decrement the pending count accordingly.
464 knownunresolved, knownresolved = pointers[p]
470 knownunresolved, knownresolved = pointers[p]
471 unresolved, resolved = parentpointers[i]
465 for r, c in unresolved.items():
472 for r, c in unresolved.items():
466 c += [b'1', b'2'][i]
473 c += [b'1', b'2'][i]
467 if r in knownunresolved:
474 if r in knownunresolved:
@@ -475,11 +482,8 b' class subsetparentswalker(object):'
475 # simply propagate the 'resolved' set as deduplicating
482 # simply propagate the 'resolved' set as deduplicating
476 # 'unresolved' here would be slightly complicated.
483 # 'unresolved' here would be slightly complicated.
477 knownresolved.update(resolved)
484 knownresolved.update(resolved)
478 elif reusable:
479 pointers[p] = (unresolved, resolved)
480 reusable = False
481 else:
485 else:
482 pointers[p] = (unresolved.copy(), resolved.copy())
486 pointers[p] = parentpointers[i]
483
487
484 # then, populate the active parents directly and add the current
488 # then, populate the active parents directly and add the current
485 # 'rev' to the tracking pointers of the inactive parents.
489 # 'rev' to the tracking pointers of the inactive parents.
General Comments 0
You need to be logged in to leave comments. Login now