comparison hgext/mq.py @ 27847:71853c0ba592

with: use context manager in qfinish
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:50 -0800
parents 1e38b9d731c4
children 9bda75a0c783
comparison
equal deleted inserted replaced
27846:63821023ea79 27847:71853c0ba592
3197 if repo['.'].rev() in revs and repo[None].files(): 3197 if repo['.'].rev() in revs and repo[None].files():
3198 ui.warn(_('warning: uncommitted changes in the working directory\n')) 3198 ui.warn(_('warning: uncommitted changes in the working directory\n'))
3199 # queue.finish may changes phases but leave the responsibility to lock the 3199 # queue.finish may changes phases but leave the responsibility to lock the
3200 # repo to the caller to avoid deadlock with wlock. This command code is 3200 # repo to the caller to avoid deadlock with wlock. This command code is
3201 # responsibility for this locking. 3201 # responsibility for this locking.
3202 lock = repo.lock() 3202 with repo.lock():
3203 try:
3204 q.finish(repo, revs) 3203 q.finish(repo, revs)
3205 q.savedirty() 3204 q.savedirty()
3206 finally:
3207 lock.release()
3208 return 0 3205 return 0
3209 3206
3210 @command("qqueue", 3207 @command("qqueue",
3211 [('l', 'list', False, _('list all available queues')), 3208 [('l', 'list', False, _('list all available queues')),
3212 ('', 'active', False, _('print name of active queue')), 3209 ('', 'active', False, _('print name of active queue')),