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