mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
with: use context manager for wlock in overriderevert
This commit is contained in:
parent
3538da229b
commit
b83485ed82
@ -717,8 +717,7 @@ def overriderevert(orig, ui, repo, ctx, parents, *pats, **opts):
|
|||||||
# Because we put the standins in a bad state (by updating them)
|
# Because we put the standins in a bad state (by updating them)
|
||||||
# and then return them to a correct state we need to lock to
|
# and then return them to a correct state we need to lock to
|
||||||
# prevent others from changing them in their incorrect state.
|
# prevent others from changing them in their incorrect state.
|
||||||
wlock = repo.wlock()
|
with repo.wlock():
|
||||||
try:
|
|
||||||
lfdirstate = lfutil.openlfdirstate(ui, repo)
|
lfdirstate = lfutil.openlfdirstate(ui, repo)
|
||||||
s = lfutil.lfdirstatestatus(lfdirstate, repo)
|
s = lfutil.lfdirstatestatus(lfdirstate, repo)
|
||||||
lfdirstate.write()
|
lfdirstate.write()
|
||||||
@ -778,9 +777,6 @@ def overriderevert(orig, ui, repo, ctx, parents, *pats, **opts):
|
|||||||
lfcommands.updatelfiles(ui, repo, filelist, printmessage=False,
|
lfcommands.updatelfiles(ui, repo, filelist, printmessage=False,
|
||||||
normallookup=True)
|
normallookup=True)
|
||||||
|
|
||||||
finally:
|
|
||||||
wlock.release()
|
|
||||||
|
|
||||||
# after pulling changesets, we need to take some extra care to get
|
# after pulling changesets, we need to take some extra care to get
|
||||||
# largefiles updated remotely
|
# largefiles updated remotely
|
||||||
def overridepull(orig, ui, repo, source=None, **opts):
|
def overridepull(orig, ui, repo, source=None, **opts):
|
||||||
|
Loading…
Reference in New Issue
Block a user