Mercurial > hg
changeset 27804:aa41199a74e2
with: use context manager for wlock in branch
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:46 -0800 |
parents | a8e8950ebd4d |
children | bdaf433192f0 |
files | mercurial/commands.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Jan 15 13:14:46 2016 -0800 +++ b/mercurial/commands.py Fri Jan 15 13:14:46 2016 -0800 @@ -1197,8 +1197,7 @@ ui.write("%s\n" % repo.dirstate.branch()) return - wlock = repo.wlock() - try: + with repo.wlock(): if opts.get('clean'): label = repo[None].p1().branch() repo.dirstate.setbranch(label) @@ -1220,8 +1219,6 @@ if not others: ui.status(_('(branches are permanent and global, ' 'did you want a bookmark?)\n')) - finally: - wlock.release() @command('branches', [('a', 'active', False,