Show More
@@ -24,87 +24,6 b' RECLONES_REQUIREMENTS = {' | |||||
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | def supportremovedrequirements(repo): |
|
|||
28 | """Obtain requirements that can be removed during an upgrade. |
|
|||
29 |
|
||||
30 | If an upgrade were to create a repository that dropped a requirement, |
|
|||
31 | the dropped requirement must appear in the returned set for the upgrade |
|
|||
32 | to be allowed. |
|
|||
33 | """ |
|
|||
34 | supported = { |
|
|||
35 | requirements.SPARSEREVLOG_REQUIREMENT, |
|
|||
36 | requirements.SIDEDATA_REQUIREMENT, |
|
|||
37 | requirements.COPIESSDC_REQUIREMENT, |
|
|||
38 | requirements.NODEMAP_REQUIREMENT, |
|
|||
39 | requirements.SHARESAFE_REQUIREMENT, |
|
|||
40 | } |
|
|||
41 | for name in compression.compengines: |
|
|||
42 | engine = compression.compengines[name] |
|
|||
43 | if engine.available() and engine.revlogheader(): |
|
|||
44 | supported.add(b'exp-compression-%s' % name) |
|
|||
45 | if engine.name() == b'zstd': |
|
|||
46 | supported.add(b'revlog-compression-zstd') |
|
|||
47 | return supported |
|
|||
48 |
|
||||
49 |
|
||||
50 | def supporteddestrequirements(repo): |
|
|||
51 | """Obtain requirements that upgrade supports in the destination. |
|
|||
52 |
|
||||
53 | If the result of the upgrade would create requirements not in this set, |
|
|||
54 | the upgrade is disallowed. |
|
|||
55 |
|
||||
56 | Extensions should monkeypatch this to add their custom requirements. |
|
|||
57 | """ |
|
|||
58 | supported = { |
|
|||
59 | b'dotencode', |
|
|||
60 | b'fncache', |
|
|||
61 | b'generaldelta', |
|
|||
62 | b'revlogv1', |
|
|||
63 | b'store', |
|
|||
64 | requirements.SPARSEREVLOG_REQUIREMENT, |
|
|||
65 | requirements.SIDEDATA_REQUIREMENT, |
|
|||
66 | requirements.COPIESSDC_REQUIREMENT, |
|
|||
67 | requirements.NODEMAP_REQUIREMENT, |
|
|||
68 | requirements.SHARESAFE_REQUIREMENT, |
|
|||
69 | } |
|
|||
70 | for name in compression.compengines: |
|
|||
71 | engine = compression.compengines[name] |
|
|||
72 | if engine.available() and engine.revlogheader(): |
|
|||
73 | supported.add(b'exp-compression-%s' % name) |
|
|||
74 | if engine.name() == b'zstd': |
|
|||
75 | supported.add(b'revlog-compression-zstd') |
|
|||
76 | return supported |
|
|||
77 |
|
||||
78 |
|
||||
79 | def allowednewrequirements(repo): |
|
|||
80 | """Obtain requirements that can be added to a repository during upgrade. |
|
|||
81 |
|
||||
82 | This is used to disallow proposed requirements from being added when |
|
|||
83 | they weren't present before. |
|
|||
84 |
|
||||
85 | We use a list of allowed requirement additions instead of a list of known |
|
|||
86 | bad additions because the whitelist approach is safer and will prevent |
|
|||
87 | future, unknown requirements from accidentally being added. |
|
|||
88 | """ |
|
|||
89 | supported = { |
|
|||
90 | b'dotencode', |
|
|||
91 | b'fncache', |
|
|||
92 | b'generaldelta', |
|
|||
93 | requirements.SPARSEREVLOG_REQUIREMENT, |
|
|||
94 | requirements.SIDEDATA_REQUIREMENT, |
|
|||
95 | requirements.COPIESSDC_REQUIREMENT, |
|
|||
96 | requirements.NODEMAP_REQUIREMENT, |
|
|||
97 | requirements.SHARESAFE_REQUIREMENT, |
|
|||
98 | } |
|
|||
99 | for name in compression.compengines: |
|
|||
100 | engine = compression.compengines[name] |
|
|||
101 | if engine.available() and engine.revlogheader(): |
|
|||
102 | supported.add(b'exp-compression-%s' % name) |
|
|||
103 | if engine.name() == b'zstd': |
|
|||
104 | supported.add(b'revlog-compression-zstd') |
|
|||
105 | return supported |
|
|||
106 |
|
||||
107 |
|
||||
108 | def preservedrequirements(repo): |
|
27 | def preservedrequirements(repo): | |
109 | return set() |
|
28 | return set() | |
110 |
|
29 | |||
@@ -691,6 +610,87 b' def check_source_requirements(repo):' | |||||
691 | ### Verify the validity of the planned requirement changes #################### |
|
610 | ### Verify the validity of the planned requirement changes #################### | |
692 |
|
611 | |||
693 |
|
612 | |||
|
613 | def supportremovedrequirements(repo): | |||
|
614 | """Obtain requirements that can be removed during an upgrade. | |||
|
615 | ||||
|
616 | If an upgrade were to create a repository that dropped a requirement, | |||
|
617 | the dropped requirement must appear in the returned set for the upgrade | |||
|
618 | to be allowed. | |||
|
619 | """ | |||
|
620 | supported = { | |||
|
621 | requirements.SPARSEREVLOG_REQUIREMENT, | |||
|
622 | requirements.SIDEDATA_REQUIREMENT, | |||
|
623 | requirements.COPIESSDC_REQUIREMENT, | |||
|
624 | requirements.NODEMAP_REQUIREMENT, | |||
|
625 | requirements.SHARESAFE_REQUIREMENT, | |||
|
626 | } | |||
|
627 | for name in compression.compengines: | |||
|
628 | engine = compression.compengines[name] | |||
|
629 | if engine.available() and engine.revlogheader(): | |||
|
630 | supported.add(b'exp-compression-%s' % name) | |||
|
631 | if engine.name() == b'zstd': | |||
|
632 | supported.add(b'revlog-compression-zstd') | |||
|
633 | return supported | |||
|
634 | ||||
|
635 | ||||
|
636 | def supporteddestrequirements(repo): | |||
|
637 | """Obtain requirements that upgrade supports in the destination. | |||
|
638 | ||||
|
639 | If the result of the upgrade would create requirements not in this set, | |||
|
640 | the upgrade is disallowed. | |||
|
641 | ||||
|
642 | Extensions should monkeypatch this to add their custom requirements. | |||
|
643 | """ | |||
|
644 | supported = { | |||
|
645 | b'dotencode', | |||
|
646 | b'fncache', | |||
|
647 | b'generaldelta', | |||
|
648 | b'revlogv1', | |||
|
649 | b'store', | |||
|
650 | requirements.SPARSEREVLOG_REQUIREMENT, | |||
|
651 | requirements.SIDEDATA_REQUIREMENT, | |||
|
652 | requirements.COPIESSDC_REQUIREMENT, | |||
|
653 | requirements.NODEMAP_REQUIREMENT, | |||
|
654 | requirements.SHARESAFE_REQUIREMENT, | |||
|
655 | } | |||
|
656 | for name in compression.compengines: | |||
|
657 | engine = compression.compengines[name] | |||
|
658 | if engine.available() and engine.revlogheader(): | |||
|
659 | supported.add(b'exp-compression-%s' % name) | |||
|
660 | if engine.name() == b'zstd': | |||
|
661 | supported.add(b'revlog-compression-zstd') | |||
|
662 | return supported | |||
|
663 | ||||
|
664 | ||||
|
665 | def allowednewrequirements(repo): | |||
|
666 | """Obtain requirements that can be added to a repository during upgrade. | |||
|
667 | ||||
|
668 | This is used to disallow proposed requirements from being added when | |||
|
669 | they weren't present before. | |||
|
670 | ||||
|
671 | We use a list of allowed requirement additions instead of a list of known | |||
|
672 | bad additions because the whitelist approach is safer and will prevent | |||
|
673 | future, unknown requirements from accidentally being added. | |||
|
674 | """ | |||
|
675 | supported = { | |||
|
676 | b'dotencode', | |||
|
677 | b'fncache', | |||
|
678 | b'generaldelta', | |||
|
679 | requirements.SPARSEREVLOG_REQUIREMENT, | |||
|
680 | requirements.SIDEDATA_REQUIREMENT, | |||
|
681 | requirements.COPIESSDC_REQUIREMENT, | |||
|
682 | requirements.NODEMAP_REQUIREMENT, | |||
|
683 | requirements.SHARESAFE_REQUIREMENT, | |||
|
684 | } | |||
|
685 | for name in compression.compengines: | |||
|
686 | engine = compression.compengines[name] | |||
|
687 | if engine.available() and engine.revlogheader(): | |||
|
688 | supported.add(b'exp-compression-%s' % name) | |||
|
689 | if engine.name() == b'zstd': | |||
|
690 | supported.add(b'revlog-compression-zstd') | |||
|
691 | return supported | |||
|
692 | ||||
|
693 | ||||
694 | def check_requirements_changes(repo, new_reqs): |
|
694 | def check_requirements_changes(repo, new_reqs): | |
695 | old_reqs = repo.requirements |
|
695 | old_reqs = repo.requirements | |
696 |
|
696 |
General Comments 0
You need to be logged in to leave comments.
Login now