Mercurial > hg-stable
changeset 48686:497c2655c71e
largefiles: take lock before writing requirements
With `share-safe`, we will also write file in the store. We now take the `lock`
as needed.
Differential Revision: https://phab.mercurial-scm.org/D11992
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 07 Jan 2022 16:30:11 +0100 |
parents | bf424fe4f814 |
children | a62ba3345534 |
files | hgext/largefiles/reposetup.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py Fri Jan 07 17:33:27 2022 +0100 +++ b/hgext/largefiles/reposetup.py Fri Jan 07 16:30:11 2022 +0100 @@ -455,11 +455,12 @@ repo.prepushoutgoinghooks.add(b"largefiles", prepushoutgoinghook) def checkrequireslfiles(ui, repo, **kwargs): - if b'largefiles' not in repo.requirements and any( - lfutil.shortname + b'/' in f[1] for f in repo.store.datafiles() - ): - repo.requirements.add(b'largefiles') - scmutil.writereporequirements(repo) + with repo.lock(): + if b'largefiles' not in repo.requirements and any( + lfutil.shortname + b'/' in f[1] for f in repo.store.datafiles() + ): + repo.requirements.add(b'largefiles') + scmutil.writereporequirements(repo) ui.setconfig( b'hooks', b'changegroup.lfiles', checkrequireslfiles, b'largefiles'