# HG changeset patch # User Bryan O'Sullivan # Date 1452892489 28800 # Node ID 5b675a5665ef5db6b384c831b2a1ba5046668fc3 # Parent 55394c6fe74ef6ed11218338cf58de07434b1cfe with: use context manager in unbundle diff -r 55394c6fe74e -r 5b675a5665ef mercurial/commands.py --- a/mercurial/commands.py Fri Jan 15 13:14:49 2016 -0800 +++ b/mercurial/commands.py Fri Jan 15 13:14:49 2016 -0800 @@ -6831,8 +6831,7 @@ """ fnames = (fname1,) + fnames - lock = repo.lock() - try: + with repo.lock(): for fname in fnames: f = hg.openpath(ui, fname) gen = exchange.readbundle(ui, f, fname) @@ -6861,8 +6860,6 @@ hint=_('use "hg debugapplystreamclonebundle"')) else: modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname) - finally: - lock.release() return postincoming(ui, repo, modheads, opts.get('update'), None)