mercurial/hbisect.py
changeset 49503 c6a1beba27e9
parent 49467 3ef153aa1eed
child 51901 f4733654f144
equal deleted inserted replaced
49502:7c93e38a0bbd 49503:c6a1beba27e9
   113         if y < perfect and rev not in skip:  # all downhill from here?
   113         if y < perfect and rev not in skip:  # all downhill from here?
   114             # poison children
   114             # poison children
   115             poison.update(children.get(rev, []))
   115             poison.update(children.get(rev, []))
   116             continue
   116             continue
   117 
   117 
       
   118         unvisited = []
   118         for c in children.get(rev, []):
   119         for c in children.get(rev, []):
   119             if ancestors[c]:
   120             if ancestors[c]:
   120                 ancestors[c] = list(set(ancestors[c] + a))
   121                 ancestors[c] = list(set(ancestors[c] + a))
   121             else:
   122             else:
       
   123                 unvisited.append(c)
       
   124 
       
   125         # Reuse existing ancestor list for the first unvisited child to avoid
       
   126         # excessive copying for linear portions of history.
       
   127         if unvisited:
       
   128             first = unvisited.pop(0)
       
   129             for c in unvisited:
   122                 ancestors[c] = a + [c]
   130                 ancestors[c] = a + [c]
       
   131             a.append(first)
       
   132             ancestors[first] = a
   123 
   133 
   124     assert best_rev is not None
   134     assert best_rev is not None
   125     best_node = changelog.node(best_rev)
   135     best_node = changelog.node(best_rev)
   126 
   136 
   127     return ([best_node], tot, good)
   137     return ([best_node], tot, good)