mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 14:46:47 +03:00
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:
parent
ae9fb09e62
commit
cb6b745f17
@ -25,6 +25,14 @@ def commonancestorsheads(pfunc, *nodes):
|
|||||||
|
|
||||||
pfunc must return a list of parent vertices for a given vertex.
|
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):
|
if not isinstance(nodes, set):
|
||||||
nodes = set(nodes)
|
nodes = set(nodes)
|
||||||
if nullrev in nodes:
|
if nullrev in nodes:
|
||||||
|
Loading…
Reference in New Issue
Block a user