# HG changeset patch # User Pierre-Yves David # Date 2023-02-23 03:42:17 # Node ID 99faa396e1869d5bbf670afa19edb9ee84286742 # Parent 34db5692d5376c051b5acd8399a411384392ab60 narrow: write the narrow spec in a transaction during share It will be simpler if all write happens within transaction. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -457,7 +457,9 @@ def postshare(sourcerepo, destrepo, defa template = b'[paths]\ndefault = %s\n' destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default)) if requirements.NARROW_REQUIREMENT in sourcerepo.requirements: - with destrepo.wlock(): + with destrepo.wlock(), destrepo.lock(), destrepo.transaction( + b"narrow-share" + ): narrowspec.copytoworkingcopy(destrepo)