##// 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 from i18n import _
15 from i18n import _
16 import os, tempfile, shutil
16 import os, tempfile, shutil
17 import changegroup, util, mdiff, discovery, cmdutil, scmutil, exchange
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 class bundlerevlog(revlog.revlog):
20 class bundlerevlog(revlog.revlog):
21 def __init__(self, opener, indexfile, bundle, linkmapper):
21 def __init__(self, opener, indexfile, bundle, linkmapper):
@@ -184,6 +184,23 b' class bundlepeer(localrepo.localpeer):'
184 def canpush(self):
184 def canpush(self):
185 return False
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 class bundlerepository(localrepo.localrepository):
204 class bundlerepository(localrepo.localrepository):
188 def __init__(self, ui, path, bundlename):
205 def __init__(self, ui, path, bundlename):
189 self._tempparent = None
206 self._tempparent = None
@@ -226,6 +243,10 b' class bundlerepository(localrepo.localre'
226 self.bundlefilespos = {}
243 self.bundlefilespos = {}
227
244
228 @localrepo.unfilteredpropertycache
245 @localrepo.unfilteredpropertycache
246 def _phasecache(self):
247 return bundlephasecache(self, self._phasedefaults)
248
249 @localrepo.unfilteredpropertycache
229 def changelog(self):
250 def changelog(self):
230 # consume the header if it exists
251 # consume the header if it exists
231 self.bundle.changelogheader()
252 self.bundle.changelogheader()
@@ -161,7 +161,7 b' class phasecache(object):'
161 def copy(self):
161 def copy(self):
162 # Shallow copy meant to ensure isolation in
162 # Shallow copy meant to ensure isolation in
163 # advance/retractboundary(), nothing more.
163 # advance/retractboundary(), nothing more.
164 ph = phasecache(None, None, _load=False)
164 ph = self.__class__(None, None, _load=False)
165 ph.phaseroots = self.phaseroots[:]
165 ph.phaseroots = self.phaseroots[:]
166 ph.dirty = self.dirty
166 ph.dirty = self.dirty
167 ph.opener = self.opener
167 ph.opener = self.opener
General Comments 0
You need to be logged in to leave comments. Login now