comparison mercurial/store.py @ 14092:222c8ec7a274

store: rename the 'opener' argument to 'openertype' The 'opener' argument wasn't, in fact, an actual opener instance, but rather something expected to return an opener. The normal argument, from localrepository, is the scmutil.opener type; hence 'openertype'.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sat, 30 Apr 2011 19:36:48 +0200
parents e24b5e3c2f27
children 9cbff8a39a2a
comparison
equal deleted inserted replaced
14091:0aa60e4e0b76 14092:222c8ec7a274
234 234
235 _data = 'data 00manifest.d 00manifest.i 00changelog.d 00changelog.i' 235 _data = 'data 00manifest.d 00manifest.i 00changelog.d 00changelog.i'
236 236
237 class basicstore(object): 237 class basicstore(object):
238 '''base class for local repository stores''' 238 '''base class for local repository stores'''
239 def __init__(self, path, opener): 239 def __init__(self, path, openertype):
240 self.path = path 240 self.path = path
241 self.createmode = _calcmode(path) 241 self.createmode = _calcmode(path)
242 op = opener(self.path) 242 op = openertype(self.path)
243 op.createmode = self.createmode 243 op.createmode = self.createmode
244 self.opener = scmutil.filteropener(op, encodedir) 244 self.opener = scmutil.filteropener(op, encodedir)
245 245
246 def join(self, f): 246 def join(self, f):
247 return self.path + '/' + encodedir(f) 247 return self.path + '/' + encodedir(f)
283 283
284 def write(self): 284 def write(self):
285 pass 285 pass
286 286
287 class encodedstore(basicstore): 287 class encodedstore(basicstore):
288 def __init__(self, path, opener): 288 def __init__(self, path, openertype):
289 self.path = path + '/store' 289 self.path = path + '/store'
290 self.createmode = _calcmode(self.path) 290 self.createmode = _calcmode(self.path)
291 op = opener(self.path) 291 op = openertype(self.path)
292 op.createmode = self.createmode 292 op.createmode = self.createmode
293 self.opener = scmutil.filteropener(op, encodefilename) 293 self.opener = scmutil.filteropener(op, encodefilename)
294 294
295 def datafiles(self): 295 def datafiles(self):
296 for a, b, size in self._walk('data', True): 296 for a, b, size in self._walk('data', True):
364 if self.entries is None: 364 if self.entries is None:
365 self._load() 365 self._load()
366 return iter(self.entries) 366 return iter(self.entries)
367 367
368 class fncachestore(basicstore): 368 class fncachestore(basicstore):
369 def __init__(self, path, opener, encode): 369 def __init__(self, path, openertype, encode):
370 self.encode = encode 370 self.encode = encode
371 self.path = path + '/store' 371 self.path = path + '/store'
372 self.createmode = _calcmode(self.path) 372 self.createmode = _calcmode(self.path)
373 op = opener(self.path) 373 op = openertype(self.path)
374 op.createmode = self.createmode 374 op.createmode = self.createmode
375 fnc = fncache(op) 375 fnc = fncache(op)
376 self.fncache = fnc 376 self.fncache = fnc
377 377
378 def fncacheopener(path, mode='r', *args, **kw): 378 def fncacheopener(path, mode='r', *args, **kw):
409 ['store/' + f for f in d.split()]) 409 ['store/' + f for f in d.split()])
410 410
411 def write(self): 411 def write(self):
412 self.fncache.write() 412 self.fncache.write()
413 413
414 def store(requirements, path, opener): 414 def store(requirements, path, openertype):
415 if 'store' in requirements: 415 if 'store' in requirements:
416 if 'fncache' in requirements: 416 if 'fncache' in requirements:
417 auxencode = lambda f: _auxencode(f, 'dotencode' in requirements) 417 auxencode = lambda f: _auxencode(f, 'dotencode' in requirements)
418 encode = lambda f: _hybridencode(f, auxencode) 418 encode = lambda f: _hybridencode(f, auxencode)
419 return fncachestore(path, opener, encode) 419 return fncachestore(path, openertype, encode)
420 return encodedstore(path, opener) 420 return encodedstore(path, openertype)
421 return basicstore(path, opener) 421 return basicstore(path, openertype)