mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
with: use context manager for lock in qimport
This commit is contained in:
parent
3feacd382c
commit
ed2500cd97
@ -2316,8 +2316,7 @@ def qimport(ui, repo, *filename, **opts):
|
||||
|
||||
Returns 0 if import succeeded.
|
||||
"""
|
||||
lock = repo.lock() # cause this may move phase
|
||||
try:
|
||||
with repo.lock(): # cause this may move phase
|
||||
q = repo.mq
|
||||
try:
|
||||
imported = q.qimport(
|
||||
@ -2326,8 +2325,6 @@ def qimport(ui, repo, *filename, **opts):
|
||||
rev=opts.get('rev'), git=opts.get('git'))
|
||||
finally:
|
||||
q.savedirty()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
if imported and opts.get('push') and not opts.get('rev'):
|
||||
return q.push(repo, imported[-1])
|
||||
|
Loading…
Reference in New Issue
Block a user