Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 18213:c38a62af000e
vfs: add a read only vfs
This read only wrapper is intended to be used bundle repo. See follow up commit
for details.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 04 Jan 2013 01:07:25 +0100 |
parents | 2c1276825e93 |
children | 216230643ae2 |
comparison
equal
deleted
inserted
replaced
18212:493778b5fe9f | 18213:c38a62af000e |
---|---|
379 return self.vfs.join(self._filter(path)) | 379 return self.vfs.join(self._filter(path)) |
380 else: | 380 else: |
381 return self.vfs.join(path) | 381 return self.vfs.join(path) |
382 | 382 |
383 filteropener = filtervfs | 383 filteropener = filtervfs |
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 | |
384 | 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): |
388 rootsep = root | 400 rootsep = root |