comparison mercurial/ancestor.py @ 9915:806e6b6cb8d8

ancestor: improve docstring The term "least common ancestor" is highly ambiguous.
author Sune Foldager <cryo@cyanite.org>
date Tue, 24 Nov 2009 09:49:23 +0100
parents 23429ebd3f9d
children d6512b3e9ac0
comparison
equal deleted inserted replaced
9914:f139814d20b3 9915:806e6b6cb8d8
7 7
8 import heapq 8 import heapq
9 9
10 def ancestor(a, b, pfunc): 10 def ancestor(a, b, pfunc):
11 """ 11 """
12 return the least common ancestor of nodes a and b or None if there 12 return a minimal-distance ancestor of nodes a and b, or None if there is no
13 is no such ancestor. 13 such ancestor. Note that there can be several ancestors with the same
14 (minimal) distance, and the one returned is arbitrary.
14 15
15 pfunc must return a list of parent vertices 16 pfunc must return a list of parent vertices for a given vertex
16 """ 17 """
17 18
18 if a == b: 19 if a == b:
19 return a 20 return a
20 21