Mercurial > hg
annotate mercurial/upgrade.py @ 45059:79f6f9fa18c1
documentation: add some internals documentation about bid merge
This is an important algorithm that was only documented on the wiki so far.
Some update to the algorithm (and associated doc) is to expected in the future
since the bid merge algorithm is bug-ridden when it comes to file deletion comes
to play.
Differential Revision: https://phab.mercurial-scm.org/D8711
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 22 Jun 2020 13:32:20 +0200 |
parents | 4c1d39215034 |
children | a03c177a4679 |
rev | line source |
---|---|
31894
9379689b6c10
upgrade: update the header comment
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31893
diff
changeset
|
1 # upgrade.py - functions for in place upgrade of Mercurial repository |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 # |
31895
783b4c9bd5f5
upgrade: update the copyright statement
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31894
diff
changeset
|
3 # Copyright (c) 2016-present, Gregory Szorc |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 # |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8073
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
10263 | 6 # GNU General Public License version 2 or any later version. |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 |
25970
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
8 from __future__ import absolute_import |
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
9 |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
10 import stat |
4702
18e91c9def0c
strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
11 |
25970
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
12 from .i18n import _ |
43089
c59eb1560c44
py3: manually import getattr where it is needed
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43077
diff
changeset
|
13 from .pycompat import getattr |
25970
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
14 from . import ( |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
15 changelog, |
26587
56b2bcea2529
error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
26425
diff
changeset
|
16 error, |
35344
8f3f8b8dbab7
upgrade: use actual filelog to convert filelog
Boris Feld <boris.feld@octobus.net>
parents:
35343
diff
changeset
|
17 filelog, |
35343
06987c6971be
upgrade: more standard creation of the temporary repository
Boris Feld <boris.feld@octobus.net>
parents:
35342
diff
changeset
|
18 hg, |
31893
165428b05fca
upgrade: import 'localrepo' globally
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31875
diff
changeset
|
19 localrepo, |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
20 manifest, |
44940
4c1d39215034
metadata: move computation related to files touched in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44841
diff
changeset
|
21 metadata, |
38165
2ce60954b1b7
py3: wrap tempfile.mkdtemp() to use bytes path
Yuya Nishihara <yuya@tcha.org>
parents:
37444
diff
changeset
|
22 pycompat, |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
23 revlog, |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
24 scmutil, |
25970
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
25 util, |
31232
254f98326eef
vfs: use 'vfs' module directly in 'mercurial.repair'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30975
diff
changeset
|
26 vfs as vfsmod, |
25970
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
27 ) |
d1419cfbd4f4
repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents:
25874
diff
changeset
|
28 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
29 from .utils import compression |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
30 |
42832
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
31 # list of requirements that request a clone of all revlog if added/removed |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
32 RECLONES_REQUIREMENTS = { |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
33 b'generaldelta', |
42832
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
34 localrepo.SPARSEREVLOG_REQUIREMENT, |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
35 } |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
36 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
37 |
31865
5dcaa0f4455b
upgrade: drop the prefix to the 'requiredsourcerequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31864
diff
changeset
|
38 def requiredsourcerequirements(repo): |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
39 """Obtain requirements required to be present to upgrade a repo. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
40 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
41 An upgrade will not be allowed if the repository doesn't have the |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
42 requirements returned by this function. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
43 """ |
32291
bd872f64a8ba
cleanup: use set literals
Martin von Zweigbergk <martinvonz@google.com>
parents:
32032
diff
changeset
|
44 return { |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
45 # Introduced in Mercurial 0.9.2. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
46 b'revlogv1', |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
47 # Introduced in Mercurial 0.9.2. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
48 b'store', |
32291
bd872f64a8ba
cleanup: use set literals
Martin von Zweigbergk <martinvonz@google.com>
parents:
32032
diff
changeset
|
49 } |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
50 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
51 |
31866
1454726b6d7c
upgrade: drop the prefix to the 'blocksourcerequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31865
diff
changeset
|
52 def blocksourcerequirements(repo): |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
53 """Obtain requirements that will prevent an upgrade from occurring. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
54 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
55 An upgrade cannot be performed if the source repository contains a |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
56 requirements in the returned set. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
57 """ |
32291
bd872f64a8ba
cleanup: use set literals
Martin von Zweigbergk <martinvonz@google.com>
parents:
32032
diff
changeset
|
58 return { |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
59 # The upgrade code does not yet support these experimental features. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
60 # This is an artificial limitation. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
61 b'treemanifest', |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
62 # This was a precursor to generaldelta and was never enabled by default. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
63 # It should (hopefully) not exist in the wild. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
64 b'parentdelta', |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
65 # Upgrade should operate on the actual store, not the shared link. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
66 b'shared', |
32291
bd872f64a8ba
cleanup: use set literals
Martin von Zweigbergk <martinvonz@google.com>
parents:
32032
diff
changeset
|
67 } |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
68 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
69 |
31867
cc60b6c36637
upgrade: drop the prefix to the 'supportremovedrequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31866
diff
changeset
|
70 def supportremovedrequirements(repo): |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
71 """Obtain requirements that can be removed during an upgrade. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
72 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
73 If an upgrade were to create a repository that dropped a requirement, |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
74 the dropped requirement must appear in the returned set for the upgrade |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
75 to be allowed. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
76 """ |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
77 supported = { |
38720
d12415b8f833
upgrade: enable adding or removing sparse-revlog requirement
Paul Morelle <paul.morelle@octobus.net>
parents:
38719
diff
changeset
|
78 localrepo.SPARSEREVLOG_REQUIREMENT, |
43135
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
79 localrepo.SIDEDATA_REQUIREMENT, |
43148
843da18386d5
sidedatacopies: deal with upgrading and downgrading to that format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43138
diff
changeset
|
80 localrepo.COPIESSDC_REQUIREMENT, |
44841
526d69eeea31
upgrade: support upgrade and downgrade from persistent nodemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44799
diff
changeset
|
81 localrepo.NODEMAP_REQUIREMENT, |
38720
d12415b8f833
upgrade: enable adding or removing sparse-revlog requirement
Paul Morelle <paul.morelle@octobus.net>
parents:
38719
diff
changeset
|
82 } |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
83 for name in compression.compengines: |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
84 engine = compression.compengines[name] |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
85 if engine.available() and engine.revlogheader(): |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
86 supported.add(b'exp-compression-%s' % name) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
87 if engine.name() == b'zstd': |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
88 supported.add(b'revlog-compression-zstd') |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
89 return supported |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
90 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
91 |
31870
49011f1cedd4
upgrade: drop the prefix to the 'supporteddestrequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31869
diff
changeset
|
92 def supporteddestrequirements(repo): |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
93 """Obtain requirements that upgrade supports in the destination. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
94 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
95 If the result of the upgrade would create requirements not in this set, |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
96 the upgrade is disallowed. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
97 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
98 Extensions should monkeypatch this to add their custom requirements. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
99 """ |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
100 supported = { |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
101 b'dotencode', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
102 b'fncache', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
103 b'generaldelta', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
104 b'revlogv1', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
105 b'store', |
38720
d12415b8f833
upgrade: enable adding or removing sparse-revlog requirement
Paul Morelle <paul.morelle@octobus.net>
parents:
38719
diff
changeset
|
106 localrepo.SPARSEREVLOG_REQUIREMENT, |
43134
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
107 localrepo.SIDEDATA_REQUIREMENT, |
43148
843da18386d5
sidedatacopies: deal with upgrading and downgrading to that format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43138
diff
changeset
|
108 localrepo.COPIESSDC_REQUIREMENT, |
44841
526d69eeea31
upgrade: support upgrade and downgrade from persistent nodemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44799
diff
changeset
|
109 localrepo.NODEMAP_REQUIREMENT, |
32291
bd872f64a8ba
cleanup: use set literals
Martin von Zweigbergk <martinvonz@google.com>
parents:
32032
diff
changeset
|
110 } |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
111 for name in compression.compengines: |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
112 engine = compression.compengines[name] |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
113 if engine.available() and engine.revlogheader(): |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
114 supported.add(b'exp-compression-%s' % name) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
115 if engine.name() == b'zstd': |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
116 supported.add(b'revlog-compression-zstd') |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
117 return supported |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
118 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
119 |
31869
fe5e30b58934
upgrade: drop the prefix to the 'allowednewrequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31868
diff
changeset
|
120 def allowednewrequirements(repo): |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
121 """Obtain requirements that can be added to a repository during upgrade. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
122 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
123 This is used to disallow proposed requirements from being added when |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
124 they weren't present before. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
125 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
126 We use a list of allowed requirement additions instead of a list of known |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
127 bad additions because the whitelist approach is safer and will prevent |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
128 future, unknown requirements from accidentally being added. |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
129 """ |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
130 supported = { |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
131 b'dotencode', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
132 b'fncache', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
133 b'generaldelta', |
38720
d12415b8f833
upgrade: enable adding or removing sparse-revlog requirement
Paul Morelle <paul.morelle@octobus.net>
parents:
38719
diff
changeset
|
134 localrepo.SPARSEREVLOG_REQUIREMENT, |
43134
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
135 localrepo.SIDEDATA_REQUIREMENT, |
43148
843da18386d5
sidedatacopies: deal with upgrading and downgrading to that format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43138
diff
changeset
|
136 localrepo.COPIESSDC_REQUIREMENT, |
44841
526d69eeea31
upgrade: support upgrade and downgrade from persistent nodemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44799
diff
changeset
|
137 localrepo.NODEMAP_REQUIREMENT, |
32291
bd872f64a8ba
cleanup: use set literals
Martin von Zweigbergk <martinvonz@google.com>
parents:
32032
diff
changeset
|
138 } |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
139 for name in compression.compengines: |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
140 engine = compression.compengines[name] |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
141 if engine.available() and engine.revlogheader(): |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
142 supported.add(b'exp-compression-%s' % name) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
143 if engine.name() == b'zstd': |
42137
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
144 supported.add(b'revlog-compression-zstd') |
d086ba387ae8
upgrade: support upgrade to/from zstd storage (issue6088)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42136
diff
changeset
|
145 return supported |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
146 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
147 |
35302
ad2b35ebf670
upgraderepo: allow extension to register preserved requirements
Boris Feld <boris.feld@octobus.net>
parents:
33438
diff
changeset
|
148 def preservedrequirements(repo): |
ad2b35ebf670
upgraderepo: allow extension to register preserved requirements
Boris Feld <boris.feld@octobus.net>
parents:
33438
diff
changeset
|
149 return set() |
ad2b35ebf670
upgraderepo: allow extension to register preserved requirements
Boris Feld <boris.feld@octobus.net>
parents:
33438
diff
changeset
|
150 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
151 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
152 deficiency = b'deficiency' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
153 optimisation = b'optimization' |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
154 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
155 |
31868
9f84ccb1b282
upgrade: drop the prefix to the 'improvement' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31867
diff
changeset
|
156 class improvement(object): |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
157 """Represents an improvement that can be made as part of an upgrade. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
158 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
159 The following attributes are defined on each instance: |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
160 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
161 name |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
162 Machine-readable string uniquely identifying this improvement. It |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
163 will be mapped to an action later in the upgrade process. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
164 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
165 type |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
166 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
167 problem. An optimization is an action (sometimes optional) that |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
168 can be taken to further improve the state of the repository. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
169 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
170 description |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
171 Message intended for humans explaining the improvement in more detail, |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
172 including the implications of it. For ``deficiency`` types, should be |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
173 worded in the present tense. For ``optimisation`` types, should be |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
174 worded in the future tense. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
175 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
176 upgrademessage |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
177 Message intended for humans explaining what an upgrade addressing this |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
178 issue will do. Should be worded in the future tense. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
179 """ |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
180 |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
181 def __init__(self, name, type, description, upgrademessage): |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
182 self.name = name |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
183 self.type = type |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
184 self.description = description |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
185 self.upgrademessage = upgrademessage |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
186 |
31902
6557f0d4ab8e
upgrade: implement equality for 'improvement' object
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31901
diff
changeset
|
187 def __eq__(self, other): |
6557f0d4ab8e
upgrade: implement equality for 'improvement' object
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31901
diff
changeset
|
188 if not isinstance(other, improvement): |
6557f0d4ab8e
upgrade: implement equality for 'improvement' object
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31901
diff
changeset
|
189 # This is what python tell use to do |
6557f0d4ab8e
upgrade: implement equality for 'improvement' object
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31901
diff
changeset
|
190 return NotImplemented |
6557f0d4ab8e
upgrade: implement equality for 'improvement' object
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31901
diff
changeset
|
191 return self.name == other.name |
6557f0d4ab8e
upgrade: implement equality for 'improvement' object
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31901
diff
changeset
|
192 |
32028
99f63f476a72
upgrade: implement '__ne__' on 'improvement' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31904
diff
changeset
|
193 def __ne__(self, other): |
40997
038108a9811c
upgrade: correct implementation of improvement.__ne__
Benjamin Peterson <benjamin@python.org>
parents:
40918
diff
changeset
|
194 return not (self == other) |
32028
99f63f476a72
upgrade: implement '__ne__' on 'improvement' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31904
diff
changeset
|
195 |
32029
9e35848fa007
upgrade: implement '__hash__' on 'improvement' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32028
diff
changeset
|
196 def __hash__(self): |
9e35848fa007
upgrade: implement '__hash__' on 'improvement' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32028
diff
changeset
|
197 return hash(self.name) |
9e35848fa007
upgrade: implement '__hash__' on 'improvement' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32028
diff
changeset
|
198 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
199 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
200 allformatvariant = [] |
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
201 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
202 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
203 def registerformatvariant(cls): |
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
204 allformatvariant.append(cls) |
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
205 return cls |
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
206 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
207 |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
208 class formatvariant(improvement): |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
209 """an improvement subclass dedicated to repository format""" |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
210 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
211 type = deficiency |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
212 ### The following attributes should be defined for each class: |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
213 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
214 # machine-readable string uniquely identifying this improvement. it will be |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
215 # mapped to an action later in the upgrade process. |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
216 name = None |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
217 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
218 # message intended for humans explaining the improvement in more detail, |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
219 # including the implications of it ``deficiency`` types, should be worded |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
220 # in the present tense. |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
221 description = None |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
222 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
223 # message intended for humans explaining what an upgrade addressing this |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
224 # issue will do. should be worded in the future tense. |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
225 upgrademessage = None |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
226 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
227 # value of current Mercurial default for new repository |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
228 default = None |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
229 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
230 def __init__(self): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
231 raise NotImplementedError() |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
232 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
233 @staticmethod |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
234 def fromrepo(repo): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
235 """current value of the variant in the repository""" |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
236 raise NotImplementedError() |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
237 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
238 @staticmethod |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
239 def fromconfig(repo): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
240 """current value of the variant in the configuration""" |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
241 raise NotImplementedError() |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
242 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
243 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
244 class requirementformatvariant(formatvariant): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
245 """formatvariant based on a 'requirement' name. |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
246 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
247 Many format variant are controlled by a 'requirement'. We define a small |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
248 subclass to factor the code. |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
249 """ |
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
250 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
251 # the requirement that control this format variant |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
252 _requirement = None |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
253 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
254 @staticmethod |
39546
41aa5dced975
localrepo: pass ui to newreporequirements() (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39243
diff
changeset
|
255 def _newreporequirements(ui): |
39996
dbcb466d0065
localrepo: define storage backend in creation options (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39870
diff
changeset
|
256 return localrepo.newreporequirements( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
257 ui, localrepo.defaultcreateopts(ui) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
258 ) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
259 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
260 @classmethod |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
261 def fromrepo(cls, repo): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
262 assert cls._requirement is not None |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
263 return cls._requirement in repo.requirements |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
264 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
265 @classmethod |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
266 def fromconfig(cls, repo): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
267 assert cls._requirement is not None |
39546
41aa5dced975
localrepo: pass ui to newreporequirements() (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39243
diff
changeset
|
268 return cls._requirement in cls._newreporequirements(repo.ui) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
269 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
270 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
271 @registerformatvariant |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
272 class fncache(requirementformatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
273 name = b'fncache' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
274 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
275 _requirement = b'fncache' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
276 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
277 default = True |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
278 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
279 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
280 b'long and reserved filenames may not work correctly; ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
281 b'repository performance is sub-optimal' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
282 ) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
283 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
284 upgrademessage = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
285 b'repository will be more resilient to storing ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
286 b'certain paths and performance of certain ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
287 b'operations should be improved' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
288 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
289 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
290 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
291 @registerformatvariant |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
292 class dotencode(requirementformatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
293 name = b'dotencode' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
294 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
295 _requirement = b'dotencode' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
296 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
297 default = True |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
298 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
299 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
300 b'storage of filenames beginning with a period or ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
301 b'space may not work correctly' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
302 ) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
303 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
304 upgrademessage = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
305 b'repository will be better able to store files ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
306 b'beginning with a space or period' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
307 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
308 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
309 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
310 @registerformatvariant |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
311 class generaldelta(requirementformatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
312 name = b'generaldelta' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
313 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
314 _requirement = b'generaldelta' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
315 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
316 default = True |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
317 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
318 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
319 b'deltas within internal storage are unable to ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
320 b'choose optimal revisions; repository is larger and ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
321 b'slower than it could be; interaction with other ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
322 b'repositories may require extra network and CPU ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
323 b'resources, making "hg push" and "hg pull" slower' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
324 ) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
325 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
326 upgrademessage = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
327 b'repository storage will be able to create ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
328 b'optimal deltas; new repository data will be ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
329 b'smaller and read times should decrease; ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
330 b'interacting with other repositories using this ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
331 b'storage model should require less network and ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
332 b'CPU resources, making "hg push" and "hg pull" ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
333 b'faster' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
334 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
335 |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
336 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
337 @registerformatvariant |
38719
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
338 class sparserevlog(requirementformatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
339 name = b'sparserevlog' |
38719
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
340 |
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
341 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT |
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
342 |
40918
3764330f76a6
sparse-revlog: enabled by default
Boris Feld <boris.feld@octobus.net>
parents:
40837
diff
changeset
|
343 default = True |
38719
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
344 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
345 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
346 b'in order to limit disk reading and memory usage on older ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
347 b'version, the span of a delta chain from its root to its ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
348 b'end is limited, whatever the relevant data in this span. ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
349 b'This can severly limit Mercurial ability to build good ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
350 b'chain of delta resulting is much more storage space being ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
351 b'taken and limit reusability of on disk delta during ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
352 b'exchange.' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
353 ) |
38719
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
354 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
355 upgrademessage = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
356 b'Revlog supports delta chain with more unused data ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
357 b'between payload. These gaps will be skipped at read ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
358 b'time. This allows for better delta chains, making a ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
359 b'better compression and faster exchange with server.' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
360 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
361 |
38719
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
362 |
4ad2a1ff0404
upgrade: add information about sparse-revlog
Paul Morelle <paul.morelle@octobus.net>
parents:
38399
diff
changeset
|
363 @registerformatvariant |
43031
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
364 class sidedata(requirementformatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
365 name = b'sidedata' |
43031
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
366 |
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
367 _requirement = localrepo.SIDEDATA_REQUIREMENT |
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
368 |
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
369 default = False |
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
370 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
371 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
372 b'Allows storage of extra data alongside a revision, ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
373 b'unlocking various caching options.' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
374 ) |
43031
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
375 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
376 upgrademessage = _(b'Allows storage of extra data alongside a revision.') |
43031
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
377 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
378 |
43031
e16ca9fde7aa
upgrade: detect the side-data format variants
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43002
diff
changeset
|
379 @registerformatvariant |
44799
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
380 class persistentnodemap(requirementformatvariant): |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
381 name = b'persistent-nodemap' |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
382 |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
383 _requirement = localrepo.NODEMAP_REQUIREMENT |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
384 |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
385 default = False |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
386 |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
387 description = _( |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
388 b'persist the node -> rev mapping on disk to speedup lookup' |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
389 ) |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
390 |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
391 upgrademessage = _(b'Speedup revision lookup by node id.') |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
392 |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
393 |
ea9563e9e65a
nodemap: teach `hg debugformat` about the persistent nodemap option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44798
diff
changeset
|
394 @registerformatvariant |
43138
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
395 class copiessdc(requirementformatvariant): |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
396 name = b'copies-sdc' |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
397 |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
398 _requirement = localrepo.COPIESSDC_REQUIREMENT |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
399 |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
400 default = False |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
401 |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
402 description = _(b'Stores copies information alongside changesets.') |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
403 |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
404 upgrademessage = _( |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
405 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.' |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
406 ) |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
407 |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
408 |
f9dc98a97cdb
sidedatacopies: teach upgrade about the new requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43135
diff
changeset
|
409 @registerformatvariant |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
410 class removecldeltachain(formatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
411 name = b'plain-cl-delta' |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
412 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
413 default = True |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
414 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
415 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
416 b'changelog storage is using deltas instead of ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
417 b'raw entries; changelog reading and any ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
418 b'operation relying on changelog data are slower ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
419 b'than they could be' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
420 ) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
421 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
422 upgrademessage = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
423 b'changelog storage will be reformated to ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
424 b'store raw entries; changelog reading will be ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
425 b'faster; changelog size may be reduced' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
426 ) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
427 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
428 @staticmethod |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
429 def fromrepo(repo): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
430 # Mercurial 4.0 changed changelogs to not use delta chains. Search for |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
431 # changelogs with deltas. |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
432 cl = repo.changelog |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
433 chainbase = cl.chainbase |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
434 return all(rev == chainbase(rev) for rev in cl) |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
435 |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
436 @staticmethod |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
437 def fromconfig(repo): |
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
438 return True |
32030
e47223576b8d
upgrade: introduce a 'formatvariant' class
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32029
diff
changeset
|
439 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
440 |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
441 @registerformatvariant |
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
442 class compressionengine(formatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
443 name = b'compression' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
444 default = b'zlib' |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
445 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
446 description = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
447 b'Compresion algorithm used to compress data. ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
448 b'Some engine are faster than other' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
449 ) |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
450 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
451 upgrademessage = _( |
43117
8ff1ecfadcd1
cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43089
diff
changeset
|
452 b'revlog content will be recompressed with the new algorithm.' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
453 ) |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
454 |
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
455 @classmethod |
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
456 def fromrepo(cls, repo): |
42136
10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42046
diff
changeset
|
457 # we allow multiple compression engine requirement to co-exist because |
10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42046
diff
changeset
|
458 # strickly speaking, revlog seems to support mixed compression style. |
10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42046
diff
changeset
|
459 # |
10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42046
diff
changeset
|
460 # The compression used for new entries will be "the last one" |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
461 compression = b'zlib' |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
462 for req in repo.requirements: |
42136
10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42046
diff
changeset
|
463 prefix = req.startswith |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
464 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'): |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
465 compression = req.split(b'-', 2)[2] |
42136
10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42046
diff
changeset
|
466 return compression |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
467 |
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
468 @classmethod |
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
469 def fromconfig(cls, repo): |
44382
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
470 compengines = repo.ui.configlist(b'format', b'revlog-compression') |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
471 # return the first valid value as the selection code would do |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
472 for comp in compengines: |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
473 if comp in util.compengines: |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
474 return comp |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
475 |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
476 # no valide compression found lets display it all for clarity |
f0027a3dd7cb
revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43805
diff
changeset
|
477 return b','.join(compengines) |
35340
ead01b74be04
upgrade: register compression as a format variants
Boris Feld <boris.feld@octobus.net>
parents:
35335
diff
changeset
|
478 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
479 |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
480 @registerformatvariant |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
481 class compressionlevel(formatvariant): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
482 name = b'compression-level' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
483 default = b'default' |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
484 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
485 description = _(b'compression level') |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
486 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
487 upgrademessage = _(b'revlog content will be recompressed') |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
488 |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
489 @classmethod |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
490 def fromrepo(cls, repo): |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
491 comp = compressionengine.fromrepo(repo) |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
492 level = None |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
493 if comp == b'zlib': |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
494 level = repo.ui.configint(b'storage', b'revlog.zlib.level') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
495 elif comp == b'zstd': |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
496 level = repo.ui.configint(b'storage', b'revlog.zstd.level') |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
497 if level is None: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
498 return b'default' |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
499 return bytes(level) |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
500 |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
501 @classmethod |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
502 def fromconfig(cls, repo): |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
503 comp = compressionengine.fromconfig(repo) |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
504 level = None |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
505 if comp == b'zlib': |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
506 level = repo.ui.configint(b'storage', b'revlog.zlib.level') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
507 elif comp == b'zstd': |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
508 level = repo.ui.configint(b'storage', b'revlog.zstd.level') |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
509 if level is None: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
510 return b'default' |
42045
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
511 return bytes(level) |
d7e751ec679e
compression: display compression level in debugformat
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
41089
diff
changeset
|
512 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
513 |
31896
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
514 def finddeficiencies(repo): |
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
515 """returns a list of deficiencies that the repo suffer from""" |
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
516 deficiencies = [] |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
517 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
518 # We could detect lack of revlogv1 and store here, but they were added |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
519 # in 0.9.2 and we don't support upgrading repos without these |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
520 # requirements, so let's not bother. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
521 |
32032
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
522 for fv in allformatvariant: |
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
523 if not fv.fromrepo(repo): |
189778a06743
upgrade: register all format variants in a list
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32031
diff
changeset
|
524 deficiencies.append(fv) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
525 |
31896
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
526 return deficiencies |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
527 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
528 |
41088
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
529 # search without '-' to support older form on newer client. |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
530 # |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
531 # We don't enforce backward compatibility for debug command so this |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
532 # might eventually be dropped. However, having to use two different |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
533 # forms in script when comparing result is anoying enough to add |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
534 # backward compatibility for a while. |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
535 legacy_opts_map = { |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
536 b'redeltaparent': b're-delta-parent', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
537 b'redeltamultibase': b're-delta-multibase', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
538 b'redeltaall': b're-delta-all', |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
539 b'redeltafulladd': b're-delta-fulladd', |
41088
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
540 } |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
541 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
542 |
31896
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
543 def findoptimizations(repo): |
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
544 """Determine optimisation that could be used during upgrade""" |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
545 # These are unconditionally added. There is logic later that figures out |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
546 # which ones to apply. |
31896
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
547 optimizations = [] |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
548 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
549 optimizations.append( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
550 improvement( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
551 name=b're-delta-parent', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
552 type=optimisation, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
553 description=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
554 b'deltas within internal storage will be recalculated to ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
555 b'choose an optimal base revision where this was not ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
556 b'already done; the size of the repository may shrink and ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
557 b'various operations may become faster; the first time ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
558 b'this optimization is performed could slow down upgrade ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
559 b'execution considerably; subsequent invocations should ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
560 b'not run noticeably slower' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
561 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
562 upgrademessage=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
563 b'deltas within internal storage will choose a new ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
564 b'base revision if needed' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
565 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
566 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
567 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
568 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
569 optimizations.append( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
570 improvement( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
571 name=b're-delta-multibase', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
572 type=optimisation, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
573 description=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
574 b'deltas within internal storage will be recalculated ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
575 b'against multiple base revision and the smallest ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
576 b'difference will be used; the size of the repository may ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
577 b'shrink significantly when there are many merges; this ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
578 b'optimization will slow down execution in proportion to ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
579 b'the number of merges in the repository and the amount ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
580 b'of files in the repository; this slow down should not ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
581 b'be significant unless there are tens of thousands of ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
582 b'files and thousands of merges' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
583 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
584 upgrademessage=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
585 b'deltas within internal storage will choose an ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
586 b'optimal delta by computing deltas against multiple ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
587 b'parents; may slow down execution time ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
588 b'significantly' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
589 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
590 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
591 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
592 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
593 optimizations.append( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
594 improvement( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
595 name=b're-delta-all', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
596 type=optimisation, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
597 description=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
598 b'deltas within internal storage will always be ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
599 b'recalculated without reusing prior deltas; this will ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
600 b'likely make execution run several times slower; this ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
601 b'optimization is typically not needed' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
602 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
603 upgrademessage=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
604 b'deltas within internal storage will be fully ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
605 b'recomputed; this will likely drastically slow down ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
606 b'execution time' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
607 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
608 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
609 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
610 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
611 optimizations.append( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
612 improvement( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
613 name=b're-delta-fulladd', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
614 type=optimisation, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
615 description=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
616 b'every revision will be re-added as if it was new ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
617 b'content. It will go through the full storage ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
618 b'mechanism giving extensions a chance to process it ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
619 b'(eg. lfs). This is similar to "re-delta-all" but even ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
620 b'slower since more logic is involved.' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
621 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
622 upgrademessage=_( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
623 b'each revision will be added as new content to the ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
624 b'internal storage; this will likely drastically slow ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
625 b'down execution time, but some extensions might need ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
626 b'it' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
627 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
628 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
629 ) |
35345
6226668a7169
upgrade: add a 'redeltafullall' mode
Boris Feld <boris.feld@octobus.net>
parents:
35344
diff
changeset
|
630 |
31896
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
631 return optimizations |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
632 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
633 |
31900
0f0d7005b9ad
upgrade: simplify 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31899
diff
changeset
|
634 def determineactions(repo, deficiencies, sourcereqs, destreqs): |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
635 """Determine upgrade actions that will be performed. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
636 |
31896
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
637 Given a list of improvements as returned by ``finddeficiencies`` and |
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
638 ``findoptimizations``, determine the list of upgrade actions that |
127b41e975fd
upgrade: split finding deficiencies from finding optimisations
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31895
diff
changeset
|
639 will be performed. |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
640 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
641 The role of this function is to filter improvements if needed, apply |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
642 recommended optimizations from the improvements list that make sense, |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
643 etc. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
644 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
645 Returns a list of action names. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
646 """ |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
647 newactions = [] |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
648 |
31900
0f0d7005b9ad
upgrade: simplify 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31899
diff
changeset
|
649 for d in deficiencies: |
44746
c36a3fcfc36b
upgrade: properly filter action depending on planned work
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44452
diff
changeset
|
650 name = d._requirement |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
651 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
652 # If the action is a requirement that doesn't show up in the |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
653 # destination requirements, prune the action. |
44746
c36a3fcfc36b
upgrade: properly filter action depending on planned work
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44452
diff
changeset
|
654 if name is not None and name not in destreqs: |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
655 continue |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
656 |
31903
fa1088de2119
upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31902
diff
changeset
|
657 newactions.append(d) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
658 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
659 # FUTURE consider adding some optimizations here for certain transitions. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
660 # e.g. adding generaldelta could schedule parent redeltas. |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
661 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
662 return newactions |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
663 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
664 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
665 def _revlogfrompath(repo, path): |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
666 """Obtain a revlog from a repo path. |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
667 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
668 An instance of the appropriate class is returned. |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
669 """ |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
670 if path == b'00changelog.i': |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
671 return changelog.changelog(repo.svfs) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
672 elif path.endswith(b'00manifest.i'): |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
673 mandir = path[: -len(b'00manifest.i')] |
39243
0d97530eb535
manifest: rename dir argument and attribute to tree
Gregory Szorc <gregory.szorc@gmail.com>
parents:
38736
diff
changeset
|
674 return manifest.manifestrevlog(repo.svfs, tree=mandir) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
675 else: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
676 # reverse of "/".join(("data", path + ".i")) |
35344
8f3f8b8dbab7
upgrade: use actual filelog to convert filelog
Boris Feld <boris.feld@octobus.net>
parents:
35343
diff
changeset
|
677 return filelog.filelog(repo.svfs, path[5:-2]) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
678 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
679 |
42691
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
680 def _copyrevlog(tr, destrepo, oldrl, unencodedname): |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
681 """copy all relevant files for `oldrl` into `destrepo` store |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
682 |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
683 Files are copied "as is" without any transformation. The copy is performed |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
684 without extra checks. Callers are responsible for making sure the copied |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
685 content is compatible with format of the destination repository. |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
686 """ |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
687 oldrl = getattr(oldrl, '_revlog', oldrl) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
688 newrl = _revlogfrompath(destrepo, unencodedname) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
689 newrl = getattr(newrl, '_revlog', newrl) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
690 |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
691 oldvfs = oldrl.opener |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
692 newvfs = newrl.opener |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
693 oldindex = oldvfs.join(oldrl.indexfile) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
694 newindex = newvfs.join(newrl.indexfile) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
695 olddata = oldvfs.join(oldrl.datafile) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
696 newdata = newvfs.join(newrl.datafile) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
697 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
698 with newvfs(newrl.indexfile, b'w'): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
699 pass # create all the directories |
42691
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
700 |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
701 util.copyfile(oldindex, newindex) |
43002
373749982924
upgrade: also register copied `.d` files to fncache
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43000
diff
changeset
|
702 copydata = oldrl.opener.exists(oldrl.datafile) |
373749982924
upgrade: also register copied `.d` files to fncache
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43000
diff
changeset
|
703 if copydata: |
42691
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
704 util.copyfile(olddata, newdata) |
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
705 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
706 if not ( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
707 unencodedname.endswith(b'00changelog.i') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
708 or unencodedname.endswith(b'00manifest.i') |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
709 ): |
42691
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
710 destrepo.svfs.fncache.add(unencodedname) |
43002
373749982924
upgrade: also register copied `.d` files to fncache
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43000
diff
changeset
|
711 if copydata: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
712 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d') |
42691
5535a2201ff1
upgrade: introduce a _copyrevlog method
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42690
diff
changeset
|
713 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
714 |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
715 UPGRADE_CHANGELOG = object() |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
716 UPGRADE_MANIFEST = object() |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
717 UPGRADE_FILELOG = object() |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
718 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
719 UPGRADE_ALL_REVLOGS = frozenset( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
720 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOG] |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
721 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
722 |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
723 |
43135
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
724 def getsidedatacompanion(srcrepo, dstrepo): |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
725 sidedatacompanion = None |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
726 removedreqs = srcrepo.requirements - dstrepo.requirements |
43148
843da18386d5
sidedatacopies: deal with upgrading and downgrading to that format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43138
diff
changeset
|
727 addedreqs = dstrepo.requirements - srcrepo.requirements |
43135
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
728 if localrepo.SIDEDATA_REQUIREMENT in removedreqs: |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
729 |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
730 def sidedatacompanion(rl, rev): |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
731 rl = getattr(rl, '_revlog', rl) |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
732 if rl.flags(rev) & revlog.REVIDX_SIDEDATA: |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
733 return True, (), {} |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
734 return False, (), {} |
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
735 |
43148
843da18386d5
sidedatacopies: deal with upgrading and downgrading to that format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43138
diff
changeset
|
736 elif localrepo.COPIESSDC_REQUIREMENT in addedreqs: |
44940
4c1d39215034
metadata: move computation related to files touched in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44841
diff
changeset
|
737 sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo) |
43148
843da18386d5
sidedatacopies: deal with upgrading and downgrading to that format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43138
diff
changeset
|
738 elif localrepo.COPIESSDC_REQUIREMENT in removedreqs: |
44940
4c1d39215034
metadata: move computation related to files touched in a dedicated module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44841
diff
changeset
|
739 sidedatacompanion = metadata.getsidedataremover(srcrepo, dstrepo) |
43135
6e3dc1eff5c7
upgrade: allow for `sidedata` removal
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43134
diff
changeset
|
740 return sidedatacompanion |
43134
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
741 |
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
742 |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
743 def matchrevlog(revlogfilter, entry): |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
744 """check is a revlog is selected for cloning |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
745 |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
746 The store entry is checked against the passed filter""" |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
747 if entry.endswith(b'00changelog.i'): |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
748 return UPGRADE_CHANGELOG in revlogfilter |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
749 elif entry.endswith(b'00manifest.i'): |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
750 return UPGRADE_MANIFEST in revlogfilter |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
751 return UPGRADE_FILELOG in revlogfilter |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
752 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
753 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
754 def _clonerevlogs( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
755 ui, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
756 srcrepo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
757 dstrepo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
758 tr, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
759 deltareuse, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
760 forcedeltabothparents, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
761 revlogs=UPGRADE_ALL_REVLOGS, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
762 ): |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
763 """Copy revlogs between 2 repos.""" |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
764 revcount = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
765 srcsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
766 srcrawsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
767 dstsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
768 fcount = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
769 frevcount = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
770 fsrcsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
771 frawsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
772 fdstsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
773 mcount = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
774 mrevcount = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
775 msrcsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
776 mrawsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
777 mdstsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
778 crevcount = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
779 csrcsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
780 crawsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
781 cdstsize = 0 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
782 |
42689
896fb9deeaf8
upgrade: walk the source store file only once
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42137
diff
changeset
|
783 alldatafiles = list(srcrepo.store.walk()) |
896fb9deeaf8
upgrade: walk the source store file only once
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42137
diff
changeset
|
784 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
785 # Perform a pass to collect metadata. This validates we can open all |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
786 # source files and allows a unified progress bar to be displayed. |
42689
896fb9deeaf8
upgrade: walk the source store file only once
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42137
diff
changeset
|
787 for unencoded, encoded, size in alldatafiles: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
788 if unencoded.endswith(b'.d'): |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
789 continue |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
790 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
791 rl = _revlogfrompath(srcrepo, unencoded) |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
792 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
793 info = rl.storageinfo( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
794 exclusivefiles=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
795 revisionscount=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
796 trackedsize=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
797 storedsize=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
798 ) |
39857
8dab7c8a93eb
upgrade: report size of backing files, not internal storage size
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39546
diff
changeset
|
799 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
800 revcount += info[b'revisionscount'] or 0 |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
801 datasize = info[b'storedsize'] or 0 |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
802 rawsize = info[b'trackedsize'] or 0 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
803 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
804 srcsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
805 srcrawsize += rawsize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
806 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
807 # This is for the separate progress bars. |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
808 if isinstance(rl, changelog.changelog): |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
809 crevcount += len(rl) |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
810 csrcsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
811 crawsize += rawsize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
812 elif isinstance(rl, manifest.manifestrevlog): |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
813 mcount += 1 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
814 mrevcount += len(rl) |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
815 msrcsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
816 mrawsize += rawsize |
37444
c8666a9e9e11
upgrade: sniff for filelog type
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36373
diff
changeset
|
817 elif isinstance(rl, filelog.filelog): |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
818 fcount += 1 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
819 frevcount += len(rl) |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
820 fsrcsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
821 frawsize += rawsize |
37444
c8666a9e9e11
upgrade: sniff for filelog type
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36373
diff
changeset
|
822 else: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
823 error.ProgrammingError(b'unknown revlog type') |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
824 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
825 if not revcount: |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
826 return |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
827 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
828 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
829 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
830 b'migrating %d total revisions (%d in filelogs, %d in manifests, ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
831 b'%d in changelog)\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
832 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
833 % (revcount, frevcount, mrevcount, crevcount) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
834 ) |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
835 ui.status( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
836 _(b'migrating %s in store; %s tracked data\n') |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
837 % ((util.bytecount(srcsize), util.bytecount(srcrawsize))) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
838 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
839 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
840 # Used to keep track of progress. |
38399
185588cb0c4b
upgrade: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents:
38398
diff
changeset
|
841 progress = None |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
842 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
843 def oncopiedrevision(rl, rev, node): |
38399
185588cb0c4b
upgrade: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents:
38398
diff
changeset
|
844 progress.increment() |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
845 |
43134
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
846 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo) |
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
847 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
848 # Do the actual copying. |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
849 # FUTURE this operation can be farmed off to worker processes. |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
850 seen = set() |
42689
896fb9deeaf8
upgrade: walk the source store file only once
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42137
diff
changeset
|
851 for unencoded, encoded, size in alldatafiles: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
852 if unencoded.endswith(b'.d'): |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
853 continue |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
854 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
855 oldrl = _revlogfrompath(srcrepo, unencoded) |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
856 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
857 if isinstance(oldrl, changelog.changelog) and b'c' not in seen: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
858 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
859 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
860 b'finished migrating %d manifest revisions across %d ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
861 b'manifests; change in size: %s\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
862 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
863 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize)) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
864 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
865 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
866 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
867 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
868 b'migrating changelog containing %d revisions ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
869 b'(%s in store; %s tracked data)\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
870 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
871 % ( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
872 crevcount, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
873 util.bytecount(csrcsize), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
874 util.bytecount(crawsize), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
875 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
876 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
877 seen.add(b'c') |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
878 progress = srcrepo.ui.makeprogress( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
879 _(b'changelog revisions'), total=crevcount |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
880 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
881 elif isinstance(oldrl, manifest.manifestrevlog) and b'm' not in seen: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
882 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
883 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
884 b'finished migrating %d filelog revisions across %d ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
885 b'filelogs; change in size: %s\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
886 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
887 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize)) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
888 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
889 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
890 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
891 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
892 b'migrating %d manifests containing %d revisions ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
893 b'(%s in store; %s tracked data)\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
894 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
895 % ( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
896 mcount, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
897 mrevcount, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
898 util.bytecount(msrcsize), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
899 util.bytecount(mrawsize), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
900 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
901 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
902 seen.add(b'm') |
38398
f273b768b60f
upgrade: close progress after each revlog
Martin von Zweigbergk <martinvonz@google.com>
parents:
38165
diff
changeset
|
903 if progress: |
38399
185588cb0c4b
upgrade: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents:
38398
diff
changeset
|
904 progress.complete() |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
905 progress = srcrepo.ui.makeprogress( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
906 _(b'manifest revisions'), total=mrevcount |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
907 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
908 elif b'f' not in seen: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
909 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
910 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
911 b'migrating %d filelogs containing %d revisions ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
912 b'(%s in store; %s tracked data)\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
913 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
914 % ( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
915 fcount, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
916 frevcount, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
917 util.bytecount(fsrcsize), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
918 util.bytecount(frawsize), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
919 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
920 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
921 seen.add(b'f') |
38398
f273b768b60f
upgrade: close progress after each revlog
Martin von Zweigbergk <martinvonz@google.com>
parents:
38165
diff
changeset
|
922 if progress: |
38399
185588cb0c4b
upgrade: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents:
38398
diff
changeset
|
923 progress.complete() |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
924 progress = srcrepo.ui.makeprogress( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
925 _(b'file revisions'), total=frevcount |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
926 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
927 |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
928 if matchrevlog(revlogs, unencoded): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
929 ui.note( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
930 _(b'cloning %d revisions from %s\n') % (len(oldrl), unencoded) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
931 ) |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
932 newrl = _revlogfrompath(dstrepo, unencoded) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
933 oldrl.clone( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
934 tr, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
935 newrl, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
936 addrevisioncb=oncopiedrevision, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
937 deltareuse=deltareuse, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
938 forcedeltabothparents=forcedeltabothparents, |
43134
75ad8af9c95e
upgrade: allow upgrade to repository using sidedata
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43117
diff
changeset
|
939 sidedatacompanion=sidedatacompanion, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
940 ) |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
941 else: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
942 msg = _(b'blindly copying %s containing %i revisions\n') |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
943 ui.note(msg % (unencoded, len(oldrl))) |
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
944 _copyrevlog(tr, dstrepo, oldrl, unencoded) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
945 |
42693
0812d9fb63fe
upgrade: introduce the internal code for revlog cloning selection
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42691
diff
changeset
|
946 newrl = _revlogfrompath(dstrepo, unencoded) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
947 |
39870
b399ff55ee6d
upgrade: use storageinfo() for obtaining storage metadata
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39859
diff
changeset
|
948 info = newrl.storageinfo(storedsize=True) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
949 datasize = info[b'storedsize'] or 0 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
950 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
951 dstsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
952 |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
953 if isinstance(newrl, changelog.changelog): |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
954 cdstsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
955 elif isinstance(newrl, manifest.manifestrevlog): |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
956 mdstsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
957 else: |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
958 fdstsize += datasize |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
959 |
38399
185588cb0c4b
upgrade: use progress helper
Martin von Zweigbergk <martinvonz@google.com>
parents:
38398
diff
changeset
|
960 progress.complete() |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
961 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
962 ui.status( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
963 _( |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
964 b'finished migrating %d changelog revisions; change in size: ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
965 b'%s\n' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
966 ) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
967 % (crevcount, util.bytecount(cdstsize - csrcsize)) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
968 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
969 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
970 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
971 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
972 b'finished migrating %d total revisions; total change in store ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
973 b'size: %s\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
974 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
975 % (revcount, util.bytecount(dstsize - srcsize)) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
976 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
977 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
978 |
31873
d6c2005484b6
upgrade: drop the prefix to the '_filterstorefile' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31872
diff
changeset
|
979 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st): |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
980 """Determine whether to copy a store file during upgrade. |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
981 |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
982 This function is called when migrating store files from ``srcrepo`` to |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
983 ``dstrepo`` as part of upgrading a repository. |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
984 |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
985 Args: |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
986 srcrepo: repo we are copying from |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
987 dstrepo: repo we are copying to |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
988 requirements: set of requirements for ``dstrepo`` |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
989 path: store file being examined |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
990 mode: the ``ST_MODE`` file type of ``path`` |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
991 st: ``stat`` data structure for ``path`` |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
992 |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
993 Function should return ``True`` if the file is to be copied. |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
994 """ |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
995 # Skip revlogs. |
44841
526d69eeea31
upgrade: support upgrade and downgrade from persistent nodemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44799
diff
changeset
|
996 if path.endswith((b'.i', b'.d', b'.n', b'.nd')): |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
997 return False |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
998 # Skip transaction related files. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
999 if path.startswith(b'undo'): |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1000 return False |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1001 # Only copy regular files. |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1002 if mode != stat.S_IFREG: |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1003 return False |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1004 # Skip other skipped files. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1005 if path in (b'lock', b'fncache'): |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1006 return False |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1007 |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1008 return True |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1009 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1010 |
31874
27ec6517e40e
upgrade: drop the prefix to the '_finishdatamigration' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31873
diff
changeset
|
1011 def _finishdatamigration(ui, srcrepo, dstrepo, requirements): |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1012 """Hook point for extensions to perform additional actions during upgrade. |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1013 |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1014 This function is called after revlogs and store files have been copied but |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1015 before the new store is swapped into the original location. |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1016 """ |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1017 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1018 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1019 def _upgraderepo( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1020 ui, srcrepo, dstrepo, requirements, actions, revlogs=UPGRADE_ALL_REVLOGS |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1021 ): |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1022 """Do the low-level work of upgrading a repository. |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1023 |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1024 The upgrade is effectively performed as a copy between a source |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1025 repository and a temporary destination repository. |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1026 |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1027 The source repository is unmodified for as long as possible so the |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1028 upgrade can abort at any time without causing loss of service for |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1029 readers and without corrupting the source repository. |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1030 """ |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1031 assert srcrepo.currentwlock() |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1032 assert dstrepo.currentwlock() |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1033 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1034 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1035 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1036 b'(it is safe to interrupt this process any time before ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1037 b'data migration completes)\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1038 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1039 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1040 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1041 if b're-delta-all' in actions: |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1042 deltareuse = revlog.revlog.DELTAREUSENEVER |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1043 elif b're-delta-parent' in actions: |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1044 deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1045 elif b're-delta-multibase' in actions: |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1046 deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1047 elif b're-delta-fulladd' in actions: |
35345
6226668a7169
upgrade: add a 'redeltafullall' mode
Boris Feld <boris.feld@octobus.net>
parents:
35344
diff
changeset
|
1048 deltareuse = revlog.revlog.DELTAREUSEFULLADD |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1049 else: |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1050 deltareuse = revlog.revlog.DELTAREUSEALWAYS |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1051 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1052 with dstrepo.transaction(b'upgrade') as tr: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1053 _clonerevlogs( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1054 ui, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1055 srcrepo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1056 dstrepo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1057 tr, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1058 deltareuse, |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1059 b're-delta-multibase' in actions, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1060 revlogs=revlogs, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1061 ) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1062 |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1063 # Now copy other files in the store directory. |
31797
0b913e1e725b
repair: iterate store files deterministically
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30781
diff
changeset
|
1064 # The sorted() makes execution deterministic. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1065 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1066 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st): |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1067 continue |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1068 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1069 srcrepo.ui.status(_(b'copying %s\n') % p) |
31799
8110d49e0558
repair: use rawvfs when copying extra store files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31797
diff
changeset
|
1070 src = srcrepo.store.rawvfs.join(p) |
8110d49e0558
repair: use rawvfs when copying extra store files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31797
diff
changeset
|
1071 dst = dstrepo.store.rawvfs.join(p) |
30780
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1072 util.copyfile(src, dst, copystat=True) |
2603d04889e1
repair: copy non-revlog store files during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30779
diff
changeset
|
1073 |
31874
27ec6517e40e
upgrade: drop the prefix to the '_finishdatamigration' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31873
diff
changeset
|
1074 _finishdatamigration(ui, srcrepo, dstrepo, requirements) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1075 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1076 ui.status(_(b'data fully migrated to temporary repository\n')) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1077 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1078 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path) |
31232
254f98326eef
vfs: use 'vfs' module directly in 'mercurial.repair'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
30975
diff
changeset
|
1079 backupvfs = vfsmod.vfs(backuppath) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1080 |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1081 # Make a backup of requires file first, as it is the first to be modified. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1082 util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires')) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1083 |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1084 # We install an arbitrary requirement that clients must not support |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1085 # as a mechanism to lock out new clients during the data swap. This is |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1086 # better than allowing a client to continue while the repository is in |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1087 # an inconsistent state. |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1088 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1089 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1090 b'marking source repository as being upgraded; clients will be ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1091 b'unable to read from repository\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1092 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1093 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1094 scmutil.writerequires( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1095 srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'} |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1096 ) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1097 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1098 ui.status(_(b'starting in-place swap of repository data\n')) |
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1099 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1100 |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1101 # Now swap in the new store directory. Doing it as a rename should make |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1102 # the operation nearly instantaneous and atomic (at least in well-behaved |
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1103 # environments). |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1104 ui.status(_(b'replacing store...\n')) |
30975
22fbca1d11ed
mercurial: switch to util.timer for all interval timings
Simon Farnsworth <simonfar@fb.com>
parents:
30781
diff
changeset
|
1105 tstart = util.timer() |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1106 util.rename(srcrepo.spath, backupvfs.join(b'store')) |
30779
38aa1ca97b6a
repair: migrate revlogs during upgrade
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30777
diff
changeset
|
1107 util.rename(dstrepo.spath, srcrepo.spath) |
30975
22fbca1d11ed
mercurial: switch to util.timer for all interval timings
Simon Farnsworth <simonfar@fb.com>
parents:
30781
diff
changeset
|
1108 elapsed = util.timer() - tstart |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1109 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1110 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1111 b'store replacement complete; repository was inconsistent for ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1112 b'%0.1fs\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1113 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1114 % elapsed |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1115 ) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1116 |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1117 # We first write the requirements file. Any new requirements will lock |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1118 # out legacy clients. |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1119 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1120 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1121 b'finalizing requirements file and making repository readable ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1122 b'again\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1123 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1124 ) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1125 scmutil.writerequires(srcrepo.vfs, requirements) |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1126 |
30781
f2c069bf78ee
repair: clean up stale lock file from store backup
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30780
diff
changeset
|
1127 # The lock file from the old store won't be removed because nothing has a |
f2c069bf78ee
repair: clean up stale lock file from store backup
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30780
diff
changeset
|
1128 # reference to its new location. So clean it up manually. Alternatively, we |
f2c069bf78ee
repair: clean up stale lock file from store backup
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30780
diff
changeset
|
1129 # could update srcrepo.svfs and other variables to point to the new |
f2c069bf78ee
repair: clean up stale lock file from store backup
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30780
diff
changeset
|
1130 # location. This is simpler. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1131 backupvfs.unlink(b'store/lock') |
30781
f2c069bf78ee
repair: clean up stale lock file from store backup
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30780
diff
changeset
|
1132 |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1133 return backuppath |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1134 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1135 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1136 def upgraderepo( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1137 ui, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1138 repo, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1139 run=False, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1140 optimize=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1141 backup=True, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1142 manifest=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1143 changelog=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1144 ): |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1145 """Upgrade a repository in place.""" |
41088
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
1146 if optimize is None: |
5608b5a6c323
upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents:
40997
diff
changeset
|
1147 optimize = [] |
44452
9d2b2df2c2ba
cleanup: run pyupgrade on our source tree to clean up varying things
Augie Fackler <augie@google.com>
parents:
44382
diff
changeset
|
1148 optimize = {legacy_opts_map.get(o, o) for o in optimize} |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1149 repo = repo.unfiltered() |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1150 |
42830
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1151 revlogs = set(UPGRADE_ALL_REVLOGS) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1152 specentries = ((b'c', changelog), (b'm', manifest)) |
42830
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1153 specified = [(y, x) for (y, x) in specentries if x is not None] |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1154 if specified: |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1155 # we have some limitation on revlogs to be recloned |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1156 if any(x for y, x in specified): |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1157 revlogs = set() |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1158 for r, enabled in specified: |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1159 if enabled: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1160 if r == b'c': |
42831
908ff446590e
upgrade: add an argument to control changelog upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42830
diff
changeset
|
1161 revlogs.add(UPGRADE_CHANGELOG) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1162 elif r == b'm': |
42830
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1163 revlogs.add(UPGRADE_MANIFEST) |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1164 else: |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1165 # none are enabled |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1166 for r, __ in specified: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1167 if r == b'c': |
42831
908ff446590e
upgrade: add an argument to control changelog upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42830
diff
changeset
|
1168 revlogs.discard(UPGRADE_CHANGELOG) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1169 elif r == b'm': |
42830
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1170 revlogs.discard(UPGRADE_MANIFEST) |
cf2b765cecd7
upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42693
diff
changeset
|
1171 |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1172 # Ensure the repository can be upgraded. |
31865
5dcaa0f4455b
upgrade: drop the prefix to the 'requiredsourcerequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31864
diff
changeset
|
1173 missingreqs = requiredsourcerequirements(repo) - repo.requirements |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1174 if missingreqs: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1175 raise error.Abort( |
43117
8ff1ecfadcd1
cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43089
diff
changeset
|
1176 _(b'cannot upgrade repository; requirement missing: %s') |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1177 % _(b', ').join(sorted(missingreqs)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1178 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1179 |
31866
1454726b6d7c
upgrade: drop the prefix to the 'blocksourcerequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31865
diff
changeset
|
1180 blockedreqs = blocksourcerequirements(repo) & repo.requirements |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1181 if blockedreqs: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1182 raise error.Abort( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1183 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1184 b'cannot upgrade repository; unsupported source ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1185 b'requirement: %s' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1186 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1187 % _(b', ').join(sorted(blockedreqs)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1188 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1189 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1190 # FUTURE there is potentially a need to control the wanted requirements via |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1191 # command arguments or via an extension hook point. |
39996
dbcb466d0065
localrepo: define storage backend in creation options (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
39870
diff
changeset
|
1192 newreqs = localrepo.newreporequirements( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1193 repo.ui, localrepo.defaultcreateopts(repo.ui) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1194 ) |
35302
ad2b35ebf670
upgraderepo: allow extension to register preserved requirements
Boris Feld <boris.feld@octobus.net>
parents:
33438
diff
changeset
|
1195 newreqs.update(preservedrequirements(repo)) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1196 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1197 noremovereqs = ( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1198 repo.requirements - newreqs - supportremovedrequirements(repo) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1199 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1200 if noremovereqs: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1201 raise error.Abort( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1202 _( |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1203 b'cannot upgrade repository; requirement would be ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1204 b'removed: %s' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1205 ) |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1206 % _(b', ').join(sorted(noremovereqs)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1207 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1208 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1209 noaddreqs = newreqs - repo.requirements - allowednewrequirements(repo) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1210 if noaddreqs: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1211 raise error.Abort( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1212 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1213 b'cannot upgrade repository; do not support adding ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1214 b'requirement: %s' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1215 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1216 % _(b', ').join(sorted(noaddreqs)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1217 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1218 |
31870
49011f1cedd4
upgrade: drop the prefix to the 'supporteddestrequirements' function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31869
diff
changeset
|
1219 unsupportedreqs = newreqs - supporteddestrequirements(repo) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1220 if unsupportedreqs: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1221 raise error.Abort( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1222 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1223 b'cannot upgrade repository; do not support ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1224 b'destination requirement: %s' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1225 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1226 % _(b', ').join(sorted(unsupportedreqs)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1227 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1228 |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1229 # Find and validate all improvements that can be made. |
31899
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1230 alloptimizations = findoptimizations(repo) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1231 |
31899
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1232 # Apply and Validate arguments. |
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1233 optimizations = [] |
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1234 for o in alloptimizations: |
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1235 if o.name in optimize: |
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1236 optimizations.append(o) |
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1237 optimize.discard(o.name) |
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1238 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1239 if optimize: # anything left is unknown |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1240 raise error.Abort( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1241 _(b'unknown optimization action requested: %s') |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1242 % b', '.join(sorted(optimize)), |
43117
8ff1ecfadcd1
cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents:
43089
diff
changeset
|
1243 hint=_(b'run without arguments to see valid optimizations'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1244 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1245 |
31897
d0067250542d
upgrade: simplify optimisations validation
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31896
diff
changeset
|
1246 deficiencies = finddeficiencies(repo) |
31899
cccd8e1538b0
upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31898
diff
changeset
|
1247 actions = determineactions(repo, deficiencies, repo.requirements, newreqs) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1248 actions.extend( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1249 o |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1250 for o in sorted(optimizations) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1251 # determineactions could have added optimisation |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1252 if o not in actions |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1253 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1254 |
42832
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1255 removedreqs = repo.requirements - newreqs |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1256 addedreqs = newreqs - repo.requirements |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1257 |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1258 if revlogs != UPGRADE_ALL_REVLOGS: |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1259 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs) |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1260 if incompatible: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1261 msg = _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1262 b'ignoring revlogs selection flags, format requirements ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1263 b'change: %s\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1264 ) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1265 ui.warn(msg % b', '.join(sorted(incompatible))) |
42832
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1266 revlogs = UPGRADE_ALL_REVLOGS |
a3c2ffcd266f
upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
42831
diff
changeset
|
1267 |
43805
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1268 def write_labeled(l, label): |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1269 first = True |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1270 for r in sorted(l): |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1271 if not first: |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1272 ui.write(b', ') |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1273 ui.write(r, label=label) |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1274 first = False |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1275 |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1276 def printrequirements(): |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1277 ui.write(_(b'requirements\n')) |
43805
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1278 ui.write(_(b' preserved: ')) |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1279 write_labeled( |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1280 newreqs & repo.requirements, "upgrade-repo.requirement.preserved" |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1281 ) |
43805
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1282 ui.write((b'\n')) |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1283 removed = repo.requirements - newreqs |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1284 if repo.requirements - newreqs: |
43805
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1285 ui.write(_(b' removed: ')) |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1286 write_labeled(removed, "upgrade-repo.requirement.removed") |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1287 ui.write((b'\n')) |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1288 added = newreqs - repo.requirements |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1289 if added: |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1290 ui.write(_(b' added: ')) |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1291 write_labeled(added, "upgrade-repo.requirement.added") |
ad84fc97d120
upgrade-repo: colorize some of the output
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43148
diff
changeset
|
1292 ui.write((b'\n')) |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1293 ui.write(b'\n') |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1294 |
44797
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1295 def printoptimisations(): |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1296 optimisations = [a for a in actions if a.type == optimisation] |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1297 optimisations.sort(key=lambda a: a.name) |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1298 if optimisations: |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1299 ui.write(_(b'optimisations: ')) |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1300 write_labeled( |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1301 [a.name for a in optimisations], |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1302 "upgrade-repo.optimisation.performed", |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1303 ) |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1304 ui.write(b'\n\n') |
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1305 |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1306 def printupgradeactions(): |
31903
fa1088de2119
upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31902
diff
changeset
|
1307 for a in actions: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1308 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1309 |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1310 if not run: |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1311 fromconfig = [] |
31904
3c77f03f16b3
upgrade: simplify the "origin" dispatch in dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31903
diff
changeset
|
1312 onlydefault = [] |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1313 |
31901
9bdedb050d8d
upgrade: simplify some of the initial dispatch for dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31900
diff
changeset
|
1314 for d in deficiencies: |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
1315 if d.fromconfig(repo): |
31901
9bdedb050d8d
upgrade: simplify some of the initial dispatch for dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31900
diff
changeset
|
1316 fromconfig.append(d) |
32031
11a2461fc9b1
upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
32030
diff
changeset
|
1317 elif d.default: |
31904
3c77f03f16b3
upgrade: simplify the "origin" dispatch in dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31903
diff
changeset
|
1318 onlydefault.append(d) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1319 |
31904
3c77f03f16b3
upgrade: simplify the "origin" dispatch in dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31903
diff
changeset
|
1320 if fromconfig or onlydefault: |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1321 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1322 if fromconfig: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1323 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1324 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1325 b'repository lacks features recommended by ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1326 b'current config options:\n\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1327 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1328 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1329 for i in fromconfig: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1330 ui.status(b'%s\n %s\n\n' % (i.name, i.description)) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1331 |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1332 if onlydefault: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1333 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1334 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1335 b'repository lacks features used by the default ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1336 b'config options:\n\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1337 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1338 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1339 for i in onlydefault: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1340 ui.status(b'%s\n %s\n\n' % (i.name, i.description)) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1341 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1342 ui.status(b'\n') |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1343 else: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1344 ui.status( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1345 _( |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1346 b'(no feature deficiencies found in existing ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1347 b'repository)\n' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1348 ) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1349 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1350 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1351 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1352 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1353 b'performing an upgrade with "--run" will make the following ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1354 b'changes:\n\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1355 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1356 ) |
30775
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1357 |
513d68a90398
repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30707
diff
changeset
|
1358 printrequirements() |
44797
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1359 printoptimisations() |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1360 printupgradeactions() |
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1361 |
31903
fa1088de2119
upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31902
diff
changeset
|
1362 unusedoptimize = [i for i in alloptimizations if i not in actions] |
fa1088de2119
upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31902
diff
changeset
|
1363 |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1364 if unusedoptimize: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1365 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1366 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1367 b'additional optimizations are available by specifying ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1368 b'"--optimize <name>":\n\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1369 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1370 ) |
30776
3997edc4a86d
repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30775
diff
changeset
|
1371 for i in unusedoptimize: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1372 ui.status(_(b'%s\n %s\n\n') % (i.name, i.description)) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1373 return |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1374 |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1375 # Else we're in the run=true case. |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1376 ui.write(_(b'upgrade will perform the following actions:\n\n')) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1377 printrequirements() |
44797
5ee4b2119af9
upgrade: clearly list optimisations
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44746
diff
changeset
|
1378 printoptimisations() |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1379 printupgradeactions() |
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1380 |
31903
fa1088de2119
upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31902
diff
changeset
|
1381 upgradeactions = [a.name for a in actions] |
fa1088de2119
upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
31902
diff
changeset
|
1382 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1383 ui.status(_(b'beginning upgrade...\n')) |
33438 | 1384 with repo.wlock(), repo.lock(): |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1385 ui.status(_(b'repository locked and read-only\n')) |
33438 | 1386 # Our strategy for upgrading the repository is to create a new, |
1387 # temporary repository, write data to it, then do a swap of the | |
1388 # data. There are less heavyweight ways to do this, but it is easier | |
1389 # to create a new repo object than to instantiate all the components | |
1390 # (like the store) separately. | |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1391 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path) |
33438 | 1392 backuppath = None |
1393 try: | |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1394 ui.status( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1395 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1396 b'creating temporary repository to stage migrated ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1397 b'data: %s\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1398 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1399 % tmppath |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1400 ) |
35342
75520786ad2f
upgrade: use the repository 'ui' as the base for the new repository
Boris Feld <boris.feld@octobus.net>
parents:
35340
diff
changeset
|
1401 |
35379
6c28956ba2d4
upgrade: simplify workaround for repo.ui.copy()
Yuya Nishihara <yuya@tcha.org>
parents:
35345
diff
changeset
|
1402 # clone ui without using ui.copy because repo.ui is protected |
6c28956ba2d4
upgrade: simplify workaround for repo.ui.copy()
Yuya Nishihara <yuya@tcha.org>
parents:
35345
diff
changeset
|
1403 repoui = repo.ui.__class__(repo.ui) |
6c28956ba2d4
upgrade: simplify workaround for repo.ui.copy()
Yuya Nishihara <yuya@tcha.org>
parents:
35345
diff
changeset
|
1404 dstrepo = hg.repository(repoui, path=tmppath, create=True) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1405 |
33438 | 1406 with dstrepo.wlock(), dstrepo.lock(): |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1407 backuppath = _upgraderepo( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1408 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1409 ) |
41089
a59a74721c76
debugupgraderepo: add a --no-backup mode
Boris Feld <boris.feld@octobus.net>
parents:
41088
diff
changeset
|
1410 if not (backup or backuppath is None): |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1411 ui.status( |
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1412 _(b'removing old repository content%s\n') % backuppath |
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1413 ) |
41089
a59a74721c76
debugupgraderepo: add a --no-backup mode
Boris Feld <boris.feld@octobus.net>
parents:
41088
diff
changeset
|
1414 repo.vfs.rmtree(backuppath, forcibly=True) |
a59a74721c76
debugupgraderepo: add a --no-backup mode
Boris Feld <boris.feld@octobus.net>
parents:
41088
diff
changeset
|
1415 backuppath = None |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1416 |
33438 | 1417 finally: |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1418 ui.status(_(b'removing temporary repository %s\n') % tmppath) |
33438 | 1419 repo.vfs.rmtree(tmppath, forcibly=True) |
30777
7de7afd8bdd9
repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents:
30776
diff
changeset
|
1420 |
44798
e295ba238bd8
upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44797
diff
changeset
|
1421 if backuppath and not ui.quiet: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1422 ui.warn( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1423 _(b'copy of old repository backed up at %s\n') % backuppath |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1424 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1425 ui.warn( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1426 _( |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1427 b'the old repository will not be deleted; remove ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1428 b'it to free up disk space once the upgraded ' |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43076
diff
changeset
|
1429 b'repository is verified\n' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1430 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
43031
diff
changeset
|
1431 ) |