##// END OF EJS Templates
hidden: add a function returning ancestors of revs within a domain...
marmoute -
r32474:1d70ec85 default
parent child Browse files
Show More
@@ -92,6 +92,43 b' def _getstatichidden(repo):'
92 92 heappush(heap, -parent)
93 93 return hidden
94 94
95 def _domainancestors(pfunc, revs, domain):
96 """return ancestors of 'revs' within 'domain'
97
98 - pfunc(r): a funtion returning parent of 'r',
99 - revs: iterable of revnum,
100 - domain: consistent set of revnum.
101
102 The domain must be consistent: no connected subset are the ancestors of
103 another connected subset. In other words, if the parents of a revision are
104 not in the domains, no other ancestors of that revision. For example, with
105 the following graph:
106
107 F
108 |
109 E
110 | D
111 | |
112 | C
113 |/
114 B
115 |
116 A
117
118 If C, D, E and F are in the domain but B is not, A cannot be ((A) is an
119 ancestors disconnected subset disconnected of (C+D)).
120
121 (Ancestors are returned inclusively)
122 """
123 stack = list(revs)
124 ancestors = set(stack)
125 while stack:
126 for p in pfunc(stack.pop()):
127 if p != nullrev and p in domain and p not in ancestors:
128 ancestors.add(p)
129 stack.append(p)
130 return ancestors
131
95 132 cacheversion = 1
96 133 cachefile = 'cache/hidden'
97 134
General Comments 0
You need to be logged in to leave comments. Login now