##// END OF EJS Templates
bundlerepo: implement safe phasecache...
Eric Sumner -
r23631:b8260abf default
parent child Browse files
Show More
@@ -15,7 +15,7 b' from node import nullid'
15 15 from i18n import _
16 16 import os, tempfile, shutil
17 17 import changegroup, util, mdiff, discovery, cmdutil, scmutil, exchange
18 import localrepo, changelog, manifest, filelog, revlog, error
18 import localrepo, changelog, manifest, filelog, revlog, error, phases
19 19
20 20 class bundlerevlog(revlog.revlog):
21 21 def __init__(self, opener, indexfile, bundle, linkmapper):
@@ -184,6 +184,23 b' class bundlepeer(localrepo.localpeer):'
184 184 def canpush(self):
185 185 return False
186 186
187 class bundlephasecache(phases.phasecache):
188 def __init__(self, *args, **kwargs):
189 super(bundlephasecache, self).__init__(*args, **kwargs)
190 if util.safehasattr(self, 'opener'):
191 self.opener = scmutil.readonlyvfs(self.opener)
192
193 def write(self):
194 raise NotImplementedError
195
196 def _write(self, fp):
197 raise NotImplementedError
198
199 def _updateroots(self, phase, newroots, tr):
200 self.phaseroots[phase] = newroots
201 self.invalidate()
202 self.dirty = True
203
187 204 class bundlerepository(localrepo.localrepository):
188 205 def __init__(self, ui, path, bundlename):
189 206 self._tempparent = None
@@ -226,6 +243,10 b' class bundlerepository(localrepo.localre'
226 243 self.bundlefilespos = {}
227 244
228 245 @localrepo.unfilteredpropertycache
246 def _phasecache(self):
247 return bundlephasecache(self, self._phasedefaults)
248
249 @localrepo.unfilteredpropertycache
229 250 def changelog(self):
230 251 # consume the header if it exists
231 252 self.bundle.changelogheader()
@@ -161,7 +161,7 b' class phasecache(object):'
161 161 def copy(self):
162 162 # Shallow copy meant to ensure isolation in
163 163 # advance/retractboundary(), nothing more.
164 ph = phasecache(None, None, _load=False)
164 ph = self.__class__(None, None, _load=False)
165 165 ph.phaseroots = self.phaseroots[:]
166 166 ph.dirty = self.dirty
167 167 ph.opener = self.opener
General Comments 0
You need to be logged in to leave comments. Login now