Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.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 | cb98fed52495 |
children | 9029b1a38c30 |
comparison
equal
deleted
inserted
replaced
14167:0e4753807c93 | 14168:135e244776f0 |
---|---|
1127 cmdlist = [' '.join(c[0]) for c in cmdlist.values()] | 1127 cmdlist = [' '.join(c[0]) for c in cmdlist.values()] |
1128 ui.write("%s\n" % "\n".join(sorted(cmdlist))) | 1128 ui.write("%s\n" % "\n".join(sorted(cmdlist))) |
1129 | 1129 |
1130 def debugfsinfo(ui, path = "."): | 1130 def debugfsinfo(ui, path = "."): |
1131 """show information detected about current filesystem""" | 1131 """show information detected about current filesystem""" |
1132 open('.debugfsinfo', 'w').write('') | 1132 util.writefile('.debugfsinfo', '') |
1133 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no')) | 1133 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no')) |
1134 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no')) | 1134 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no')) |
1135 ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo') | 1135 ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo') |
1136 and 'yes' or 'no')) | 1136 and 'yes' or 'no')) |
1137 os.unlink('.debugfsinfo') | 1137 os.unlink('.debugfsinfo') |
2667 | 2667 |
2668 if not haspatch: | 2668 if not haspatch: |
2669 raise util.Abort(_('no diffs found')) | 2669 raise util.Abort(_('no diffs found')) |
2670 | 2670 |
2671 if msgs: | 2671 if msgs: |
2672 repo.opener('last-message.txt', 'wb').write('\n* * *\n'.join(msgs)) | 2672 repo.opener.write('last-message.txt', '\n* * *\n'.join(msgs)) |
2673 finally: | 2673 finally: |
2674 release(lock, wlock) | 2674 release(lock, wlock) |
2675 | 2675 |
2676 def incoming(ui, repo, source="default", **opts): | 2676 def incoming(ui, repo, source="default", **opts): |
2677 """show new changesets found in source | 2677 """show new changesets found in source |