diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -110,7 +110,9 @@ def findfile(repo, hash): repo.ui.note(_('Found %s in store\n') % hash) elif inusercache(repo.ui, hash): repo.ui.note(_('Found %s in system cache\n') % hash) - link(usercachepath(repo.ui, hash), storepath(repo, hash)) + path = storepath(repo, hash) + util.makedirs(os.path.dirname(path)) + link(usercachepath(repo.ui, hash), path) else: return None return storepath(repo, hash) diff --git a/mercurial/ignore.py b/mercurial/ignore.py --- a/mercurial/ignore.py +++ b/mercurial/ignore.py @@ -78,6 +78,7 @@ def ignore(root, files, warn): pats[f] = [] fp = open(f) pats[f], warnings = ignorepats(fp) + fp.close() for warning in warnings: warn("%s: %s\n" % (f, warning)) except IOError, inst: diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -800,6 +800,7 @@ class revlog(object): readahead = max(65536, length) df.seek(offset) d = df.read(readahead) + df.close() self._addchunk(offset, d) if readahead > length: return d[:length] diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -79,6 +79,7 @@ class ui(object): try: cfg.read(filename, fp, sections=sections, remap=remap) + fp.close() except error.ConfigError, inst: if trusted: raise