Show More
@@ -109,24 +109,6 b' allphases = public, draft, secret = rang' | |||||
109 | trackedphases = allphases[1:] |
|
109 | trackedphases = allphases[1:] | |
110 | phasenames = ['public', 'draft', 'secret'] |
|
110 | phasenames = ['public', 'draft', 'secret'] | |
111 |
|
111 | |||
112 | def _filterunknown(ui, changelog, phaseroots): |
|
|||
113 | """remove unknown nodes from the phase boundary |
|
|||
114 |
|
||||
115 | Nothing is lost as unknown nodes only hold data for their descendants. |
|
|||
116 | """ |
|
|||
117 | updated = False |
|
|||
118 | nodemap = changelog.nodemap # to filter unknown nodes |
|
|||
119 | for phase, nodes in enumerate(phaseroots): |
|
|||
120 | missing = [node for node in nodes if node not in nodemap] |
|
|||
121 | if missing: |
|
|||
122 | for mnode in missing: |
|
|||
123 | ui.debug( |
|
|||
124 | 'removing unknown node %s from %i-phase boundary\n' |
|
|||
125 | % (short(mnode), phase)) |
|
|||
126 | nodes.symmetric_difference_update(missing) |
|
|||
127 | updated = True |
|
|||
128 | return updated |
|
|||
129 |
|
||||
130 | def _readroots(repo, phasedefaults=None): |
|
112 | def _readroots(repo, phasedefaults=None): | |
131 | """Read phase roots from disk |
|
113 | """Read phase roots from disk | |
132 |
|
114 | |||
@@ -156,8 +138,6 b' def _readroots(repo, phasedefaults=None)' | |||||
156 | for f in phasedefaults: |
|
138 | for f in phasedefaults: | |
157 | roots = f(repo, roots) |
|
139 | roots = f(repo, roots) | |
158 | dirty = True |
|
140 | dirty = True | |
159 | if _filterunknown(repo.ui, repo.changelog, roots): |
|
|||
160 | dirty = True |
|
|||
161 | return roots, dirty |
|
141 | return roots, dirty | |
162 |
|
142 | |||
163 | class phasecache(object): |
|
143 | class phasecache(object): | |
@@ -165,8 +145,9 b' class phasecache(object):' | |||||
165 | if _load: |
|
145 | if _load: | |
166 | # Cheap trick to allow shallow-copy without copy module |
|
146 | # Cheap trick to allow shallow-copy without copy module | |
167 | self.phaseroots, self.dirty = _readroots(repo, phasedefaults) |
|
147 | self.phaseroots, self.dirty = _readroots(repo, phasedefaults) | |
|
148 | self._phaserevs = None | |||
|
149 | self.filterunknown(repo) | |||
168 | self.opener = repo.sopener |
|
150 | self.opener = repo.sopener | |
169 | self._phaserevs = None |
|
|||
170 |
|
151 | |||
171 | def copy(self): |
|
152 | def copy(self): | |
172 | # Shallow copy meant to ensure isolation in |
|
153 | # Shallow copy meant to ensure isolation in | |
@@ -267,6 +248,26 b' class phasecache(object):' | |||||
267 | self._updateroots(targetphase, currentroots) |
|
248 | self._updateroots(targetphase, currentroots) | |
268 | repo.invalidatevolatilesets() |
|
249 | repo.invalidatevolatilesets() | |
269 |
|
250 | |||
|
251 | def filterunknown(self, repo): | |||
|
252 | """remove unknown nodes from the phase boundary | |||
|
253 | ||||
|
254 | Nothing is lost as unknown nodes only hold data for their descendants. | |||
|
255 | """ | |||
|
256 | filtered = False | |||
|
257 | nodemap = repo.changelog.nodemap # to filter unknown nodes | |||
|
258 | for phase, nodes in enumerate(self.phaseroots): | |||
|
259 | missing = [node for node in nodes if node not in nodemap] | |||
|
260 | if missing: | |||
|
261 | for mnode in missing: | |||
|
262 | repo.ui.debug( | |||
|
263 | 'removing unknown node %s from %i-phase boundary\n' | |||
|
264 | % (short(mnode), phase)) | |||
|
265 | nodes.symmetric_difference_update(missing) | |||
|
266 | filtered = True | |||
|
267 | if filtered: | |||
|
268 | self.dirty = True | |||
|
269 | self._phaserevs = None | |||
|
270 | ||||
270 | def advanceboundary(repo, targetphase, nodes): |
|
271 | def advanceboundary(repo, targetphase, nodes): | |
271 | """Add nodes to a phase changing other nodes phases if necessary. |
|
272 | """Add nodes to a phase changing other nodes phases if necessary. | |
272 |
|
273 |
General Comments 0
You need to be logged in to leave comments.
Login now