Show More
@@ -382,6 +382,18 b' class filtervfs(abstractvfs, auditvfs):' | |||||
382 |
|
382 | |||
383 | filteropener = filtervfs |
|
383 | filteropener = filtervfs | |
384 |
|
384 | |||
|
385 | class readonlyvfs(abstractvfs, auditvfs): | |||
|
386 | '''Wrapper vfs preventing any writing.''' | |||
|
387 | ||||
|
388 | def __init__(self, vfs): | |||
|
389 | auditvfs.__init__(self, vfs) | |||
|
390 | ||||
|
391 | def __call__(self, path, mode='r', *args, **kw): | |||
|
392 | if mode not in ('r', 'rb'): | |||
|
393 | raise util.Abort('this vfs is read only') | |||
|
394 | return self.vfs(path, mode, *args, **kw) | |||
|
395 | ||||
|
396 | ||||
385 | def canonpath(root, cwd, myname, auditor=None): |
|
397 | def canonpath(root, cwd, myname, auditor=None): | |
386 | '''return the canonical path of myname, given cwd and root''' |
|
398 | '''return the canonical path of myname, given cwd and root''' | |
387 | if util.endswithsep(root): |
|
399 | if util.endswithsep(root): |
General Comments 0
You need to be logged in to leave comments.
Login now