diff mercurial/streamclone.py @ 33257:15e9cbe6ae49

vfs: simplify path audit disabling in stream clone The whole 'mustaudit' API is quite complex compared to its actual usage by its unique user in stream clone. Instead we add a "auditpath" parameter to 'vfs.__call_'. The stream clone code then explicitly open files with path auditing disabled. The 'mustaudit' API will be cleaned up in the next changeset.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 02 Jul 2017 02:28:04 +0200
parents b045344fe35e
children 761ccfeff8b1
line wrap: on
line diff
--- a/mercurial/streamclone.py	Sun Jul 02 02:19:05 2017 +0200
+++ b/mercurial/streamclone.py	Sun Jul 02 02:28:04 2017 +0200
@@ -225,10 +225,11 @@
                 # partially encode name over the wire for backwards compat
                 yield '%s\0%d\n' % (store.encodedir(name), size)
                 if size <= 65536:
-                    with svfs(name, 'rb') as fp:
+                    with svfs(name, 'rb', auditpath=False) as fp:
                         yield fp.read(size)
                 else:
-                    for chunk in util.filechunkiter(svfs(name), limit=size):
+                    data = svfs(name, auditpath=False)
+                    for chunk in util.filechunkiter(data, limit=size):
                         yield chunk
         finally:
             svfs.mustaudit = oldaudit