[PATCH 1 of 4] scmutil: support background closing for write()
Gregory Szorc
gregory.szorc at gmail.com
Sat Feb 20 23:55:57 UTC 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1456010652 28800
# Sat Feb 20 15:24:12 2016 -0800
# Node ID 5f5a32bf365ee87f37c201df2a667a7332779653
# Parent 8449ef66f732a71008dc887ffd6efbfb6dc64ee0
scmutil: support background closing for write()
Upcoming patches will add background file closer support to
working copy update. This patch adds some plumbing to prepare
for that.
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -271,18 +271,18 @@ class abstractvfs(object):
def read(self, path):
with self(path, 'rb') as fp:
return fp.read()
def readlines(self, path, mode='rb'):
with self(path, mode=mode) as fp:
return fp.readlines()
- def write(self, path, data):
- with self(path, 'wb') as fp:
+ def write(self, path, data, backgroundclose=False):
+ with self(path, 'wb', backgroundclose=backgroundclose) as fp:
return fp.write(data)
def writelines(self, path, data, mode='wb', notindexed=False):
with self(path, mode=mode, notindexed=notindexed) as fp:
return fp.writelines(data)
def append(self, path, data):
with self(path, 'ab') as fp:
More information about the Mercurial-devel
mailing list