##// END OF EJS Templates
vfs: give all vfs an options attribute by default...
marmoute -
r43295:3518da50 default
parent child Browse files
Show More
@@ -22,6 +22,7 b" def binopen(path, mode=b'rb'):"
22 22 if b'b' not in mode:
23 23 mode = mode + b'b'
24 24 return open(path, pycompat.sysstr(mode))
25 binopen.options = {}
25 26
26 27 def printb(data, end=b'\n'):
27 28 sys.stdout.flush()
@@ -355,7 +355,7 b' class revlog(object):'
355 355
356 356 def _loadindex(self):
357 357 mmapindexthreshold = None
358 opts = getattr(self.opener, 'options', {}) or {}
358 opts = self.opener.options
359 359
360 360 if 'revlogv2' in opts:
361 361 newversionflags = REVLOGV2 | FLAG_INLINE_DATA
@@ -363,7 +363,7 b' class revlog(object):'
363 363 newversionflags = REVLOGV1 | FLAG_INLINE_DATA
364 364 if 'generaldelta' in opts:
365 365 newversionflags |= FLAG_GENERALDELTA
366 elif 'revlogv0' in getattr(self.opener, 'options', {}):
366 elif 'revlogv0' in self.opener.options:
367 367 newversionflags = REVLOGV0
368 368 else:
369 369 newversionflags = REVLOG_DEFAULT_VERSION
@@ -115,6 +115,7 b' def build_opener(ui, authinfo):'
115 115 class statichttpvfs(vfsmod.abstractvfs):
116 116 def __init__(self, base):
117 117 self.base = base
118 self.options = {}
118 119
119 120 def __call__(self, path, mode='r', *args, **kw):
120 121 if mode not in ('r', 'rb'):
@@ -327,6 +327,7 b' class vfs(abstractvfs):'
327 327 self.audit = (lambda path, mode=None: True)
328 328 self.createmode = None
329 329 self._trustnlink = None
330 self.options = {}
330 331
331 332 @util.propertycache
332 333 def _cansymlink(self):
@@ -53,6 +53,7 b' We approximate that by reducing the read'
53 53 > def wrapper(*a, **kwargs):
54 54 > f = o(*a, **kwargs)
55 55 > return singlebyteread(f)
56 > wrapper.options = o.options
56 57 > return wrapper
57 58 >
58 59 > cl = changelog.changelog(opener(b'.hg/store'))
General Comments 0
You need to be logged in to leave comments. Login now