comparison mercurial/scmutil.py @ 28868:2ada62388bb1

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 20 Feb 2016 15:24:12 -0800 (2016-02-20)
parents d3f1b7ee5e70
children 826d457df138
comparison
equal deleted inserted replaced
28867:87de4a22e8c2 28868:2ada62388bb1
274 274
275 def readlines(self, path, mode='rb'): 275 def readlines(self, path, mode='rb'):
276 with self(path, mode=mode) as fp: 276 with self(path, mode=mode) as fp:
277 return fp.readlines() 277 return fp.readlines()
278 278
279 def write(self, path, data): 279 def write(self, path, data, backgroundclose=False):
280 with self(path, 'wb') as fp: 280 with self(path, 'wb', backgroundclose=backgroundclose) as fp:
281 return fp.write(data) 281 return fp.write(data)
282 282
283 def writelines(self, path, data, mode='wb', notindexed=False): 283 def writelines(self, path, data, mode='wb', notindexed=False):
284 with self(path, mode=mode, notindexed=notindexed) as fp: 284 with self(path, mode=mode, notindexed=notindexed) as fp:
285 return fp.writelines(data) 285 return fp.writelines(data)