Mercurial > hg
changeset 51300:fa87eeeb10ca
sparse: use with statement for wlock
This will avoid pytype complaining about the try/except range.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 19 Dec 2023 22:03:34 +0100 |
parents | 726d8584905a |
children | 4b4253b3ec0a |
files | hgext/sparse.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/sparse.py Tue Dec 19 22:00:47 2023 +0100 +++ b/hgext/sparse.py Tue Dec 19 22:03:34 2023 +0100 @@ -371,8 +371,7 @@ sparse.clearrules(repo, force=force) if refresh: - try: - wlock = repo.wlock() + with repo.wlock(): fcounts = pycompat.maplist( len, sparse.refreshwdir( @@ -386,7 +385,5 @@ dropped=fcounts[1], conflicting=fcounts[2], ) - finally: - wlock.release() del repo._has_sparse