Show More
@@ -9,21 +9,19 b' import heapq' | |||
|
9 | 9 | import util |
|
10 | 10 | from node import nullrev |
|
11 | 11 | |
|
12 |
def ancestors(pfunc, * |
|
|
13 | """ | |
|
14 | Returns the common ancestors of a and b that are furthest from a | |
|
15 | root (as measured by longest path). | |
|
12 | def commonancestorsheads(pfunc, *nodes): | |
|
13 | """Returns a set with the heads of all common ancestors of all nodes, | |
|
14 | heads(::nodes[0] and ::nodes[1] and ...) . | |
|
16 | 15 | |
|
17 | 16 | pfunc must return a list of parent vertices for a given vertex. |
|
18 | 17 | """ |
|
19 |
if not isinstance( |
|
|
20 |
|
|
|
21 |
if nullrev in |
|
|
18 | if not isinstance(nodes, set): | |
|
19 | nodes = set(nodes) | |
|
20 | if nullrev in nodes: | |
|
22 | 21 | return set() |
|
23 |
if len( |
|
|
24 |
return |
|
|
22 | if len(nodes) <= 1: | |
|
23 | return nodes | |
|
25 | 24 | |
|
26 | def candidates(nodes): | |
|
27 | 25 |
|
|
28 | 26 |
|
|
29 | 27 |
|
@@ -67,6 +65,13 b' def ancestors(pfunc, *orignodes):' | |||
|
67 | 65 |
|
|
68 | 66 |
|
|
69 | 67 | |
|
68 | def ancestors(pfunc, *orignodes): | |
|
69 | """ | |
|
70 | Returns the common ancestors of a and b that are furthest from a | |
|
71 | root (as measured by longest path). | |
|
72 | ||
|
73 | pfunc must return a list of parent vertices for a given vertex. | |
|
74 | """ | |
|
70 | 75 | def deepest(nodes): |
|
71 | 76 | interesting = {} |
|
72 | 77 | count = max(nodes) + 1 |
@@ -123,7 +128,7 b' def ancestors(pfunc, *orignodes):' | |||
|
123 | 128 | k |= i |
|
124 | 129 | return set(n for (i, n) in mapping if k & i) |
|
125 | 130 | |
|
126 |
gca = c |
|
|
131 | gca = commonancestorsheads(pfunc, *orignodes) | |
|
127 | 132 | |
|
128 | 133 | if len(gca) <= 1: |
|
129 | 134 | return gca |
General Comments 0
You need to be logged in to leave comments.
Login now