Mercurial > public > mercurial-scm > hg-stable
diff hgext/sparse.py @ 51317: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 | 18c8c18993f0 |
children | f4733654f144 |
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