diff -r 9aaffb22d7d7 -r dfb8f757750c mercurial/subrepo.py --- a/mercurial/subrepo.py Fri Jun 20 00:21:19 2014 +0900 +++ b/mercurial/subrepo.py Fri Jun 20 00:21:19 2014 +0900 @@ -576,8 +576,10 @@ if not os.path.exists(cachefile): return '' fd = open(cachefile, 'r') - pullstate = fd.readlines() - fd.close() + try: + pullstate = fd.readlines() + finally: + fd.close() return pullstate def _cachestorehash(self, remotepath):