Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 13400:14f3795a5ed7
explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 15:23:01 +0100 |
parents | 3e66eec9a814 |
children | 5e57c199848d |
comparison
equal
deleted
inserted
replaced
13399:eff102facb15 | 13400:14f3795a5ed7 |
---|---|
748 fp = cmdutil.make_file(repo, opts.get('output'), ctx.node(), pathname=abs) | 748 fp = cmdutil.make_file(repo, opts.get('output'), ctx.node(), pathname=abs) |
749 data = ctx[abs].data() | 749 data = ctx[abs].data() |
750 if opts.get('decode'): | 750 if opts.get('decode'): |
751 data = repo.wwritedata(abs, data) | 751 data = repo.wwritedata(abs, data) |
752 fp.write(data) | 752 fp.write(data) |
753 fp.close() | |
753 err = 0 | 754 err = 0 |
754 return err | 755 return err |
755 | 756 |
756 def clone(ui, source, dest=None, **opts): | 757 def clone(ui, source, dest=None, **opts): |
757 """make a copy of an existing repository | 758 """make a copy of an existing repository |