Show More
@@ -166,7 +166,10 b' class BranchMapCache:' | |||
|
166 | 166 | |
|
167 | 167 | def write_delayed(self, repo): |
|
168 | 168 | unfi = repo.unfiltered() |
|
169 | for filtername, cache in self._per_filter.items(): | |
|
169 | for filtername in repoviewutil.get_ordered_subset(): | |
|
170 | cache = self._per_filter.get(filtername) | |
|
171 | if cache is None: | |
|
172 | continue | |
|
170 | 173 | if cache._delayed: |
|
171 | 174 | if filtername is None: |
|
172 | 175 | repo = unfi |
@@ -6,6 +6,7 b'' | |||
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | from .. import error | |
|
9 | 10 | |
|
10 | 11 | ### Nearest subset relation |
|
11 | 12 | # Nearest subset of filter X is a filter Y so that: |
@@ -21,3 +22,30 b' subsettable = {' | |||
|
21 | 22 | b'served': b'immutable', |
|
22 | 23 | b'immutable': b'base', |
|
23 | 24 | } |
|
25 | ||
|
26 | ||
|
27 | def get_ordered_subset(): | |
|
28 | """return a list of subset name from dependencies to dependents""" | |
|
29 | _unfinalized = set(subsettable.values()) | |
|
30 | ordered = [] | |
|
31 | ||
|
32 | # the subset table is expected to be small so we do the stupid N² version | |
|
33 | # of the algorithm | |
|
34 | while _unfinalized: | |
|
35 | this_level = [] | |
|
36 | for candidate in _unfinalized: | |
|
37 | dependency = subsettable.get(candidate) | |
|
38 | if dependency not in _unfinalized: | |
|
39 | this_level.append(candidate) | |
|
40 | ||
|
41 | if not this_level: | |
|
42 | msg = "cyclic dependencies in repoview subset %r" | |
|
43 | msg %= subsettable | |
|
44 | raise error.ProgrammingError(msg) | |
|
45 | ||
|
46 | this_level.sort(key=lambda x: x if x is not None else '') | |
|
47 | ||
|
48 | ordered.extend(this_level) | |
|
49 | _unfinalized.difference_update(this_level) | |
|
50 | ||
|
51 | return ordered |
General Comments 0
You need to be logged in to leave comments.
Login now