[Updated] D11992: largefiles: take lock before writing requirements

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Jan 25 09:28:01 UTC 2022


Closed by commit rHG497c2655c71e: largefiles: take lock before writing requirements (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11992?vs=31860&id=31971

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11992/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11992

AFFECTED FILES
  hgext/largefiles/reposetup.py

CHANGE DETAILS

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -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'



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220125/cc80e7be/attachment-0002.html>


More information about the Mercurial-patches mailing list