##// END OF EJS Templates
revlog: overwrite revlog config through copy of the config object...
marmoute -
r51923:177e7d6b default
parent child Browse files
Show More
@@ -241,8 +241,13 b' FILE_TOO_SHORT_MSG = _('
241 241 hexdigits = b'0123456789abcdefABCDEF'
242 242
243 243
244 class _Config:
245 def copy(self):
246 return self.__class__(**self.__dict__)
247
248
244 249 @attr.s()
245 class FeatureConfig:
250 class FeatureConfig(_Config):
246 251 """Hold configuration values about the available revlog features"""
247 252
248 253 # the default compression engine
@@ -265,9 +270,14 b' class FeatureConfig:'
265 270 # can ellipsis commit be used
266 271 enable_ellipsis = attr.ib(default=False)
267 272
273 def copy(self):
274 new = super().copy()
275 new.compression_engine_options = self.compression_engine_options.copy()
276 return new
277
268 278
269 279 @attr.s()
270 class DataConfig:
280 class DataConfig(_Config):
271 281 """Hold configuration value about how the revlog data are read"""
272 282
273 283 # should we try to open the "pending" version of the revlog
@@ -297,7 +307,7 b' class DataConfig:'
297 307
298 308
299 309 @attr.s()
300 class DeltaConfig:
310 class DeltaConfig(_Config):
301 311 """Hold configuration value about how new delta are computed
302 312
303 313 Some attributes are duplicated from DataConfig to help havign each object
@@ -3375,9 +3385,8 b' class revlog:'
3375 3385
3376 3386 # lazydelta and lazydeltabase controls whether to reuse a cached delta,
3377 3387 # if possible.
3378 oldlazydelta = destrevlog._lazydelta
3379 oldlazydeltabase = destrevlog._lazydeltabase
3380 oldamd = destrevlog._deltabothparents
3388 old_delta_config = destrevlog.delta_config
3389 destrevlog.delta_config = destrevlog.delta_config.copy()
3381 3390
3382 3391 try:
3383 3392 if deltareuse == self.DELTAREUSEALWAYS:
@@ -3390,7 +3399,9 b' class revlog:'
3390 3399 destrevlog.delta_config.lazy_delta_base = False
3391 3400 destrevlog.delta_config.lazy_delta = False
3392 3401
3393 delta_both_parents = forcedeltabothparents or oldamd
3402 delta_both_parents = (
3403 forcedeltabothparents or old_delta_config.delta_both_parents
3404 )
3394 3405 destrevlog.delta_config.delta_both_parents = delta_both_parents
3395 3406
3396 3407 with self.reading():
@@ -3404,9 +3415,7 b' class revlog:'
3404 3415 )
3405 3416
3406 3417 finally:
3407 destrevlog.delta_config.lazy_delta = oldlazydelta
3408 destrevlog.delta_config.lazy_delta_base = oldlazydeltabase
3409 destrevlog.delta_config.delta_both_parents = oldamd
3418 destrevlog.delta_config = old_delta_config
3410 3419
3411 3420 def _clone(
3412 3421 self,
@@ -371,7 +371,10 b' slicingdata = ['
371 371
372 372
373 373 def slicingtest(rlog):
374 oldmin = rlog._srmingapsize
374 old_delta_config = rlog.delta_config
375 old_data_config = rlog.data_config
376 rlog.delta_config = rlog.delta_config.copy()
377 rlog.data_config = rlog.data_config.copy()
375 378 try:
376 379 # the test revlog is small, we remove the floor under which we
377 380 # slicing is diregarded.
@@ -388,8 +391,8 b' def slicingtest(rlog):'
388 391 print(' expected: %s' % expected)
389 392 print(' result: %s' % result)
390 393 finally:
391 rlog.data_config.sr_min_gap_size = oldmin
392 rlog.delta_config.sr_min_gap_size = oldmin
394 rlog.delta_config = old_delta_config
395 rlog.data_config = old_data_config
393 396
394 397
395 398 def md5sum(s):
General Comments 0
You need to be logged in to leave comments. Login now