diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -206,3 +206,6 @@ class bundlerepository(localrepo.localre else: return filelog.filelog(self.opener, f) + def close(self): + """Close assigned bundle file immediately.""" + self.bundlefile.close() diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1811,7 +1811,7 @@ def incoming(ui, repo, source="default", ui.write("\n") if cleanup: - os.close(fd) + other.close() # explicit close for unlink os.unlink(cleanup) def init(ui, dest="."):