Mercurial > public > mercurial-scm > hg-stable
diff hgext/transplant.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 | 8a0fca925992 |
children | 8f551386abf0 |
line wrap: on
line diff
--- a/hgext/transplant.py Mon May 02 10:11:05 2011 +0200 +++ b/hgext/transplant.py Mon May 02 10:11:18 2011 +0200 @@ -39,7 +39,7 @@ def read(self): abspath = os.path.join(self.path, self.transplantfile) if self.transplantfile and os.path.exists(abspath): - for line in self.opener(self.transplantfile).read().splitlines(): + for line in self.opener.read(self.transplantfile).splitlines(): lnode, rnode = map(revlog.bin, line.split(':')) list = self.transplants.setdefault(rnode, []) list.append(transplantentry(lnode, rnode)) @@ -318,7 +318,7 @@ nodes = [] merges = [] cur = nodes - for line in self.opener('series').read().splitlines(): + for line in self.opener.read('series').splitlines(): if line.startswith('# Merges'): cur = merges continue