diff -r 7be6371c732e -r ed44a66fd7ae mercurial/cmdutil.py --- a/mercurial/cmdutil.py Fri Jan 15 13:14:45 2016 -0800 +++ b/mercurial/cmdutil.py Fri Jan 15 13:14:45 2016 -0800 @@ -2421,16 +2421,13 @@ if ui.verbose or not m.exact(f): ui.status(_('removing %s\n') % m.rel(f)) - wlock = repo.wlock() - try: + with repo.wlock(): if not after: for f in list: if f in added: continue # we never unlink added files on remove util.unlinkpath(repo.wjoin(f), ignoremissing=True) repo[None].forget(list) - finally: - wlock.release() return ret