##// END OF EJS Templates
requirements: introduce constants for `shared` and `relshared` requirements...
Pulkit Goyal -
r45946:034d94f8 default
parent child Browse files
Show More
@@ -354,8 +354,8 b' def unshare(ui, repo):'
354 354 sharefile = repo.vfs.join(b'sharedpath')
355 355 util.rename(sharefile, sharefile + b'.old')
356 356
357 repo.requirements.discard(b'shared')
358 repo.requirements.discard(b'relshared')
357 repo.requirements.discard(requirements.SHARED_REQUIREMENT)
358 repo.requirements.discard(requirements.RELATIVE_SHARED_REQUIREMENT)
359 359 scmutil.writereporequirements(repo)
360 360
361 361 # Removing share changes some fundamental properties of the repo instance.
@@ -448,7 +448,7 b' def _getsharedvfs(hgvfs, requirements):'
448 448 # This is an absolute path for ``shared`` and relative to
449 449 # ``.hg/`` for ``relshared``.
450 450 sharedpath = hgvfs.read(b'sharedpath').rstrip(b'\n')
451 if b'relshared' in requirements:
451 if requirementsmod.RELATIVE_SHARED_REQUIREMENT in requirements:
452 452 sharedpath = hgvfs.join(sharedpath)
453 453
454 454 sharedvfs = vfsmod.vfs(sharedpath, realpath=True)
@@ -585,7 +585,10 b' def makelocalrepository(baseui, path, in'
585 585 # accessed is determined by various requirements. If `shared` or
586 586 # `relshared` requirements are present, this indicates current repository
587 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 592 if shared:
590 593 sharedvfs = _getsharedvfs(hgvfs, requirements)
591 594 storebasepath = sharedvfs.base
@@ -1047,8 +1050,8 b' class localrepository(object):'
1047 1050 _basesupported = supportedformats | {
1048 1051 b'store',
1049 1052 b'fncache',
1050 b'shared',
1051 b'relshared',
1053 requirementsmod.SHARED_REQUIREMENT,
1054 requirementsmod.RELATIVE_SHARED_REQUIREMENT,
1052 1055 b'dotencode',
1053 1056 requirementsmod.SPARSE_REQUIREMENT,
1054 1057 requirementsmod.INTERNAL_PHASE_REQUIREMENT,
@@ -3232,9 +3235,9 b' def newreporequirements(ui, createopts):'
3232 3235 if b'sharedrepo' in createopts:
3233 3236 requirements = set(createopts[b'sharedrepo'].requirements)
3234 3237 if createopts.get(b'sharedrelative'):
3235 requirements.add(b'relshared')
3238 requirements.add(requirementsmod.RELATIVE_SHARED_REQUIREMENT)
3236 3239 else:
3237 requirements.add(b'shared')
3240 requirements.add(requirementsmod.SHARED_REQUIREMENT)
3238 3241
3239 3242 return requirements
3240 3243
@@ -3343,7 +3346,10 b' def checkrequirementscompat(ui, requirem'
3343 3346 )
3344 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 3353 raise error.Abort(
3348 3354 _(
3349 3355 b"cannot create shared repository as source was created"
@@ -45,7 +45,23 b" COPIESSDC_REQUIREMENT = b'exp-copies-sid"
45 45 # The repository use persistent nodemap for the changelog and the manifest.
46 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 55 # List of requirements which are working directory specific
49 56 # These requirements cannot be shared between repositories if they
50 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 64 # It should (hopefully) not exist in the wild.
65 65 b'parentdelta',
66 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