Mercurial > public > mercurial-scm > hg
comparison hgext/extdiff.py @ 14168:135e244776f0
prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.
This implies:
- changing opener(...).read() calls to opener.read(...)
- changing opener(...).write() calls to opener.write(...)
- changing open(...).read(...) to util.readfile(...)
- changing open(...).write(...) to util.writefile(...)
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Mon, 02 May 2011 10:11:18 +0200 |
parents | 1c38777f7b8a |
children | df2399663392 |
comparison
equal
deleted
inserted
replaced
14167:0e4753807c93 | 14168:135e244776f0 |
---|---|
95 fctx = ctx[wfn] | 95 fctx = ctx[wfn] |
96 data = repo.wwritedata(wfn, fctx.data()) | 96 data = repo.wwritedata(wfn, fctx.data()) |
97 if 'l' in fctx.flags(): | 97 if 'l' in fctx.flags(): |
98 wopener.symlink(data, wfn) | 98 wopener.symlink(data, wfn) |
99 else: | 99 else: |
100 wopener(wfn, 'w').write(data) | 100 wopener.write(wfn, data) |
101 if 'x' in fctx.flags(): | 101 if 'x' in fctx.flags(): |
102 util.set_flags(dest, False, True) | 102 util.set_flags(dest, False, True) |
103 if node is None: | 103 if node is None: |
104 fns_and_mtime.append((dest, repo.wjoin(fn), | 104 fns_and_mtime.append((dest, repo.wjoin(fn), |
105 os.lstat(dest).st_mtime)) | 105 os.lstat(dest).st_mtime)) |