Additional info in function comment for commonancestorheads

Summary: Added to commonancestorshead function  explaining how the algorithm works.

Reviewed By: DurhamG

Differential Revision: D8415752

fbshipit-source-id: 68e77b0b1f7afb54b88b77084eb371abeeae8ab0
This commit is contained in:
Matthew Dippel 2018-06-20 09:28:02 -07:00 committed by Facebook Github Bot
parent ae9fb09e62
commit cb6b745f17

View File

@ -25,6 +25,14 @@ def commonancestorsheads(pfunc, *nodes):
pfunc must return a list of parent vertices for a given vertex.
"""
# Each node in 'nodes' is given a unique marker implemented as bit masks.
# A node iterates over its parents, passing its set of markers on to them.
# When a node receives multiple markers, that indicates it is an ancestor of
# the corresponding nodes. A node that receives all the markers is
# a common ancestor.
#
# This process continues until all potential ancestors have been found, and
# those which are not heads are ruled out.
if not isinstance(nodes, set):
nodes = set(nodes)
if nullrev in nodes: