Patchwork [06,of,14] streamclone: stop using 'vfs.mustaudit = False'

login
register
mail settings
Submitter Pierre-Yves David
Date July 2, 2017, 2:56 a.m.
Message ID <d368c4c29fea996e537e.1498964191@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21887/
State Accepted
Headers show

Comments

Pierre-Yves David - July 2, 2017, 2:56 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498962394 -7200
#      Sun Jul 02 04:26:34 2017 +0200
# Node ID d368c4c29fea996e537e4abf319d59d6d0362829
# Parent  a03c282caf2afbd387eebc370b13cf5aa017888e
# EXP-Topic vfs.ward
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r d368c4c29fea
streamclone: stop using 'vfs.mustaudit = False'

Now that each call disable the auditing on its own, we can safely drop this the
mustaudit usage. No other code is modified.

Patch

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -213,26 +213,21 @@  def generatev1(repo):
                   (len(entries), total_bytes))
 
     svfs = repo.svfs
-    oldaudit = svfs.mustaudit
     debugflag = repo.ui.debugflag
-    svfs.mustaudit = False
 
     def emitrevlogdata():
-        try:
-            for name, size in entries:
-                if debugflag:
-                    repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
-                # 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', auditpath=False) as fp:
-                        yield fp.read(size)
-                else:
-                    data = svfs(name, auditpath=False)
-                    for chunk in util.filechunkiter(data, limit=size):
-                        yield chunk
-        finally:
-            svfs.mustaudit = oldaudit
+        for name, size in entries:
+            if debugflag:
+                repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
+            # 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', auditpath=False) as fp:
+                    yield fp.read(size)
+            else:
+                data = svfs(name, auditpath=False)
+                for chunk in util.filechunkiter(data, limit=size):
+                    yield chunk
 
     return len(entries), total_bytes, emitrevlogdata()