Mercurial > hg
comparison mercurial/hg.py @ 50191:99faa396e186
narrow: write the narrow spec in a transaction during share
It will be simpler if all write happens within transaction.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 23 Feb 2023 04:42:17 +0100 |
parents | 6065a8936b00 |
children | 3a2df812e1c7 |
comparison
equal
deleted
inserted
replaced
50190:34db5692d537 | 50191:99faa396e186 |
---|---|
455 default = defaultpath or sourcerepo.ui.config(b'paths', b'default') | 455 default = defaultpath or sourcerepo.ui.config(b'paths', b'default') |
456 if default: | 456 if default: |
457 template = b'[paths]\ndefault = %s\n' | 457 template = b'[paths]\ndefault = %s\n' |
458 destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default)) | 458 destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default)) |
459 if requirements.NARROW_REQUIREMENT in sourcerepo.requirements: | 459 if requirements.NARROW_REQUIREMENT in sourcerepo.requirements: |
460 with destrepo.wlock(): | 460 with destrepo.wlock(), destrepo.lock(), destrepo.transaction( |
461 b"narrow-share" | |
462 ): | |
461 narrowspec.copytoworkingcopy(destrepo) | 463 narrowspec.copytoworkingcopy(destrepo) |
462 | 464 |
463 | 465 |
464 def _postshareupdate(repo, update, checkout=None): | 466 def _postshareupdate(repo, update, checkout=None): |
465 """Maybe perform a working directory update after a shared repo is created. | 467 """Maybe perform a working directory update after a shared repo is created. |