Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.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 | e4bfb9c337f3 |
children | 21b8ce4d3331 |
comparison
equal
deleted
inserted
replaced
14167:0e4753807c93 | 14168:135e244776f0 |
---|---|
45 f.write("\0".join([d] + v) + "\n") | 45 f.write("\0".join([d] + v) + "\n") |
46 f.close() | 46 f.close() |
47 self._dirty = False | 47 self._dirty = False |
48 def add(self, fcl, fco, fca, fd, flags): | 48 def add(self, fcl, fco, fca, fd, flags): |
49 hash = util.sha1(fcl.path()).hexdigest() | 49 hash = util.sha1(fcl.path()).hexdigest() |
50 self._repo.opener("merge/" + hash, "w").write(fcl.data()) | 50 self._repo.opener.write("merge/" + hash, fcl.data()) |
51 self._state[fd] = ['u', hash, fcl.path(), fca.path(), | 51 self._state[fd] = ['u', hash, fcl.path(), fca.path(), |
52 hex(fca.filenode()), fco.path(), flags] | 52 hex(fca.filenode()), fco.path(), flags] |
53 self._dirty = True | 53 self._dirty = True |
54 def __contains__(self, dfile): | 54 def __contains__(self, dfile): |
55 return dfile in self._state | 55 return dfile in self._state |