diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1733,8 +1733,8 @@ def unbundle(repo, cg, heads, source, ur # push can proceed if not util.safehasattr(cg, 'params'): # legacy case: bundle1 (changegroup 01) - lockandtr[1] = repo.lock() - r = cg.apply(repo, source, url) + with repo.lock(): + r = cg.apply(repo, source, url) else: r = None try: