##// END OF EJS Templates
phases: call filterunknown() in readroots()...
Patrick Mezard -
r16624:3f85cef6 default
parent child Browse files
Show More
@@ -185,7 +185,6 b' class localrepository(repo.repository):'
185 def _phaseroots(self):
185 def _phaseroots(self):
186 self._dirtyphases = False
186 self._dirtyphases = False
187 phaseroots = phases.readroots(self)
187 phaseroots = phases.readroots(self)
188 phases.filterunknown(self, phaseroots)
189 return phaseroots
188 return phaseroots
190
189
191 @propertycache
190 @propertycache
@@ -106,6 +106,24 b' allphases = public, draft, secret = rang'
106 trackedphases = allphases[1:]
106 trackedphases = allphases[1:]
107 phasenames = ['public', 'draft', 'secret']
107 phasenames = ['public', 'draft', 'secret']
108
108
109 def _filterunknown(ui, changelog, phaseroots):
110 """remove unknown nodes from the phase boundary
111
112 Nothing is lost as unknown nodes only hold data for their descendants
113 """
114 updated = False
115 nodemap = changelog.nodemap # to filter unknown nodes
116 for phase, nodes in enumerate(phaseroots):
117 missing = [node for node in nodes if node not in nodemap]
118 if missing:
119 for mnode in missing:
120 ui.debug(
121 'removing unknown node %s from %i-phase boundary\n'
122 % (short(mnode), phase))
123 nodes.symmetric_difference_update(missing)
124 updated = True
125 return updated
126
109 def readroots(repo):
127 def readroots(repo):
110 """Read phase roots from disk"""
128 """Read phase roots from disk"""
111 roots = [set() for i in allphases]
129 roots = [set() for i in allphases]
@@ -123,6 +141,8 b' def readroots(repo):'
123 for f in repo._phasedefaults:
141 for f in repo._phasedefaults:
124 roots = f(repo, roots)
142 roots = f(repo, roots)
125 repo._dirtyphases = True
143 repo._dirtyphases = True
144 if _filterunknown(repo.ui, repo.changelog, roots):
145 repo._dirtyphases = True
126 return roots
146 return roots
127
147
128 def writeroots(repo):
148 def writeroots(repo):
@@ -136,24 +156,6 b' def writeroots(repo):'
136 finally:
156 finally:
137 f.close()
157 f.close()
138
158
139 def filterunknown(repo, phaseroots=None):
140 """remove unknown nodes from the phase boundary
141
142 no data is lost as unknown node only old data for their descentants
143 """
144 if phaseroots is None:
145 phaseroots = repo._phaseroots
146 nodemap = repo.changelog.nodemap # to filter unknown nodes
147 for phase, nodes in enumerate(phaseroots):
148 missing = [node for node in nodes if node not in nodemap]
149 if missing:
150 for mnode in missing:
151 repo.ui.debug(
152 'removing unknown node %s from %i-phase boundary\n'
153 % (short(mnode), phase))
154 nodes.symmetric_difference_update(missing)
155 repo._dirtyphases = True
156
157 def advanceboundary(repo, targetphase, nodes):
159 def advanceboundary(repo, targetphase, nodes):
158 """Add nodes to a phase changing other nodes phases if necessary.
160 """Add nodes to a phase changing other nodes phases if necessary.
159
161
General Comments 0
You need to be logged in to leave comments. Login now