Mercurial > public > mercurial-scm > hg-stable
diff mercurial/vfs.py @ 40788:34f15db81cf0
vfs: extract the audit path logic into a submethod
This will make it possible to apply it in more cases.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Sun, 02 Jul 2017 04:06:24 +0200 |
parents | 5fe0b880200e |
children | 03bca908d9fb |
line wrap: on
line diff
--- a/mercurial/vfs.py Thu Nov 22 20:01:28 2018 +0100 +++ b/mercurial/vfs.py Sun Jul 02 04:06:24 2017 +0200 @@ -337,6 +337,13 @@ return os.chmod(name, self.createmode & 0o666) + def _auditpath(self, path, mode): + if self._audit: + r = util.checkosfilename(path) + if r: + raise error.Abort("%s: %r" % (r, path)) + self.audit(path, mode=mode) + def __call__(self, path, mode="r", atomictemp=False, notindexed=False, backgroundclose=False, checkambig=False, auditpath=True): '''Open ``path`` file, which is relative to vfs root. @@ -369,11 +376,7 @@ cases (see also issue5418 and issue5584 for detail). ''' if auditpath: - if self._audit: - r = util.checkosfilename(path) - if r: - raise error.Abort("%s: %r" % (r, path)) - self.audit(path, mode=mode) + self._auditpath(path, mode) f = self.join(path) if "b" not in mode: