equal
deleted
inserted
replaced
57 if p != nullrev and p in hideable: |
57 if p != nullrev and p in hideable: |
58 blockers.add(r) |
58 blockers.add(r) |
59 break |
59 break |
60 return blockers |
60 return blockers |
61 |
61 |
62 def _domainancestors(pfunc, revs, domain): |
62 def _revealancestors(pfunc, hidden, revs, domain): |
63 """return ancestors of 'revs' within 'domain' |
63 """reveals contiguous chains of hidden ancestors of 'revs' within 'domain' |
|
64 by removing them from 'hidden' |
64 |
65 |
65 - pfunc(r): a funtion returning parent of 'r', |
66 - pfunc(r): a funtion returning parent of 'r', |
|
67 - hidden: the (preliminary) hidden revisions, to be updated |
66 - revs: iterable of revnum, |
68 - revs: iterable of revnum, |
67 - domain: consistent set of revnum. |
69 - domain: consistent set of revnum. |
68 |
70 |
69 The domain must be consistent: no connected subset are the ancestors of |
71 The domain must be consistent: no connected subset are the ancestors of |
70 another connected subset. In other words, if the parents of a revision are |
72 another connected subset. In other words, if the parents of a revision are |
83 A |
85 A |
84 |
86 |
85 If C, D, E and F are in the domain but B is not, A cannot be ((A) is an |
87 If C, D, E and F are in the domain but B is not, A cannot be ((A) is an |
86 ancestors disconnected subset disconnected of (C+D)). |
88 ancestors disconnected subset disconnected of (C+D)). |
87 |
89 |
88 (Ancestors are returned inclusively) |
90 (Ancestors are revealed inclusively, i.e. the elements in 'revs' are |
|
91 also revealed) |
89 """ |
92 """ |
90 stack = list(revs) |
93 stack = list(revs) |
91 ancestors = set(stack) |
94 hidden -= set(stack) |
92 while stack: |
95 while stack: |
93 for p in pfunc(stack.pop()): |
96 for p in pfunc(stack.pop()): |
94 if p != nullrev and p in domain and p not in ancestors: |
97 if p != nullrev and p in domain and p in hidden: |
95 ancestors.add(p) |
98 hidden.remove(p) |
96 stack.append(p) |
99 stack.append(p) |
97 return ancestors |
|
98 |
100 |
99 def computehidden(repo): |
101 def computehidden(repo): |
100 """compute the set of hidden revision to filter |
102 """compute the set of hidden revision to filter |
101 |
103 |
102 During most operation hidden should be filtered.""" |
104 During most operation hidden should be filtered.""" |
112 |
114 |
113 # check if we have wd parents, bookmarks or tags pointing to hidden |
115 # check if we have wd parents, bookmarks or tags pointing to hidden |
114 # changesets and remove those. |
116 # changesets and remove those. |
115 blockers |= (hidden & pinnedrevs(repo)) |
117 blockers |= (hidden & pinnedrevs(repo)) |
116 if blockers: |
118 if blockers: |
117 hidden = hidden - _domainancestors(pfunc, blockers, mutable) |
119 # don't modify possibly cached result of hideablerevs() |
|
120 hidden = hidden.copy() |
|
121 _revealancestors(pfunc, hidden, blockers, mutable) |
118 return frozenset(hidden) |
122 return frozenset(hidden) |
119 |
123 |
120 def computeunserved(repo): |
124 def computeunserved(repo): |
121 """compute the set of revision that should be filtered when used a server |
125 """compute the set of revision that should be filtered when used a server |
122 |
126 |