Show More
@@ -354,8 +354,8 b' def unshare(ui, repo):' | |||||
354 | sharefile = repo.vfs.join(b'sharedpath') |
|
354 | sharefile = repo.vfs.join(b'sharedpath') | |
355 | util.rename(sharefile, sharefile + b'.old') |
|
355 | util.rename(sharefile, sharefile + b'.old') | |
356 |
|
356 | |||
357 |
repo.requirements.discard( |
|
357 | repo.requirements.discard(requirements.SHARED_REQUIREMENT) | |
358 |
repo.requirements.discard( |
|
358 | repo.requirements.discard(requirements.RELATIVE_SHARED_REQUIREMENT) | |
359 | scmutil.writereporequirements(repo) |
|
359 | scmutil.writereporequirements(repo) | |
360 |
|
360 | |||
361 | # Removing share changes some fundamental properties of the repo instance. |
|
361 | # Removing share changes some fundamental properties of the repo instance. |
@@ -448,7 +448,7 b' def _getsharedvfs(hgvfs, requirements):' | |||||
448 | # This is an absolute path for ``shared`` and relative to |
|
448 | # This is an absolute path for ``shared`` and relative to | |
449 | # ``.hg/`` for ``relshared``. |
|
449 | # ``.hg/`` for ``relshared``. | |
450 | sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n') |
|
450 | sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n') | |
451 | if b'relshared' in requirements: |
|
451 | if requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements: | |
452 | sharedpath = hgvfs.join(sharedpath) |
|
452 | sharedpath = hgvfs.join(sharedpath) | |
453 |
|
453 | |||
454 | sharedvfs = vfsmod.vfs(sharedpath, realpath=True) |
|
454 | sharedvfs = vfsmod.vfs(sharedpath, realpath=True) | |
@@ -585,7 +585,10 b' def makelocalrepository(baseui, path, in' | |||||
585 | # accessed is determined by various requirements. If `shared` or |
|
585 | # accessed is determined by various requirements. If `shared` or | |
586 | # `relshared` requirements are present, this indicates current repository |
|
586 | # `relshared` requirements are present, this indicates current repository | |
587 | # is a share and store exists in path mentioned in `.hg/sharedpath` |
|
587 | # is a share and store exists in path mentioned in `.hg/sharedpath` | |
588 | shared = b'shared' in requirements or b'relshared' in requirements |
|
588 | shared = ( | |
|
589 | requirementsmod.SHARED_REQUIREMENT in requirements | |||
|
590 | or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements | |||
|
591 | ) | |||
589 | if shared: |
|
592 | if shared: | |
590 | sharedvfs = _getsharedvfs(hgvfs, requirements) |
|
593 | sharedvfs = _getsharedvfs(hgvfs, requirements) | |
591 | storebasepath = sharedvfs.base |
|
594 | storebasepath = sharedvfs.base | |
@@ -1047,8 +1050,8 b' class localrepository(object):' | |||||
1047 | _basesupported = supportedformats | { |
|
1050 | _basesupported = supportedformats | { | |
1048 | b'store', |
|
1051 | b'store', | |
1049 | b'fncache', |
|
1052 | b'fncache', | |
1050 | b'shared', |
|
1053 | requirementsmod.SHARED_REQUIREMENT, | |
1051 | b'relshared', |
|
1054 | requirementsmod.RELATIVE_SHARED_REQUIREMENT, | |
1052 | b'dotencode', |
|
1055 | b'dotencode', | |
1053 | requirementsmod.SPARSE_REQUIREMENT, |
|
1056 | requirementsmod.SPARSE_REQUIREMENT, | |
1054 | requirementsmod.INTERNAL_PHASE_REQUIREMENT, |
|
1057 | requirementsmod.INTERNAL_PHASE_REQUIREMENT, | |
@@ -3232,9 +3235,9 b' def newreporequirements(ui, createopts):' | |||||
3232 | if b'sharedrepo' in createopts: |
|
3235 | if b'sharedrepo' in createopts: | |
3233 | requirements = set(createopts[b'sharedrepo'].requirements) |
|
3236 | requirements = set(createopts[b'sharedrepo'].requirements) | |
3234 | if createopts.get(b'sharedrelative'): |
|
3237 | if createopts.get(b'sharedrelative'): | |
3235 |
requirements.add( |
|
3238 | requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT) | |
3236 | else: |
|
3239 | else: | |
3237 |
requirements.add( |
|
3240 | requirements.add(requirementsmod.SHARED_REQUIREMENT) | |
3238 |
|
3241 | |||
3239 | return requirements |
|
3242 | return requirements | |
3240 |
|
3243 | |||
@@ -3343,7 +3346,10 b' def checkrequirementscompat(ui, requirem' | |||||
3343 | ) |
|
3346 | ) | |
3344 | dropped.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) |
|
3347 | dropped.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) | |
3345 |
|
3348 | |||
3346 | if b'shared' in requirements or b'relshared' in requirements: |
|
3349 | if ( | |
|
3350 | requirementsmod.SHARED_REQUIREMENT in requirements | |||
|
3351 | or requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements | |||
|
3352 | ): | |||
3347 | raise error.Abort( |
|
3353 | raise error.Abort( | |
3348 | _( |
|
3354 | _( | |
3349 | b"cannot create shared repository as source was created" |
|
3355 | b"cannot create shared repository as source was created" |
@@ -45,7 +45,23 b" COPIESSDC_REQUIREMENT = b'exp-copies-sid" | |||||
45 | # The repository use persistent nodemap for the changelog and the manifest. |
|
45 | # The repository use persistent nodemap for the changelog and the manifest. | |
46 | NODEMAP_REQUIREMENT = b'persistent-nodemap' |
|
46 | NODEMAP_REQUIREMENT = b'persistent-nodemap' | |
47 |
|
47 | |||
|
48 | # Denotes that the current repository is a share | |||
|
49 | SHARED_REQUIREMENT = b'shared' | |||
|
50 | ||||
|
51 | # Denotes that current repository is a share and the shared source path is | |||
|
52 | # relative to the current repository root path | |||
|
53 | RELATIVE_SHARED_REQUIREMENT = b'relshared' | |||
|
54 | ||||
48 | # List of requirements which are working directory specific |
|
55 | # List of requirements which are working directory specific | |
49 | # These requirements cannot be shared between repositories if they |
|
56 | # These requirements cannot be shared between repositories if they | |
50 | # share the same store |
|
57 | # share the same store | |
51 | WORKING_DIR_REQUIREMENTS = {SPARSE_REQUIREMENT} |
|
58 | # * sparse is a working directory specific functionality and hence working | |
|
59 | # directory specific requirement | |||
|
60 | # * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which | |||
|
61 | # represents that the current working copy/repository shares store of another | |||
|
62 | # repo. Hence both of them should be stored in working copy | |||
|
63 | WORKING_DIR_REQUIREMENTS = { | |||
|
64 | SPARSE_REQUIREMENT, | |||
|
65 | SHARED_REQUIREMENT, | |||
|
66 | RELATIVE_SHARED_REQUIREMENT, | |||
|
67 | } |
@@ -64,7 +64,7 b' def blocksourcerequirements(repo):' | |||||
64 | # It should (hopefully) not exist in the wild. |
|
64 | # It should (hopefully) not exist in the wild. | |
65 | b'parentdelta', |
|
65 | b'parentdelta', | |
66 | # Upgrade should operate on the actual store, not the shared link. |
|
66 | # Upgrade should operate on the actual store, not the shared link. | |
67 | b'shared', |
|
67 | requirements.SHARED_REQUIREMENT, | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
|
70 |
General Comments 0
You need to be logged in to leave comments.
Login now