Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundlerepo.py @ 52859:e26c9cb60454
bundlerepo: improve cleanup on error in `bundlerepo.getremotechanges`
This change makes it so that if there's an error parsing the returned
bundle (or any other error in this block), the temporary bundle files are
still cleaned up.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Mon, 03 Feb 2025 18:31:36 +0000 |
parents | b25208655467 |
children |
line wrap: on
line diff
--- a/mercurial/bundlerepo.py Mon Feb 03 18:27:20 2025 +0000 +++ b/mercurial/bundlerepo.py Mon Feb 03 18:31:36 2025 +0000 @@ -683,11 +683,15 @@ rheads = [x for x in rheads if x not in commonset] state = getremotechanges_state_tracker(peer, incoming, common, rheads) - csets = _getremotechanges_slowpath( - state, ui, repo, bundlename=bundlename, onlyheads=onlyheads - ) - return (state.localrepo, csets, state.cleanup) + try: + csets = _getremotechanges_slowpath( + state, ui, repo, bundlename=bundlename, onlyheads=onlyheads + ) + return (state.localrepo, csets, state.cleanup) + except: # re-raises + state.cleanup() + raise def _create_bundle(state, ui, repo, bundlename, onlyheads):