##// END OF EJS Templates
share: make it possible to control the working copy format variant...
marmoute -
r49297:bf2738e0 default
parent child Browse files
Show More
@@ -1,4 +1,5 b''
1 1 # localrepo.py - read/write repository class for mercurial
2 # coding: utf-8
2 3 #
3 4 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 5 #
@@ -3661,17 +3662,36 b' def newreporequirements(ui, createopts):'
3661 3662 if ui.configbool(b'format', b'use-share-safe'):
3662 3663 requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
3663 3664
3664 # If the repo is being created from a shared repository, we copy
3665 # its requirements.
3665 # if we are creating a share-repo¹ we have to handle requirement
3666 # differently.
3667 #
3668 # [1] (i.e. reusing the store from another repository, just having a
3669 # working copy)
3666 3670 if b'sharedrepo' in createopts:
3667 requirements = set(createopts[b'sharedrepo'].requirements)
3671 source_requirements = set(createopts[b'sharedrepo'].requirements)
3672
3673 if requirementsmod.SHARESAFE_REQUIREMENT not in source_requirements:
3674 # share to an old school repository, we have to copy the
3675 # requirements and hope for the best.
3676 requirements = source_requirements
3677 else:
3678 # We have control on the working copy only, so "copy" the non
3679 # working copy part over, ignoring previous logic.
3680 to_drop = set()
3681 for req in requirements:
3682 if req in requirementsmod.WORKING_DIR_REQUIREMENTS:
3683 continue
3684 if req in source_requirements:
3685 continue
3686 to_drop.add(req)
3687 requirements -= to_drop
3688 requirements |= source_requirements
3689
3668 3690 if createopts.get(b'sharedrelative'):
3669 3691 requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT)
3670 3692 else:
3671 3693 requirements.add(requirementsmod.SHARED_REQUIREMENT)
3672 3694
3673 return requirements
3674
3675 3695 return requirements
3676 3696
3677 3697
@@ -284,3 +284,25 b' Test sharing a repository which was crea'
284 284 $ hg share nostore sharednostore
285 285 abort: cannot create shared repository as source was created with 'format.usestore' config disabled
286 286 [255]
287
288 Check that (safe) share can control wc-specific format variant at creation time
289 -------------------------------------------------------------------------------
290
291 #if no-rust
292
293 $ cat << EOF >> $HGRCPATH
294 > [storage]
295 > dirstate-v2.slow-path = allow
296 > EOF
297
298 #endif
299
300 $ hg init repo-safe-d1 --config format.use-share-safe=yes --config format.exp-rc-dirstate-v2=no
301 $ hg debugformat -R repo-safe-d1 | grep dirstate-v2
302 dirstate-v2: no
303
304 $ hg share repo-safe-d1 share-safe-d2 --config format.use-share-safe=yes --config format.exp-rc-dirstate-v2=yes
305 updating working directory
306 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
307 $ hg debugformat -R share-safe-d2 | grep dirstate-v2
308 dirstate-v2: yes
General Comments 0
You need to be logged in to leave comments. Login now