##// END OF EJS Templates
upgrade: detect the side-data format variants...
marmoute -
r43299:e16ca9fd default
parent child Browse files
Show More
@@ -0,0 +1,65 b''
1 ==========================================================
2 Test file dedicated to checking side-data related behavior
3 ==========================================================
4
5
6 Check upgrade behavior
7 ======================
8
9 Right now, sidedata has not upgrade support
10
11 Check that we cannot upgrade to sidedata
12 ----------------------------------------
13
14 $ hg init up-no-side-data --config format.use-side-data=no
15 $ hg debugformat -v -R up-no-side-data
16 format-variant repo config default
17 fncache: yes yes yes
18 dotencode: yes yes yes
19 generaldelta: yes yes yes
20 sparserevlog: yes yes yes
21 sidedata: no no no
22 plain-cl-delta: yes yes yes
23 compression: zlib zlib zlib
24 compression-level: default default default
25 $ hg debugformat -v -R up-no-side-data --config format.use-side-data=yes
26 format-variant repo config default
27 fncache: yes yes yes
28 dotencode: yes yes yes
29 generaldelta: yes yes yes
30 sparserevlog: yes yes yes
31 sidedata: no yes no
32 plain-cl-delta: yes yes yes
33 compression: zlib zlib zlib
34 compression-level: default default default
35 $ hg debugupgraderepo -R up-no-side-data --config format.use-side-data=yes
36 abort: cannot upgrade repository; do not support adding requirement: exp-sidedata-flag
37 [255]
38
39 Check that we cannot upgrade to sidedata
40 ----------------------------------------
41
42 $ hg init up-side-data --config format.use-side-data=yes
43 $ hg debugformat -v -R up-side-data
44 format-variant repo config default
45 fncache: yes yes yes
46 dotencode: yes yes yes
47 generaldelta: yes yes yes
48 sparserevlog: yes yes yes
49 sidedata: yes no no
50 plain-cl-delta: yes yes yes
51 compression: zlib zlib zlib
52 compression-level: default default default
53 $ hg debugformat -v -R up-side-data --config format.use-side-data=no
54 format-variant repo config default
55 fncache: yes yes yes
56 dotencode: yes yes yes
57 generaldelta: yes yes yes
58 sparserevlog: yes yes yes
59 sidedata: yes no no
60 plain-cl-delta: yes yes yes
61 compression: zlib zlib zlib
62 compression-level: default default default
63 $ hg debugupgraderepo -R up-side-data --config format.use-side-data=no
64 abort: cannot upgrade repository; requirement would be removed: exp-sidedata-flag
65 [255]
@@ -1,1080 +1,1093 b''
1 # upgrade.py - functions for in place upgrade of Mercurial repository
1 # upgrade.py - functions for in place upgrade of Mercurial repository
2 #
2 #
3 # Copyright (c) 2016-present, Gregory Szorc
3 # Copyright (c) 2016-present, Gregory Szorc
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import stat
10 import stat
11
11
12 from .i18n import _
12 from .i18n import _
13 from . import (
13 from . import (
14 changelog,
14 changelog,
15 error,
15 error,
16 filelog,
16 filelog,
17 hg,
17 hg,
18 localrepo,
18 localrepo,
19 manifest,
19 manifest,
20 pycompat,
20 pycompat,
21 revlog,
21 revlog,
22 scmutil,
22 scmutil,
23 util,
23 util,
24 vfs as vfsmod,
24 vfs as vfsmod,
25 )
25 )
26
26
27 from .utils import (
27 from .utils import (
28 compression,
28 compression,
29 )
29 )
30
30
31 # list of requirements that request a clone of all revlog if added/removed
31 # list of requirements that request a clone of all revlog if added/removed
32 RECLONES_REQUIREMENTS = {
32 RECLONES_REQUIREMENTS = {
33 'generaldelta',
33 'generaldelta',
34 localrepo.SPARSEREVLOG_REQUIREMENT,
34 localrepo.SPARSEREVLOG_REQUIREMENT,
35 }
35 }
36
36
37 def requiredsourcerequirements(repo):
37 def requiredsourcerequirements(repo):
38 """Obtain requirements required to be present to upgrade a repo.
38 """Obtain requirements required to be present to upgrade a repo.
39
39
40 An upgrade will not be allowed if the repository doesn't have the
40 An upgrade will not be allowed if the repository doesn't have the
41 requirements returned by this function.
41 requirements returned by this function.
42 """
42 """
43 return {
43 return {
44 # Introduced in Mercurial 0.9.2.
44 # Introduced in Mercurial 0.9.2.
45 'revlogv1',
45 'revlogv1',
46 # Introduced in Mercurial 0.9.2.
46 # Introduced in Mercurial 0.9.2.
47 'store',
47 'store',
48 }
48 }
49
49
50 def blocksourcerequirements(repo):
50 def blocksourcerequirements(repo):
51 """Obtain requirements that will prevent an upgrade from occurring.
51 """Obtain requirements that will prevent an upgrade from occurring.
52
52
53 An upgrade cannot be performed if the source repository contains a
53 An upgrade cannot be performed if the source repository contains a
54 requirements in the returned set.
54 requirements in the returned set.
55 """
55 """
56 return {
56 return {
57 # The upgrade code does not yet support these experimental features.
57 # The upgrade code does not yet support these experimental features.
58 # This is an artificial limitation.
58 # This is an artificial limitation.
59 'treemanifest',
59 'treemanifest',
60 # This was a precursor to generaldelta and was never enabled by default.
60 # This was a precursor to generaldelta and was never enabled by default.
61 # It should (hopefully) not exist in the wild.
61 # It should (hopefully) not exist in the wild.
62 'parentdelta',
62 'parentdelta',
63 # Upgrade should operate on the actual store, not the shared link.
63 # Upgrade should operate on the actual store, not the shared link.
64 'shared',
64 'shared',
65 }
65 }
66
66
67 def supportremovedrequirements(repo):
67 def supportremovedrequirements(repo):
68 """Obtain requirements that can be removed during an upgrade.
68 """Obtain requirements that can be removed during an upgrade.
69
69
70 If an upgrade were to create a repository that dropped a requirement,
70 If an upgrade were to create a repository that dropped a requirement,
71 the dropped requirement must appear in the returned set for the upgrade
71 the dropped requirement must appear in the returned set for the upgrade
72 to be allowed.
72 to be allowed.
73 """
73 """
74 supported = {
74 supported = {
75 localrepo.SPARSEREVLOG_REQUIREMENT,
75 localrepo.SPARSEREVLOG_REQUIREMENT,
76 }
76 }
77 for name in compression.compengines:
77 for name in compression.compengines:
78 engine = compression.compengines[name]
78 engine = compression.compengines[name]
79 if engine.available() and engine.revlogheader():
79 if engine.available() and engine.revlogheader():
80 supported.add(b'exp-compression-%s' % name)
80 supported.add(b'exp-compression-%s' % name)
81 if engine.name() == 'zstd':
81 if engine.name() == 'zstd':
82 supported.add(b'revlog-compression-zstd')
82 supported.add(b'revlog-compression-zstd')
83 return supported
83 return supported
84
84
85 def supporteddestrequirements(repo):
85 def supporteddestrequirements(repo):
86 """Obtain requirements that upgrade supports in the destination.
86 """Obtain requirements that upgrade supports in the destination.
87
87
88 If the result of the upgrade would create requirements not in this set,
88 If the result of the upgrade would create requirements not in this set,
89 the upgrade is disallowed.
89 the upgrade is disallowed.
90
90
91 Extensions should monkeypatch this to add their custom requirements.
91 Extensions should monkeypatch this to add their custom requirements.
92 """
92 """
93 supported = {
93 supported = {
94 'dotencode',
94 'dotencode',
95 'fncache',
95 'fncache',
96 'generaldelta',
96 'generaldelta',
97 'revlogv1',
97 'revlogv1',
98 'store',
98 'store',
99 localrepo.SPARSEREVLOG_REQUIREMENT,
99 localrepo.SPARSEREVLOG_REQUIREMENT,
100 }
100 }
101 for name in compression.compengines:
101 for name in compression.compengines:
102 engine = compression.compengines[name]
102 engine = compression.compengines[name]
103 if engine.available() and engine.revlogheader():
103 if engine.available() and engine.revlogheader():
104 supported.add(b'exp-compression-%s' % name)
104 supported.add(b'exp-compression-%s' % name)
105 if engine.name() == 'zstd':
105 if engine.name() == 'zstd':
106 supported.add(b'revlog-compression-zstd')
106 supported.add(b'revlog-compression-zstd')
107 return supported
107 return supported
108
108
109 def allowednewrequirements(repo):
109 def allowednewrequirements(repo):
110 """Obtain requirements that can be added to a repository during upgrade.
110 """Obtain requirements that can be added to a repository during upgrade.
111
111
112 This is used to disallow proposed requirements from being added when
112 This is used to disallow proposed requirements from being added when
113 they weren't present before.
113 they weren't present before.
114
114
115 We use a list of allowed requirement additions instead of a list of known
115 We use a list of allowed requirement additions instead of a list of known
116 bad additions because the whitelist approach is safer and will prevent
116 bad additions because the whitelist approach is safer and will prevent
117 future, unknown requirements from accidentally being added.
117 future, unknown requirements from accidentally being added.
118 """
118 """
119 supported = {
119 supported = {
120 'dotencode',
120 'dotencode',
121 'fncache',
121 'fncache',
122 'generaldelta',
122 'generaldelta',
123 localrepo.SPARSEREVLOG_REQUIREMENT,
123 localrepo.SPARSEREVLOG_REQUIREMENT,
124 }
124 }
125 for name in compression.compengines:
125 for name in compression.compengines:
126 engine = compression.compengines[name]
126 engine = compression.compengines[name]
127 if engine.available() and engine.revlogheader():
127 if engine.available() and engine.revlogheader():
128 supported.add(b'exp-compression-%s' % name)
128 supported.add(b'exp-compression-%s' % name)
129 if engine.name() == 'zstd':
129 if engine.name() == 'zstd':
130 supported.add(b'revlog-compression-zstd')
130 supported.add(b'revlog-compression-zstd')
131 return supported
131 return supported
132
132
133 def preservedrequirements(repo):
133 def preservedrequirements(repo):
134 return set()
134 return set()
135
135
136 deficiency = 'deficiency'
136 deficiency = 'deficiency'
137 optimisation = 'optimization'
137 optimisation = 'optimization'
138
138
139 class improvement(object):
139 class improvement(object):
140 """Represents an improvement that can be made as part of an upgrade.
140 """Represents an improvement that can be made as part of an upgrade.
141
141
142 The following attributes are defined on each instance:
142 The following attributes are defined on each instance:
143
143
144 name
144 name
145 Machine-readable string uniquely identifying this improvement. It
145 Machine-readable string uniquely identifying this improvement. It
146 will be mapped to an action later in the upgrade process.
146 will be mapped to an action later in the upgrade process.
147
147
148 type
148 type
149 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious
149 Either ``deficiency`` or ``optimisation``. A deficiency is an obvious
150 problem. An optimization is an action (sometimes optional) that
150 problem. An optimization is an action (sometimes optional) that
151 can be taken to further improve the state of the repository.
151 can be taken to further improve the state of the repository.
152
152
153 description
153 description
154 Message intended for humans explaining the improvement in more detail,
154 Message intended for humans explaining the improvement in more detail,
155 including the implications of it. For ``deficiency`` types, should be
155 including the implications of it. For ``deficiency`` types, should be
156 worded in the present tense. For ``optimisation`` types, should be
156 worded in the present tense. For ``optimisation`` types, should be
157 worded in the future tense.
157 worded in the future tense.
158
158
159 upgrademessage
159 upgrademessage
160 Message intended for humans explaining what an upgrade addressing this
160 Message intended for humans explaining what an upgrade addressing this
161 issue will do. Should be worded in the future tense.
161 issue will do. Should be worded in the future tense.
162 """
162 """
163 def __init__(self, name, type, description, upgrademessage):
163 def __init__(self, name, type, description, upgrademessage):
164 self.name = name
164 self.name = name
165 self.type = type
165 self.type = type
166 self.description = description
166 self.description = description
167 self.upgrademessage = upgrademessage
167 self.upgrademessage = upgrademessage
168
168
169 def __eq__(self, other):
169 def __eq__(self, other):
170 if not isinstance(other, improvement):
170 if not isinstance(other, improvement):
171 # This is what python tell use to do
171 # This is what python tell use to do
172 return NotImplemented
172 return NotImplemented
173 return self.name == other.name
173 return self.name == other.name
174
174
175 def __ne__(self, other):
175 def __ne__(self, other):
176 return not (self == other)
176 return not (self == other)
177
177
178 def __hash__(self):
178 def __hash__(self):
179 return hash(self.name)
179 return hash(self.name)
180
180
181 allformatvariant = []
181 allformatvariant = []
182
182
183 def registerformatvariant(cls):
183 def registerformatvariant(cls):
184 allformatvariant.append(cls)
184 allformatvariant.append(cls)
185 return cls
185 return cls
186
186
187 class formatvariant(improvement):
187 class formatvariant(improvement):
188 """an improvement subclass dedicated to repository format"""
188 """an improvement subclass dedicated to repository format"""
189 type = deficiency
189 type = deficiency
190 ### The following attributes should be defined for each class:
190 ### The following attributes should be defined for each class:
191
191
192 # machine-readable string uniquely identifying this improvement. it will be
192 # machine-readable string uniquely identifying this improvement. it will be
193 # mapped to an action later in the upgrade process.
193 # mapped to an action later in the upgrade process.
194 name = None
194 name = None
195
195
196 # message intended for humans explaining the improvement in more detail,
196 # message intended for humans explaining the improvement in more detail,
197 # including the implications of it ``deficiency`` types, should be worded
197 # including the implications of it ``deficiency`` types, should be worded
198 # in the present tense.
198 # in the present tense.
199 description = None
199 description = None
200
200
201 # message intended for humans explaining what an upgrade addressing this
201 # message intended for humans explaining what an upgrade addressing this
202 # issue will do. should be worded in the future tense.
202 # issue will do. should be worded in the future tense.
203 upgrademessage = None
203 upgrademessage = None
204
204
205 # value of current Mercurial default for new repository
205 # value of current Mercurial default for new repository
206 default = None
206 default = None
207
207
208 def __init__(self):
208 def __init__(self):
209 raise NotImplementedError()
209 raise NotImplementedError()
210
210
211 @staticmethod
211 @staticmethod
212 def fromrepo(repo):
212 def fromrepo(repo):
213 """current value of the variant in the repository"""
213 """current value of the variant in the repository"""
214 raise NotImplementedError()
214 raise NotImplementedError()
215
215
216 @staticmethod
216 @staticmethod
217 def fromconfig(repo):
217 def fromconfig(repo):
218 """current value of the variant in the configuration"""
218 """current value of the variant in the configuration"""
219 raise NotImplementedError()
219 raise NotImplementedError()
220
220
221 class requirementformatvariant(formatvariant):
221 class requirementformatvariant(formatvariant):
222 """formatvariant based on a 'requirement' name.
222 """formatvariant based on a 'requirement' name.
223
223
224 Many format variant are controlled by a 'requirement'. We define a small
224 Many format variant are controlled by a 'requirement'. We define a small
225 subclass to factor the code.
225 subclass to factor the code.
226 """
226 """
227
227
228 # the requirement that control this format variant
228 # the requirement that control this format variant
229 _requirement = None
229 _requirement = None
230
230
231 @staticmethod
231 @staticmethod
232 def _newreporequirements(ui):
232 def _newreporequirements(ui):
233 return localrepo.newreporequirements(
233 return localrepo.newreporequirements(
234 ui, localrepo.defaultcreateopts(ui))
234 ui, localrepo.defaultcreateopts(ui))
235
235
236 @classmethod
236 @classmethod
237 def fromrepo(cls, repo):
237 def fromrepo(cls, repo):
238 assert cls._requirement is not None
238 assert cls._requirement is not None
239 return cls._requirement in repo.requirements
239 return cls._requirement in repo.requirements
240
240
241 @classmethod
241 @classmethod
242 def fromconfig(cls, repo):
242 def fromconfig(cls, repo):
243 assert cls._requirement is not None
243 assert cls._requirement is not None
244 return cls._requirement in cls._newreporequirements(repo.ui)
244 return cls._requirement in cls._newreporequirements(repo.ui)
245
245
246 @registerformatvariant
246 @registerformatvariant
247 class fncache(requirementformatvariant):
247 class fncache(requirementformatvariant):
248 name = 'fncache'
248 name = 'fncache'
249
249
250 _requirement = 'fncache'
250 _requirement = 'fncache'
251
251
252 default = True
252 default = True
253
253
254 description = _('long and reserved filenames may not work correctly; '
254 description = _('long and reserved filenames may not work correctly; '
255 'repository performance is sub-optimal')
255 'repository performance is sub-optimal')
256
256
257 upgrademessage = _('repository will be more resilient to storing '
257 upgrademessage = _('repository will be more resilient to storing '
258 'certain paths and performance of certain '
258 'certain paths and performance of certain '
259 'operations should be improved')
259 'operations should be improved')
260
260
261 @registerformatvariant
261 @registerformatvariant
262 class dotencode(requirementformatvariant):
262 class dotencode(requirementformatvariant):
263 name = 'dotencode'
263 name = 'dotencode'
264
264
265 _requirement = 'dotencode'
265 _requirement = 'dotencode'
266
266
267 default = True
267 default = True
268
268
269 description = _('storage of filenames beginning with a period or '
269 description = _('storage of filenames beginning with a period or '
270 'space may not work correctly')
270 'space may not work correctly')
271
271
272 upgrademessage = _('repository will be better able to store files '
272 upgrademessage = _('repository will be better able to store files '
273 'beginning with a space or period')
273 'beginning with a space or period')
274
274
275 @registerformatvariant
275 @registerformatvariant
276 class generaldelta(requirementformatvariant):
276 class generaldelta(requirementformatvariant):
277 name = 'generaldelta'
277 name = 'generaldelta'
278
278
279 _requirement = 'generaldelta'
279 _requirement = 'generaldelta'
280
280
281 default = True
281 default = True
282
282
283 description = _('deltas within internal storage are unable to '
283 description = _('deltas within internal storage are unable to '
284 'choose optimal revisions; repository is larger and '
284 'choose optimal revisions; repository is larger and '
285 'slower than it could be; interaction with other '
285 'slower than it could be; interaction with other '
286 'repositories may require extra network and CPU '
286 'repositories may require extra network and CPU '
287 'resources, making "hg push" and "hg pull" slower')
287 'resources, making "hg push" and "hg pull" slower')
288
288
289 upgrademessage = _('repository storage will be able to create '
289 upgrademessage = _('repository storage will be able to create '
290 'optimal deltas; new repository data will be '
290 'optimal deltas; new repository data will be '
291 'smaller and read times should decrease; '
291 'smaller and read times should decrease; '
292 'interacting with other repositories using this '
292 'interacting with other repositories using this '
293 'storage model should require less network and '
293 'storage model should require less network and '
294 'CPU resources, making "hg push" and "hg pull" '
294 'CPU resources, making "hg push" and "hg pull" '
295 'faster')
295 'faster')
296
296
297 @registerformatvariant
297 @registerformatvariant
298 class sparserevlog(requirementformatvariant):
298 class sparserevlog(requirementformatvariant):
299 name = 'sparserevlog'
299 name = 'sparserevlog'
300
300
301 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT
301 _requirement = localrepo.SPARSEREVLOG_REQUIREMENT
302
302
303 default = True
303 default = True
304
304
305 description = _('in order to limit disk reading and memory usage on older '
305 description = _('in order to limit disk reading and memory usage on older '
306 'version, the span of a delta chain from its root to its '
306 'version, the span of a delta chain from its root to its '
307 'end is limited, whatever the relevant data in this span. '
307 'end is limited, whatever the relevant data in this span. '
308 'This can severly limit Mercurial ability to build good '
308 'This can severly limit Mercurial ability to build good '
309 'chain of delta resulting is much more storage space being '
309 'chain of delta resulting is much more storage space being '
310 'taken and limit reusability of on disk delta during '
310 'taken and limit reusability of on disk delta during '
311 'exchange.'
311 'exchange.'
312 )
312 )
313
313
314 upgrademessage = _('Revlog supports delta chain with more unused data '
314 upgrademessage = _('Revlog supports delta chain with more unused data '
315 'between payload. These gaps will be skipped at read '
315 'between payload. These gaps will be skipped at read '
316 'time. This allows for better delta chains, making a '
316 'time. This allows for better delta chains, making a '
317 'better compression and faster exchange with server.')
317 'better compression and faster exchange with server.')
318
318
319 @registerformatvariant
319 @registerformatvariant
320 class sidedata(requirementformatvariant):
321 name = 'sidedata'
322
323 _requirement = localrepo.SIDEDATA_REQUIREMENT
324
325 default = False
326
327 description = _('Allows storage of extra data alongside a revision, '
328 'unlocking various caching options.')
329
330 upgrademessage = _('Allows storage of extra data alongside a revision.')
331
332 @registerformatvariant
320 class removecldeltachain(formatvariant):
333 class removecldeltachain(formatvariant):
321 name = 'plain-cl-delta'
334 name = 'plain-cl-delta'
322
335
323 default = True
336 default = True
324
337
325 description = _('changelog storage is using deltas instead of '
338 description = _('changelog storage is using deltas instead of '
326 'raw entries; changelog reading and any '
339 'raw entries; changelog reading and any '
327 'operation relying on changelog data are slower '
340 'operation relying on changelog data are slower '
328 'than they could be')
341 'than they could be')
329
342
330 upgrademessage = _('changelog storage will be reformated to '
343 upgrademessage = _('changelog storage will be reformated to '
331 'store raw entries; changelog reading will be '
344 'store raw entries; changelog reading will be '
332 'faster; changelog size may be reduced')
345 'faster; changelog size may be reduced')
333
346
334 @staticmethod
347 @staticmethod
335 def fromrepo(repo):
348 def fromrepo(repo):
336 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
349 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
337 # changelogs with deltas.
350 # changelogs with deltas.
338 cl = repo.changelog
351 cl = repo.changelog
339 chainbase = cl.chainbase
352 chainbase = cl.chainbase
340 return all(rev == chainbase(rev) for rev in cl)
353 return all(rev == chainbase(rev) for rev in cl)
341
354
342 @staticmethod
355 @staticmethod
343 def fromconfig(repo):
356 def fromconfig(repo):
344 return True
357 return True
345
358
346 @registerformatvariant
359 @registerformatvariant
347 class compressionengine(formatvariant):
360 class compressionengine(formatvariant):
348 name = 'compression'
361 name = 'compression'
349 default = 'zlib'
362 default = 'zlib'
350
363
351 description = _('Compresion algorithm used to compress data. '
364 description = _('Compresion algorithm used to compress data. '
352 'Some engine are faster than other')
365 'Some engine are faster than other')
353
366
354 upgrademessage = _('revlog content will be recompressed with the new '
367 upgrademessage = _('revlog content will be recompressed with the new '
355 'algorithm.')
368 'algorithm.')
356
369
357 @classmethod
370 @classmethod
358 def fromrepo(cls, repo):
371 def fromrepo(cls, repo):
359 # we allow multiple compression engine requirement to co-exist because
372 # we allow multiple compression engine requirement to co-exist because
360 # strickly speaking, revlog seems to support mixed compression style.
373 # strickly speaking, revlog seems to support mixed compression style.
361 #
374 #
362 # The compression used for new entries will be "the last one"
375 # The compression used for new entries will be "the last one"
363 compression = 'zlib'
376 compression = 'zlib'
364 for req in repo.requirements:
377 for req in repo.requirements:
365 prefix = req.startswith
378 prefix = req.startswith
366 if prefix('revlog-compression-') or prefix('exp-compression-'):
379 if prefix('revlog-compression-') or prefix('exp-compression-'):
367 compression = req.split('-', 2)[2]
380 compression = req.split('-', 2)[2]
368 return compression
381 return compression
369
382
370 @classmethod
383 @classmethod
371 def fromconfig(cls, repo):
384 def fromconfig(cls, repo):
372 return repo.ui.config('format', 'revlog-compression')
385 return repo.ui.config('format', 'revlog-compression')
373
386
374 @registerformatvariant
387 @registerformatvariant
375 class compressionlevel(formatvariant):
388 class compressionlevel(formatvariant):
376 name = 'compression-level'
389 name = 'compression-level'
377 default = 'default'
390 default = 'default'
378
391
379 description = _('compression level')
392 description = _('compression level')
380
393
381 upgrademessage = _('revlog content will be recompressed')
394 upgrademessage = _('revlog content will be recompressed')
382
395
383 @classmethod
396 @classmethod
384 def fromrepo(cls, repo):
397 def fromrepo(cls, repo):
385 comp = compressionengine.fromrepo(repo)
398 comp = compressionengine.fromrepo(repo)
386 level = None
399 level = None
387 if comp == 'zlib':
400 if comp == 'zlib':
388 level = repo.ui.configint('storage', 'revlog.zlib.level')
401 level = repo.ui.configint('storage', 'revlog.zlib.level')
389 elif comp == 'zstd':
402 elif comp == 'zstd':
390 level = repo.ui.configint('storage', 'revlog.zstd.level')
403 level = repo.ui.configint('storage', 'revlog.zstd.level')
391 if level is None:
404 if level is None:
392 return 'default'
405 return 'default'
393 return bytes(level)
406 return bytes(level)
394
407
395 @classmethod
408 @classmethod
396 def fromconfig(cls, repo):
409 def fromconfig(cls, repo):
397 comp = compressionengine.fromconfig(repo)
410 comp = compressionengine.fromconfig(repo)
398 level = None
411 level = None
399 if comp == 'zlib':
412 if comp == 'zlib':
400 level = repo.ui.configint('storage', 'revlog.zlib.level')
413 level = repo.ui.configint('storage', 'revlog.zlib.level')
401 elif comp == 'zstd':
414 elif comp == 'zstd':
402 level = repo.ui.configint('storage', 'revlog.zstd.level')
415 level = repo.ui.configint('storage', 'revlog.zstd.level')
403 if level is None:
416 if level is None:
404 return 'default'
417 return 'default'
405 return bytes(level)
418 return bytes(level)
406
419
407 def finddeficiencies(repo):
420 def finddeficiencies(repo):
408 """returns a list of deficiencies that the repo suffer from"""
421 """returns a list of deficiencies that the repo suffer from"""
409 deficiencies = []
422 deficiencies = []
410
423
411 # We could detect lack of revlogv1 and store here, but they were added
424 # We could detect lack of revlogv1 and store here, but they were added
412 # in 0.9.2 and we don't support upgrading repos without these
425 # in 0.9.2 and we don't support upgrading repos without these
413 # requirements, so let's not bother.
426 # requirements, so let's not bother.
414
427
415 for fv in allformatvariant:
428 for fv in allformatvariant:
416 if not fv.fromrepo(repo):
429 if not fv.fromrepo(repo):
417 deficiencies.append(fv)
430 deficiencies.append(fv)
418
431
419 return deficiencies
432 return deficiencies
420
433
421 # search without '-' to support older form on newer client.
434 # search without '-' to support older form on newer client.
422 #
435 #
423 # We don't enforce backward compatibility for debug command so this
436 # We don't enforce backward compatibility for debug command so this
424 # might eventually be dropped. However, having to use two different
437 # might eventually be dropped. However, having to use two different
425 # forms in script when comparing result is anoying enough to add
438 # forms in script when comparing result is anoying enough to add
426 # backward compatibility for a while.
439 # backward compatibility for a while.
427 legacy_opts_map = {
440 legacy_opts_map = {
428 'redeltaparent': 're-delta-parent',
441 'redeltaparent': 're-delta-parent',
429 'redeltamultibase': 're-delta-multibase',
442 'redeltamultibase': 're-delta-multibase',
430 'redeltaall': 're-delta-all',
443 'redeltaall': 're-delta-all',
431 'redeltafulladd': 're-delta-fulladd',
444 'redeltafulladd': 're-delta-fulladd',
432 }
445 }
433
446
434 def findoptimizations(repo):
447 def findoptimizations(repo):
435 """Determine optimisation that could be used during upgrade"""
448 """Determine optimisation that could be used during upgrade"""
436 # These are unconditionally added. There is logic later that figures out
449 # These are unconditionally added. There is logic later that figures out
437 # which ones to apply.
450 # which ones to apply.
438 optimizations = []
451 optimizations = []
439
452
440 optimizations.append(improvement(
453 optimizations.append(improvement(
441 name='re-delta-parent',
454 name='re-delta-parent',
442 type=optimisation,
455 type=optimisation,
443 description=_('deltas within internal storage will be recalculated to '
456 description=_('deltas within internal storage will be recalculated to '
444 'choose an optimal base revision where this was not '
457 'choose an optimal base revision where this was not '
445 'already done; the size of the repository may shrink and '
458 'already done; the size of the repository may shrink and '
446 'various operations may become faster; the first time '
459 'various operations may become faster; the first time '
447 'this optimization is performed could slow down upgrade '
460 'this optimization is performed could slow down upgrade '
448 'execution considerably; subsequent invocations should '
461 'execution considerably; subsequent invocations should '
449 'not run noticeably slower'),
462 'not run noticeably slower'),
450 upgrademessage=_('deltas within internal storage will choose a new '
463 upgrademessage=_('deltas within internal storage will choose a new '
451 'base revision if needed')))
464 'base revision if needed')))
452
465
453 optimizations.append(improvement(
466 optimizations.append(improvement(
454 name='re-delta-multibase',
467 name='re-delta-multibase',
455 type=optimisation,
468 type=optimisation,
456 description=_('deltas within internal storage will be recalculated '
469 description=_('deltas within internal storage will be recalculated '
457 'against multiple base revision and the smallest '
470 'against multiple base revision and the smallest '
458 'difference will be used; the size of the repository may '
471 'difference will be used; the size of the repository may '
459 'shrink significantly when there are many merges; this '
472 'shrink significantly when there are many merges; this '
460 'optimization will slow down execution in proportion to '
473 'optimization will slow down execution in proportion to '
461 'the number of merges in the repository and the amount '
474 'the number of merges in the repository and the amount '
462 'of files in the repository; this slow down should not '
475 'of files in the repository; this slow down should not '
463 'be significant unless there are tens of thousands of '
476 'be significant unless there are tens of thousands of '
464 'files and thousands of merges'),
477 'files and thousands of merges'),
465 upgrademessage=_('deltas within internal storage will choose an '
478 upgrademessage=_('deltas within internal storage will choose an '
466 'optimal delta by computing deltas against multiple '
479 'optimal delta by computing deltas against multiple '
467 'parents; may slow down execution time '
480 'parents; may slow down execution time '
468 'significantly')))
481 'significantly')))
469
482
470 optimizations.append(improvement(
483 optimizations.append(improvement(
471 name='re-delta-all',
484 name='re-delta-all',
472 type=optimisation,
485 type=optimisation,
473 description=_('deltas within internal storage will always be '
486 description=_('deltas within internal storage will always be '
474 'recalculated without reusing prior deltas; this will '
487 'recalculated without reusing prior deltas; this will '
475 'likely make execution run several times slower; this '
488 'likely make execution run several times slower; this '
476 'optimization is typically not needed'),
489 'optimization is typically not needed'),
477 upgrademessage=_('deltas within internal storage will be fully '
490 upgrademessage=_('deltas within internal storage will be fully '
478 'recomputed; this will likely drastically slow down '
491 'recomputed; this will likely drastically slow down '
479 'execution time')))
492 'execution time')))
480
493
481 optimizations.append(improvement(
494 optimizations.append(improvement(
482 name='re-delta-fulladd',
495 name='re-delta-fulladd',
483 type=optimisation,
496 type=optimisation,
484 description=_('every revision will be re-added as if it was new '
497 description=_('every revision will be re-added as if it was new '
485 'content. It will go through the full storage '
498 'content. It will go through the full storage '
486 'mechanism giving extensions a chance to process it '
499 'mechanism giving extensions a chance to process it '
487 '(eg. lfs). This is similar to "re-delta-all" but even '
500 '(eg. lfs). This is similar to "re-delta-all" but even '
488 'slower since more logic is involved.'),
501 'slower since more logic is involved.'),
489 upgrademessage=_('each revision will be added as new content to the '
502 upgrademessage=_('each revision will be added as new content to the '
490 'internal storage; this will likely drastically slow '
503 'internal storage; this will likely drastically slow '
491 'down execution time, but some extensions might need '
504 'down execution time, but some extensions might need '
492 'it')))
505 'it')))
493
506
494 return optimizations
507 return optimizations
495
508
496 def determineactions(repo, deficiencies, sourcereqs, destreqs):
509 def determineactions(repo, deficiencies, sourcereqs, destreqs):
497 """Determine upgrade actions that will be performed.
510 """Determine upgrade actions that will be performed.
498
511
499 Given a list of improvements as returned by ``finddeficiencies`` and
512 Given a list of improvements as returned by ``finddeficiencies`` and
500 ``findoptimizations``, determine the list of upgrade actions that
513 ``findoptimizations``, determine the list of upgrade actions that
501 will be performed.
514 will be performed.
502
515
503 The role of this function is to filter improvements if needed, apply
516 The role of this function is to filter improvements if needed, apply
504 recommended optimizations from the improvements list that make sense,
517 recommended optimizations from the improvements list that make sense,
505 etc.
518 etc.
506
519
507 Returns a list of action names.
520 Returns a list of action names.
508 """
521 """
509 newactions = []
522 newactions = []
510
523
511 knownreqs = supporteddestrequirements(repo)
524 knownreqs = supporteddestrequirements(repo)
512
525
513 for d in deficiencies:
526 for d in deficiencies:
514 name = d.name
527 name = d.name
515
528
516 # If the action is a requirement that doesn't show up in the
529 # If the action is a requirement that doesn't show up in the
517 # destination requirements, prune the action.
530 # destination requirements, prune the action.
518 if name in knownreqs and name not in destreqs:
531 if name in knownreqs and name not in destreqs:
519 continue
532 continue
520
533
521 newactions.append(d)
534 newactions.append(d)
522
535
523 # FUTURE consider adding some optimizations here for certain transitions.
536 # FUTURE consider adding some optimizations here for certain transitions.
524 # e.g. adding generaldelta could schedule parent redeltas.
537 # e.g. adding generaldelta could schedule parent redeltas.
525
538
526 return newactions
539 return newactions
527
540
528 def _revlogfrompath(repo, path):
541 def _revlogfrompath(repo, path):
529 """Obtain a revlog from a repo path.
542 """Obtain a revlog from a repo path.
530
543
531 An instance of the appropriate class is returned.
544 An instance of the appropriate class is returned.
532 """
545 """
533 if path == '00changelog.i':
546 if path == '00changelog.i':
534 return changelog.changelog(repo.svfs)
547 return changelog.changelog(repo.svfs)
535 elif path.endswith('00manifest.i'):
548 elif path.endswith('00manifest.i'):
536 mandir = path[:-len('00manifest.i')]
549 mandir = path[:-len('00manifest.i')]
537 return manifest.manifestrevlog(repo.svfs, tree=mandir)
550 return manifest.manifestrevlog(repo.svfs, tree=mandir)
538 else:
551 else:
539 #reverse of "/".join(("data", path + ".i"))
552 #reverse of "/".join(("data", path + ".i"))
540 return filelog.filelog(repo.svfs, path[5:-2])
553 return filelog.filelog(repo.svfs, path[5:-2])
541
554
542 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
555 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
543 """copy all relevant files for `oldrl` into `destrepo` store
556 """copy all relevant files for `oldrl` into `destrepo` store
544
557
545 Files are copied "as is" without any transformation. The copy is performed
558 Files are copied "as is" without any transformation. The copy is performed
546 without extra checks. Callers are responsible for making sure the copied
559 without extra checks. Callers are responsible for making sure the copied
547 content is compatible with format of the destination repository.
560 content is compatible with format of the destination repository.
548 """
561 """
549 oldrl = getattr(oldrl, '_revlog', oldrl)
562 oldrl = getattr(oldrl, '_revlog', oldrl)
550 newrl = _revlogfrompath(destrepo, unencodedname)
563 newrl = _revlogfrompath(destrepo, unencodedname)
551 newrl = getattr(newrl, '_revlog', newrl)
564 newrl = getattr(newrl, '_revlog', newrl)
552
565
553 oldvfs = oldrl.opener
566 oldvfs = oldrl.opener
554 newvfs = newrl.opener
567 newvfs = newrl.opener
555 oldindex = oldvfs.join(oldrl.indexfile)
568 oldindex = oldvfs.join(oldrl.indexfile)
556 newindex = newvfs.join(newrl.indexfile)
569 newindex = newvfs.join(newrl.indexfile)
557 olddata = oldvfs.join(oldrl.datafile)
570 olddata = oldvfs.join(oldrl.datafile)
558 newdata = newvfs.join(newrl.datafile)
571 newdata = newvfs.join(newrl.datafile)
559
572
560 with newvfs(newrl.indexfile, 'w'):
573 with newvfs(newrl.indexfile, 'w'):
561 pass # create all the directories
574 pass # create all the directories
562
575
563 util.copyfile(oldindex, newindex)
576 util.copyfile(oldindex, newindex)
564 copydata = oldrl.opener.exists(oldrl.datafile)
577 copydata = oldrl.opener.exists(oldrl.datafile)
565 if copydata:
578 if copydata:
566 util.copyfile(olddata, newdata)
579 util.copyfile(olddata, newdata)
567
580
568 if not (unencodedname.endswith('00changelog.i')
581 if not (unencodedname.endswith('00changelog.i')
569 or unencodedname.endswith('00manifest.i')):
582 or unencodedname.endswith('00manifest.i')):
570 destrepo.svfs.fncache.add(unencodedname)
583 destrepo.svfs.fncache.add(unencodedname)
571 if copydata:
584 if copydata:
572 destrepo.svfs.fncache.add(unencodedname[:-2] + '.d')
585 destrepo.svfs.fncache.add(unencodedname[:-2] + '.d')
573
586
574 UPGRADE_CHANGELOG = object()
587 UPGRADE_CHANGELOG = object()
575 UPGRADE_MANIFEST = object()
588 UPGRADE_MANIFEST = object()
576 UPGRADE_FILELOG = object()
589 UPGRADE_FILELOG = object()
577
590
578 UPGRADE_ALL_REVLOGS = frozenset([UPGRADE_CHANGELOG,
591 UPGRADE_ALL_REVLOGS = frozenset([UPGRADE_CHANGELOG,
579 UPGRADE_MANIFEST,
592 UPGRADE_MANIFEST,
580 UPGRADE_FILELOG])
593 UPGRADE_FILELOG])
581
594
582 def matchrevlog(revlogfilter, entry):
595 def matchrevlog(revlogfilter, entry):
583 """check is a revlog is selected for cloning
596 """check is a revlog is selected for cloning
584
597
585 The store entry is checked against the passed filter"""
598 The store entry is checked against the passed filter"""
586 if entry.endswith('00changelog.i'):
599 if entry.endswith('00changelog.i'):
587 return UPGRADE_CHANGELOG in revlogfilter
600 return UPGRADE_CHANGELOG in revlogfilter
588 elif entry.endswith('00manifest.i'):
601 elif entry.endswith('00manifest.i'):
589 return UPGRADE_MANIFEST in revlogfilter
602 return UPGRADE_MANIFEST in revlogfilter
590 return UPGRADE_FILELOG in revlogfilter
603 return UPGRADE_FILELOG in revlogfilter
591
604
592 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents,
605 def _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse, forcedeltabothparents,
593 revlogs=UPGRADE_ALL_REVLOGS):
606 revlogs=UPGRADE_ALL_REVLOGS):
594 """Copy revlogs between 2 repos."""
607 """Copy revlogs between 2 repos."""
595 revcount = 0
608 revcount = 0
596 srcsize = 0
609 srcsize = 0
597 srcrawsize = 0
610 srcrawsize = 0
598 dstsize = 0
611 dstsize = 0
599 fcount = 0
612 fcount = 0
600 frevcount = 0
613 frevcount = 0
601 fsrcsize = 0
614 fsrcsize = 0
602 frawsize = 0
615 frawsize = 0
603 fdstsize = 0
616 fdstsize = 0
604 mcount = 0
617 mcount = 0
605 mrevcount = 0
618 mrevcount = 0
606 msrcsize = 0
619 msrcsize = 0
607 mrawsize = 0
620 mrawsize = 0
608 mdstsize = 0
621 mdstsize = 0
609 crevcount = 0
622 crevcount = 0
610 csrcsize = 0
623 csrcsize = 0
611 crawsize = 0
624 crawsize = 0
612 cdstsize = 0
625 cdstsize = 0
613
626
614 alldatafiles = list(srcrepo.store.walk())
627 alldatafiles = list(srcrepo.store.walk())
615
628
616 # Perform a pass to collect metadata. This validates we can open all
629 # Perform a pass to collect metadata. This validates we can open all
617 # source files and allows a unified progress bar to be displayed.
630 # source files and allows a unified progress bar to be displayed.
618 for unencoded, encoded, size in alldatafiles:
631 for unencoded, encoded, size in alldatafiles:
619 if unencoded.endswith('.d'):
632 if unencoded.endswith('.d'):
620 continue
633 continue
621
634
622 rl = _revlogfrompath(srcrepo, unencoded)
635 rl = _revlogfrompath(srcrepo, unencoded)
623
636
624 info = rl.storageinfo(exclusivefiles=True, revisionscount=True,
637 info = rl.storageinfo(exclusivefiles=True, revisionscount=True,
625 trackedsize=True, storedsize=True)
638 trackedsize=True, storedsize=True)
626
639
627 revcount += info['revisionscount'] or 0
640 revcount += info['revisionscount'] or 0
628 datasize = info['storedsize'] or 0
641 datasize = info['storedsize'] or 0
629 rawsize = info['trackedsize'] or 0
642 rawsize = info['trackedsize'] or 0
630
643
631 srcsize += datasize
644 srcsize += datasize
632 srcrawsize += rawsize
645 srcrawsize += rawsize
633
646
634 # This is for the separate progress bars.
647 # This is for the separate progress bars.
635 if isinstance(rl, changelog.changelog):
648 if isinstance(rl, changelog.changelog):
636 crevcount += len(rl)
649 crevcount += len(rl)
637 csrcsize += datasize
650 csrcsize += datasize
638 crawsize += rawsize
651 crawsize += rawsize
639 elif isinstance(rl, manifest.manifestrevlog):
652 elif isinstance(rl, manifest.manifestrevlog):
640 mcount += 1
653 mcount += 1
641 mrevcount += len(rl)
654 mrevcount += len(rl)
642 msrcsize += datasize
655 msrcsize += datasize
643 mrawsize += rawsize
656 mrawsize += rawsize
644 elif isinstance(rl, filelog.filelog):
657 elif isinstance(rl, filelog.filelog):
645 fcount += 1
658 fcount += 1
646 frevcount += len(rl)
659 frevcount += len(rl)
647 fsrcsize += datasize
660 fsrcsize += datasize
648 frawsize += rawsize
661 frawsize += rawsize
649 else:
662 else:
650 error.ProgrammingError('unknown revlog type')
663 error.ProgrammingError('unknown revlog type')
651
664
652 if not revcount:
665 if not revcount:
653 return
666 return
654
667
655 ui.write(_('migrating %d total revisions (%d in filelogs, %d in manifests, '
668 ui.write(_('migrating %d total revisions (%d in filelogs, %d in manifests, '
656 '%d in changelog)\n') %
669 '%d in changelog)\n') %
657 (revcount, frevcount, mrevcount, crevcount))
670 (revcount, frevcount, mrevcount, crevcount))
658 ui.write(_('migrating %s in store; %s tracked data\n') % (
671 ui.write(_('migrating %s in store; %s tracked data\n') % (
659 (util.bytecount(srcsize), util.bytecount(srcrawsize))))
672 (util.bytecount(srcsize), util.bytecount(srcrawsize))))
660
673
661 # Used to keep track of progress.
674 # Used to keep track of progress.
662 progress = None
675 progress = None
663 def oncopiedrevision(rl, rev, node):
676 def oncopiedrevision(rl, rev, node):
664 progress.increment()
677 progress.increment()
665
678
666 # Do the actual copying.
679 # Do the actual copying.
667 # FUTURE this operation can be farmed off to worker processes.
680 # FUTURE this operation can be farmed off to worker processes.
668 seen = set()
681 seen = set()
669 for unencoded, encoded, size in alldatafiles:
682 for unencoded, encoded, size in alldatafiles:
670 if unencoded.endswith('.d'):
683 if unencoded.endswith('.d'):
671 continue
684 continue
672
685
673 oldrl = _revlogfrompath(srcrepo, unencoded)
686 oldrl = _revlogfrompath(srcrepo, unencoded)
674
687
675 if isinstance(oldrl, changelog.changelog) and 'c' not in seen:
688 if isinstance(oldrl, changelog.changelog) and 'c' not in seen:
676 ui.write(_('finished migrating %d manifest revisions across %d '
689 ui.write(_('finished migrating %d manifest revisions across %d '
677 'manifests; change in size: %s\n') %
690 'manifests; change in size: %s\n') %
678 (mrevcount, mcount, util.bytecount(mdstsize - msrcsize)))
691 (mrevcount, mcount, util.bytecount(mdstsize - msrcsize)))
679
692
680 ui.write(_('migrating changelog containing %d revisions '
693 ui.write(_('migrating changelog containing %d revisions '
681 '(%s in store; %s tracked data)\n') %
694 '(%s in store; %s tracked data)\n') %
682 (crevcount, util.bytecount(csrcsize),
695 (crevcount, util.bytecount(csrcsize),
683 util.bytecount(crawsize)))
696 util.bytecount(crawsize)))
684 seen.add('c')
697 seen.add('c')
685 progress = srcrepo.ui.makeprogress(_('changelog revisions'),
698 progress = srcrepo.ui.makeprogress(_('changelog revisions'),
686 total=crevcount)
699 total=crevcount)
687 elif isinstance(oldrl, manifest.manifestrevlog) and 'm' not in seen:
700 elif isinstance(oldrl, manifest.manifestrevlog) and 'm' not in seen:
688 ui.write(_('finished migrating %d filelog revisions across %d '
701 ui.write(_('finished migrating %d filelog revisions across %d '
689 'filelogs; change in size: %s\n') %
702 'filelogs; change in size: %s\n') %
690 (frevcount, fcount, util.bytecount(fdstsize - fsrcsize)))
703 (frevcount, fcount, util.bytecount(fdstsize - fsrcsize)))
691
704
692 ui.write(_('migrating %d manifests containing %d revisions '
705 ui.write(_('migrating %d manifests containing %d revisions '
693 '(%s in store; %s tracked data)\n') %
706 '(%s in store; %s tracked data)\n') %
694 (mcount, mrevcount, util.bytecount(msrcsize),
707 (mcount, mrevcount, util.bytecount(msrcsize),
695 util.bytecount(mrawsize)))
708 util.bytecount(mrawsize)))
696 seen.add('m')
709 seen.add('m')
697 if progress:
710 if progress:
698 progress.complete()
711 progress.complete()
699 progress = srcrepo.ui.makeprogress(_('manifest revisions'),
712 progress = srcrepo.ui.makeprogress(_('manifest revisions'),
700 total=mrevcount)
713 total=mrevcount)
701 elif 'f' not in seen:
714 elif 'f' not in seen:
702 ui.write(_('migrating %d filelogs containing %d revisions '
715 ui.write(_('migrating %d filelogs containing %d revisions '
703 '(%s in store; %s tracked data)\n') %
716 '(%s in store; %s tracked data)\n') %
704 (fcount, frevcount, util.bytecount(fsrcsize),
717 (fcount, frevcount, util.bytecount(fsrcsize),
705 util.bytecount(frawsize)))
718 util.bytecount(frawsize)))
706 seen.add('f')
719 seen.add('f')
707 if progress:
720 if progress:
708 progress.complete()
721 progress.complete()
709 progress = srcrepo.ui.makeprogress(_('file revisions'),
722 progress = srcrepo.ui.makeprogress(_('file revisions'),
710 total=frevcount)
723 total=frevcount)
711
724
712 if matchrevlog(revlogs, unencoded):
725 if matchrevlog(revlogs, unencoded):
713 ui.note(_('cloning %d revisions from %s\n')
726 ui.note(_('cloning %d revisions from %s\n')
714 % (len(oldrl), unencoded))
727 % (len(oldrl), unencoded))
715 newrl = _revlogfrompath(dstrepo, unencoded)
728 newrl = _revlogfrompath(dstrepo, unencoded)
716 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision,
729 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision,
717 deltareuse=deltareuse,
730 deltareuse=deltareuse,
718 forcedeltabothparents=forcedeltabothparents)
731 forcedeltabothparents=forcedeltabothparents)
719 else:
732 else:
720 msg = _('blindly copying %s containing %i revisions\n')
733 msg = _('blindly copying %s containing %i revisions\n')
721 ui.note(msg % (unencoded, len(oldrl)))
734 ui.note(msg % (unencoded, len(oldrl)))
722 _copyrevlog(tr, dstrepo, oldrl, unencoded)
735 _copyrevlog(tr, dstrepo, oldrl, unencoded)
723
736
724 newrl = _revlogfrompath(dstrepo, unencoded)
737 newrl = _revlogfrompath(dstrepo, unencoded)
725
738
726 info = newrl.storageinfo(storedsize=True)
739 info = newrl.storageinfo(storedsize=True)
727 datasize = info['storedsize'] or 0
740 datasize = info['storedsize'] or 0
728
741
729 dstsize += datasize
742 dstsize += datasize
730
743
731 if isinstance(newrl, changelog.changelog):
744 if isinstance(newrl, changelog.changelog):
732 cdstsize += datasize
745 cdstsize += datasize
733 elif isinstance(newrl, manifest.manifestrevlog):
746 elif isinstance(newrl, manifest.manifestrevlog):
734 mdstsize += datasize
747 mdstsize += datasize
735 else:
748 else:
736 fdstsize += datasize
749 fdstsize += datasize
737
750
738 progress.complete()
751 progress.complete()
739
752
740 ui.write(_('finished migrating %d changelog revisions; change in size: '
753 ui.write(_('finished migrating %d changelog revisions; change in size: '
741 '%s\n') % (crevcount, util.bytecount(cdstsize - csrcsize)))
754 '%s\n') % (crevcount, util.bytecount(cdstsize - csrcsize)))
742
755
743 ui.write(_('finished migrating %d total revisions; total change in store '
756 ui.write(_('finished migrating %d total revisions; total change in store '
744 'size: %s\n') % (revcount, util.bytecount(dstsize - srcsize)))
757 'size: %s\n') % (revcount, util.bytecount(dstsize - srcsize)))
745
758
746 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
759 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
747 """Determine whether to copy a store file during upgrade.
760 """Determine whether to copy a store file during upgrade.
748
761
749 This function is called when migrating store files from ``srcrepo`` to
762 This function is called when migrating store files from ``srcrepo`` to
750 ``dstrepo`` as part of upgrading a repository.
763 ``dstrepo`` as part of upgrading a repository.
751
764
752 Args:
765 Args:
753 srcrepo: repo we are copying from
766 srcrepo: repo we are copying from
754 dstrepo: repo we are copying to
767 dstrepo: repo we are copying to
755 requirements: set of requirements for ``dstrepo``
768 requirements: set of requirements for ``dstrepo``
756 path: store file being examined
769 path: store file being examined
757 mode: the ``ST_MODE`` file type of ``path``
770 mode: the ``ST_MODE`` file type of ``path``
758 st: ``stat`` data structure for ``path``
771 st: ``stat`` data structure for ``path``
759
772
760 Function should return ``True`` if the file is to be copied.
773 Function should return ``True`` if the file is to be copied.
761 """
774 """
762 # Skip revlogs.
775 # Skip revlogs.
763 if path.endswith(('.i', '.d')):
776 if path.endswith(('.i', '.d')):
764 return False
777 return False
765 # Skip transaction related files.
778 # Skip transaction related files.
766 if path.startswith('undo'):
779 if path.startswith('undo'):
767 return False
780 return False
768 # Only copy regular files.
781 # Only copy regular files.
769 if mode != stat.S_IFREG:
782 if mode != stat.S_IFREG:
770 return False
783 return False
771 # Skip other skipped files.
784 # Skip other skipped files.
772 if path in ('lock', 'fncache'):
785 if path in ('lock', 'fncache'):
773 return False
786 return False
774
787
775 return True
788 return True
776
789
777 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
790 def _finishdatamigration(ui, srcrepo, dstrepo, requirements):
778 """Hook point for extensions to perform additional actions during upgrade.
791 """Hook point for extensions to perform additional actions during upgrade.
779
792
780 This function is called after revlogs and store files have been copied but
793 This function is called after revlogs and store files have been copied but
781 before the new store is swapped into the original location.
794 before the new store is swapped into the original location.
782 """
795 """
783
796
784 def _upgraderepo(ui, srcrepo, dstrepo, requirements, actions,
797 def _upgraderepo(ui, srcrepo, dstrepo, requirements, actions,
785 revlogs=UPGRADE_ALL_REVLOGS):
798 revlogs=UPGRADE_ALL_REVLOGS):
786 """Do the low-level work of upgrading a repository.
799 """Do the low-level work of upgrading a repository.
787
800
788 The upgrade is effectively performed as a copy between a source
801 The upgrade is effectively performed as a copy between a source
789 repository and a temporary destination repository.
802 repository and a temporary destination repository.
790
803
791 The source repository is unmodified for as long as possible so the
804 The source repository is unmodified for as long as possible so the
792 upgrade can abort at any time without causing loss of service for
805 upgrade can abort at any time without causing loss of service for
793 readers and without corrupting the source repository.
806 readers and without corrupting the source repository.
794 """
807 """
795 assert srcrepo.currentwlock()
808 assert srcrepo.currentwlock()
796 assert dstrepo.currentwlock()
809 assert dstrepo.currentwlock()
797
810
798 ui.write(_('(it is safe to interrupt this process any time before '
811 ui.write(_('(it is safe to interrupt this process any time before '
799 'data migration completes)\n'))
812 'data migration completes)\n'))
800
813
801 if 're-delta-all' in actions:
814 if 're-delta-all' in actions:
802 deltareuse = revlog.revlog.DELTAREUSENEVER
815 deltareuse = revlog.revlog.DELTAREUSENEVER
803 elif 're-delta-parent' in actions:
816 elif 're-delta-parent' in actions:
804 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
817 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
805 elif 're-delta-multibase' in actions:
818 elif 're-delta-multibase' in actions:
806 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
819 deltareuse = revlog.revlog.DELTAREUSESAMEREVS
807 elif 're-delta-fulladd' in actions:
820 elif 're-delta-fulladd' in actions:
808 deltareuse = revlog.revlog.DELTAREUSEFULLADD
821 deltareuse = revlog.revlog.DELTAREUSEFULLADD
809 else:
822 else:
810 deltareuse = revlog.revlog.DELTAREUSEALWAYS
823 deltareuse = revlog.revlog.DELTAREUSEALWAYS
811
824
812 with dstrepo.transaction('upgrade') as tr:
825 with dstrepo.transaction('upgrade') as tr:
813 _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse,
826 _clonerevlogs(ui, srcrepo, dstrepo, tr, deltareuse,
814 're-delta-multibase' in actions, revlogs=revlogs)
827 're-delta-multibase' in actions, revlogs=revlogs)
815
828
816 # Now copy other files in the store directory.
829 # Now copy other files in the store directory.
817 # The sorted() makes execution deterministic.
830 # The sorted() makes execution deterministic.
818 for p, kind, st in sorted(srcrepo.store.vfs.readdir('', stat=True)):
831 for p, kind, st in sorted(srcrepo.store.vfs.readdir('', stat=True)):
819 if not _filterstorefile(srcrepo, dstrepo, requirements,
832 if not _filterstorefile(srcrepo, dstrepo, requirements,
820 p, kind, st):
833 p, kind, st):
821 continue
834 continue
822
835
823 srcrepo.ui.write(_('copying %s\n') % p)
836 srcrepo.ui.write(_('copying %s\n') % p)
824 src = srcrepo.store.rawvfs.join(p)
837 src = srcrepo.store.rawvfs.join(p)
825 dst = dstrepo.store.rawvfs.join(p)
838 dst = dstrepo.store.rawvfs.join(p)
826 util.copyfile(src, dst, copystat=True)
839 util.copyfile(src, dst, copystat=True)
827
840
828 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
841 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
829
842
830 ui.write(_('data fully migrated to temporary repository\n'))
843 ui.write(_('data fully migrated to temporary repository\n'))
831
844
832 backuppath = pycompat.mkdtemp(prefix='upgradebackup.', dir=srcrepo.path)
845 backuppath = pycompat.mkdtemp(prefix='upgradebackup.', dir=srcrepo.path)
833 backupvfs = vfsmod.vfs(backuppath)
846 backupvfs = vfsmod.vfs(backuppath)
834
847
835 # Make a backup of requires file first, as it is the first to be modified.
848 # Make a backup of requires file first, as it is the first to be modified.
836 util.copyfile(srcrepo.vfs.join('requires'), backupvfs.join('requires'))
849 util.copyfile(srcrepo.vfs.join('requires'), backupvfs.join('requires'))
837
850
838 # We install an arbitrary requirement that clients must not support
851 # We install an arbitrary requirement that clients must not support
839 # as a mechanism to lock out new clients during the data swap. This is
852 # as a mechanism to lock out new clients during the data swap. This is
840 # better than allowing a client to continue while the repository is in
853 # better than allowing a client to continue while the repository is in
841 # an inconsistent state.
854 # an inconsistent state.
842 ui.write(_('marking source repository as being upgraded; clients will be '
855 ui.write(_('marking source repository as being upgraded; clients will be '
843 'unable to read from repository\n'))
856 'unable to read from repository\n'))
844 scmutil.writerequires(srcrepo.vfs,
857 scmutil.writerequires(srcrepo.vfs,
845 srcrepo.requirements | {'upgradeinprogress'})
858 srcrepo.requirements | {'upgradeinprogress'})
846
859
847 ui.write(_('starting in-place swap of repository data\n'))
860 ui.write(_('starting in-place swap of repository data\n'))
848 ui.write(_('replaced files will be backed up at %s\n') %
861 ui.write(_('replaced files will be backed up at %s\n') %
849 backuppath)
862 backuppath)
850
863
851 # Now swap in the new store directory. Doing it as a rename should make
864 # Now swap in the new store directory. Doing it as a rename should make
852 # the operation nearly instantaneous and atomic (at least in well-behaved
865 # the operation nearly instantaneous and atomic (at least in well-behaved
853 # environments).
866 # environments).
854 ui.write(_('replacing store...\n'))
867 ui.write(_('replacing store...\n'))
855 tstart = util.timer()
868 tstart = util.timer()
856 util.rename(srcrepo.spath, backupvfs.join('store'))
869 util.rename(srcrepo.spath, backupvfs.join('store'))
857 util.rename(dstrepo.spath, srcrepo.spath)
870 util.rename(dstrepo.spath, srcrepo.spath)
858 elapsed = util.timer() - tstart
871 elapsed = util.timer() - tstart
859 ui.write(_('store replacement complete; repository was inconsistent for '
872 ui.write(_('store replacement complete; repository was inconsistent for '
860 '%0.1fs\n') % elapsed)
873 '%0.1fs\n') % elapsed)
861
874
862 # We first write the requirements file. Any new requirements will lock
875 # We first write the requirements file. Any new requirements will lock
863 # out legacy clients.
876 # out legacy clients.
864 ui.write(_('finalizing requirements file and making repository readable '
877 ui.write(_('finalizing requirements file and making repository readable '
865 'again\n'))
878 'again\n'))
866 scmutil.writerequires(srcrepo.vfs, requirements)
879 scmutil.writerequires(srcrepo.vfs, requirements)
867
880
868 # The lock file from the old store won't be removed because nothing has a
881 # The lock file from the old store won't be removed because nothing has a
869 # reference to its new location. So clean it up manually. Alternatively, we
882 # reference to its new location. So clean it up manually. Alternatively, we
870 # could update srcrepo.svfs and other variables to point to the new
883 # could update srcrepo.svfs and other variables to point to the new
871 # location. This is simpler.
884 # location. This is simpler.
872 backupvfs.unlink('store/lock')
885 backupvfs.unlink('store/lock')
873
886
874 return backuppath
887 return backuppath
875
888
876 def upgraderepo(ui, repo, run=False, optimize=None, backup=True,
889 def upgraderepo(ui, repo, run=False, optimize=None, backup=True,
877 manifest=None, changelog=None):
890 manifest=None, changelog=None):
878 """Upgrade a repository in place."""
891 """Upgrade a repository in place."""
879 if optimize is None:
892 if optimize is None:
880 optimize = []
893 optimize = []
881 optimize = set(legacy_opts_map.get(o, o) for o in optimize)
894 optimize = set(legacy_opts_map.get(o, o) for o in optimize)
882 repo = repo.unfiltered()
895 repo = repo.unfiltered()
883
896
884 revlogs = set(UPGRADE_ALL_REVLOGS)
897 revlogs = set(UPGRADE_ALL_REVLOGS)
885 specentries = (('c', changelog), ('m', manifest))
898 specentries = (('c', changelog), ('m', manifest))
886 specified = [(y, x) for (y, x) in specentries if x is not None]
899 specified = [(y, x) for (y, x) in specentries if x is not None]
887 if specified:
900 if specified:
888 # we have some limitation on revlogs to be recloned
901 # we have some limitation on revlogs to be recloned
889 if any(x for y, x in specified):
902 if any(x for y, x in specified):
890 revlogs = set()
903 revlogs = set()
891 for r, enabled in specified:
904 for r, enabled in specified:
892 if enabled:
905 if enabled:
893 if r == 'c':
906 if r == 'c':
894 revlogs.add(UPGRADE_CHANGELOG)
907 revlogs.add(UPGRADE_CHANGELOG)
895 elif r == 'm':
908 elif r == 'm':
896 revlogs.add(UPGRADE_MANIFEST)
909 revlogs.add(UPGRADE_MANIFEST)
897 else:
910 else:
898 # none are enabled
911 # none are enabled
899 for r, __ in specified:
912 for r, __ in specified:
900 if r == 'c':
913 if r == 'c':
901 revlogs.discard(UPGRADE_CHANGELOG)
914 revlogs.discard(UPGRADE_CHANGELOG)
902 elif r == 'm':
915 elif r == 'm':
903 revlogs.discard(UPGRADE_MANIFEST)
916 revlogs.discard(UPGRADE_MANIFEST)
904
917
905 # Ensure the repository can be upgraded.
918 # Ensure the repository can be upgraded.
906 missingreqs = requiredsourcerequirements(repo) - repo.requirements
919 missingreqs = requiredsourcerequirements(repo) - repo.requirements
907 if missingreqs:
920 if missingreqs:
908 raise error.Abort(_('cannot upgrade repository; requirement '
921 raise error.Abort(_('cannot upgrade repository; requirement '
909 'missing: %s') % _(', ').join(sorted(missingreqs)))
922 'missing: %s') % _(', ').join(sorted(missingreqs)))
910
923
911 blockedreqs = blocksourcerequirements(repo) & repo.requirements
924 blockedreqs = blocksourcerequirements(repo) & repo.requirements
912 if blockedreqs:
925 if blockedreqs:
913 raise error.Abort(_('cannot upgrade repository; unsupported source '
926 raise error.Abort(_('cannot upgrade repository; unsupported source '
914 'requirement: %s') %
927 'requirement: %s') %
915 _(', ').join(sorted(blockedreqs)))
928 _(', ').join(sorted(blockedreqs)))
916
929
917 # FUTURE there is potentially a need to control the wanted requirements via
930 # FUTURE there is potentially a need to control the wanted requirements via
918 # command arguments or via an extension hook point.
931 # command arguments or via an extension hook point.
919 newreqs = localrepo.newreporequirements(
932 newreqs = localrepo.newreporequirements(
920 repo.ui, localrepo.defaultcreateopts(repo.ui))
933 repo.ui, localrepo.defaultcreateopts(repo.ui))
921 newreqs.update(preservedrequirements(repo))
934 newreqs.update(preservedrequirements(repo))
922
935
923 noremovereqs = (repo.requirements - newreqs -
936 noremovereqs = (repo.requirements - newreqs -
924 supportremovedrequirements(repo))
937 supportremovedrequirements(repo))
925 if noremovereqs:
938 if noremovereqs:
926 raise error.Abort(_('cannot upgrade repository; requirement would be '
939 raise error.Abort(_('cannot upgrade repository; requirement would be '
927 'removed: %s') % _(', ').join(sorted(noremovereqs)))
940 'removed: %s') % _(', ').join(sorted(noremovereqs)))
928
941
929 noaddreqs = (newreqs - repo.requirements -
942 noaddreqs = (newreqs - repo.requirements -
930 allowednewrequirements(repo))
943 allowednewrequirements(repo))
931 if noaddreqs:
944 if noaddreqs:
932 raise error.Abort(_('cannot upgrade repository; do not support adding '
945 raise error.Abort(_('cannot upgrade repository; do not support adding '
933 'requirement: %s') %
946 'requirement: %s') %
934 _(', ').join(sorted(noaddreqs)))
947 _(', ').join(sorted(noaddreqs)))
935
948
936 unsupportedreqs = newreqs - supporteddestrequirements(repo)
949 unsupportedreqs = newreqs - supporteddestrequirements(repo)
937 if unsupportedreqs:
950 if unsupportedreqs:
938 raise error.Abort(_('cannot upgrade repository; do not support '
951 raise error.Abort(_('cannot upgrade repository; do not support '
939 'destination requirement: %s') %
952 'destination requirement: %s') %
940 _(', ').join(sorted(unsupportedreqs)))
953 _(', ').join(sorted(unsupportedreqs)))
941
954
942 # Find and validate all improvements that can be made.
955 # Find and validate all improvements that can be made.
943 alloptimizations = findoptimizations(repo)
956 alloptimizations = findoptimizations(repo)
944
957
945 # Apply and Validate arguments.
958 # Apply and Validate arguments.
946 optimizations = []
959 optimizations = []
947 for o in alloptimizations:
960 for o in alloptimizations:
948 if o.name in optimize:
961 if o.name in optimize:
949 optimizations.append(o)
962 optimizations.append(o)
950 optimize.discard(o.name)
963 optimize.discard(o.name)
951
964
952 if optimize: # anything left is unknown
965 if optimize: # anything left is unknown
953 raise error.Abort(_('unknown optimization action requested: %s') %
966 raise error.Abort(_('unknown optimization action requested: %s') %
954 ', '.join(sorted(optimize)),
967 ', '.join(sorted(optimize)),
955 hint=_('run without arguments to see valid '
968 hint=_('run without arguments to see valid '
956 'optimizations'))
969 'optimizations'))
957
970
958 deficiencies = finddeficiencies(repo)
971 deficiencies = finddeficiencies(repo)
959 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
972 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
960 actions.extend(o for o in sorted(optimizations)
973 actions.extend(o for o in sorted(optimizations)
961 # determineactions could have added optimisation
974 # determineactions could have added optimisation
962 if o not in actions)
975 if o not in actions)
963
976
964 removedreqs = repo.requirements - newreqs
977 removedreqs = repo.requirements - newreqs
965 addedreqs = newreqs - repo.requirements
978 addedreqs = newreqs - repo.requirements
966
979
967 if revlogs != UPGRADE_ALL_REVLOGS:
980 if revlogs != UPGRADE_ALL_REVLOGS:
968 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
981 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
969 if incompatible:
982 if incompatible:
970 msg = _('ignoring revlogs selection flags, format requirements '
983 msg = _('ignoring revlogs selection flags, format requirements '
971 'change: %s\n')
984 'change: %s\n')
972 ui.warn(msg % ', '.join(sorted(incompatible)))
985 ui.warn(msg % ', '.join(sorted(incompatible)))
973 revlogs = UPGRADE_ALL_REVLOGS
986 revlogs = UPGRADE_ALL_REVLOGS
974
987
975 def printrequirements():
988 def printrequirements():
976 ui.write(_('requirements\n'))
989 ui.write(_('requirements\n'))
977 ui.write(_(' preserved: %s\n') %
990 ui.write(_(' preserved: %s\n') %
978 _(', ').join(sorted(newreqs & repo.requirements)))
991 _(', ').join(sorted(newreqs & repo.requirements)))
979
992
980 if repo.requirements - newreqs:
993 if repo.requirements - newreqs:
981 ui.write(_(' removed: %s\n') %
994 ui.write(_(' removed: %s\n') %
982 _(', ').join(sorted(repo.requirements - newreqs)))
995 _(', ').join(sorted(repo.requirements - newreqs)))
983
996
984 if newreqs - repo.requirements:
997 if newreqs - repo.requirements:
985 ui.write(_(' added: %s\n') %
998 ui.write(_(' added: %s\n') %
986 _(', ').join(sorted(newreqs - repo.requirements)))
999 _(', ').join(sorted(newreqs - repo.requirements)))
987
1000
988 ui.write('\n')
1001 ui.write('\n')
989
1002
990 def printupgradeactions():
1003 def printupgradeactions():
991 for a in actions:
1004 for a in actions:
992 ui.write('%s\n %s\n\n' % (a.name, a.upgrademessage))
1005 ui.write('%s\n %s\n\n' % (a.name, a.upgrademessage))
993
1006
994 if not run:
1007 if not run:
995 fromconfig = []
1008 fromconfig = []
996 onlydefault = []
1009 onlydefault = []
997
1010
998 for d in deficiencies:
1011 for d in deficiencies:
999 if d.fromconfig(repo):
1012 if d.fromconfig(repo):
1000 fromconfig.append(d)
1013 fromconfig.append(d)
1001 elif d.default:
1014 elif d.default:
1002 onlydefault.append(d)
1015 onlydefault.append(d)
1003
1016
1004 if fromconfig or onlydefault:
1017 if fromconfig or onlydefault:
1005
1018
1006 if fromconfig:
1019 if fromconfig:
1007 ui.write(_('repository lacks features recommended by '
1020 ui.write(_('repository lacks features recommended by '
1008 'current config options:\n\n'))
1021 'current config options:\n\n'))
1009 for i in fromconfig:
1022 for i in fromconfig:
1010 ui.write('%s\n %s\n\n' % (i.name, i.description))
1023 ui.write('%s\n %s\n\n' % (i.name, i.description))
1011
1024
1012 if onlydefault:
1025 if onlydefault:
1013 ui.write(_('repository lacks features used by the default '
1026 ui.write(_('repository lacks features used by the default '
1014 'config options:\n\n'))
1027 'config options:\n\n'))
1015 for i in onlydefault:
1028 for i in onlydefault:
1016 ui.write('%s\n %s\n\n' % (i.name, i.description))
1029 ui.write('%s\n %s\n\n' % (i.name, i.description))
1017
1030
1018 ui.write('\n')
1031 ui.write('\n')
1019 else:
1032 else:
1020 ui.write(_('(no feature deficiencies found in existing '
1033 ui.write(_('(no feature deficiencies found in existing '
1021 'repository)\n'))
1034 'repository)\n'))
1022
1035
1023 ui.write(_('performing an upgrade with "--run" will make the following '
1036 ui.write(_('performing an upgrade with "--run" will make the following '
1024 'changes:\n\n'))
1037 'changes:\n\n'))
1025
1038
1026 printrequirements()
1039 printrequirements()
1027 printupgradeactions()
1040 printupgradeactions()
1028
1041
1029 unusedoptimize = [i for i in alloptimizations if i not in actions]
1042 unusedoptimize = [i for i in alloptimizations if i not in actions]
1030
1043
1031 if unusedoptimize:
1044 if unusedoptimize:
1032 ui.write(_('additional optimizations are available by specifying '
1045 ui.write(_('additional optimizations are available by specifying '
1033 '"--optimize <name>":\n\n'))
1046 '"--optimize <name>":\n\n'))
1034 for i in unusedoptimize:
1047 for i in unusedoptimize:
1035 ui.write(_('%s\n %s\n\n') % (i.name, i.description))
1048 ui.write(_('%s\n %s\n\n') % (i.name, i.description))
1036 return
1049 return
1037
1050
1038 # Else we're in the run=true case.
1051 # Else we're in the run=true case.
1039 ui.write(_('upgrade will perform the following actions:\n\n'))
1052 ui.write(_('upgrade will perform the following actions:\n\n'))
1040 printrequirements()
1053 printrequirements()
1041 printupgradeactions()
1054 printupgradeactions()
1042
1055
1043 upgradeactions = [a.name for a in actions]
1056 upgradeactions = [a.name for a in actions]
1044
1057
1045 ui.write(_('beginning upgrade...\n'))
1058 ui.write(_('beginning upgrade...\n'))
1046 with repo.wlock(), repo.lock():
1059 with repo.wlock(), repo.lock():
1047 ui.write(_('repository locked and read-only\n'))
1060 ui.write(_('repository locked and read-only\n'))
1048 # Our strategy for upgrading the repository is to create a new,
1061 # Our strategy for upgrading the repository is to create a new,
1049 # temporary repository, write data to it, then do a swap of the
1062 # temporary repository, write data to it, then do a swap of the
1050 # data. There are less heavyweight ways to do this, but it is easier
1063 # data. There are less heavyweight ways to do this, but it is easier
1051 # to create a new repo object than to instantiate all the components
1064 # to create a new repo object than to instantiate all the components
1052 # (like the store) separately.
1065 # (like the store) separately.
1053 tmppath = pycompat.mkdtemp(prefix='upgrade.', dir=repo.path)
1066 tmppath = pycompat.mkdtemp(prefix='upgrade.', dir=repo.path)
1054 backuppath = None
1067 backuppath = None
1055 try:
1068 try:
1056 ui.write(_('creating temporary repository to stage migrated '
1069 ui.write(_('creating temporary repository to stage migrated '
1057 'data: %s\n') % tmppath)
1070 'data: %s\n') % tmppath)
1058
1071
1059 # clone ui without using ui.copy because repo.ui is protected
1072 # clone ui without using ui.copy because repo.ui is protected
1060 repoui = repo.ui.__class__(repo.ui)
1073 repoui = repo.ui.__class__(repo.ui)
1061 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1074 dstrepo = hg.repository(repoui, path=tmppath, create=True)
1062
1075
1063 with dstrepo.wlock(), dstrepo.lock():
1076 with dstrepo.wlock(), dstrepo.lock():
1064 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
1077 backuppath = _upgraderepo(ui, repo, dstrepo, newreqs,
1065 upgradeactions, revlogs=revlogs)
1078 upgradeactions, revlogs=revlogs)
1066 if not (backup or backuppath is None):
1079 if not (backup or backuppath is None):
1067 ui.write(_('removing old repository content%s\n') % backuppath)
1080 ui.write(_('removing old repository content%s\n') % backuppath)
1068 repo.vfs.rmtree(backuppath, forcibly=True)
1081 repo.vfs.rmtree(backuppath, forcibly=True)
1069 backuppath = None
1082 backuppath = None
1070
1083
1071 finally:
1084 finally:
1072 ui.write(_('removing temporary repository %s\n') % tmppath)
1085 ui.write(_('removing temporary repository %s\n') % tmppath)
1073 repo.vfs.rmtree(tmppath, forcibly=True)
1086 repo.vfs.rmtree(tmppath, forcibly=True)
1074
1087
1075 if backuppath:
1088 if backuppath:
1076 ui.warn(_('copy of old repository backed up at %s\n') %
1089 ui.warn(_('copy of old repository backed up at %s\n') %
1077 backuppath)
1090 backuppath)
1078 ui.warn(_('the old repository will not be deleted; remove '
1091 ui.warn(_('the old repository will not be deleted; remove '
1079 'it to free up disk space once the upgraded '
1092 'it to free up disk space once the upgraded '
1080 'repository is verified\n'))
1093 'repository is verified\n'))
@@ -1,714 +1,717 b''
1 #testcases lfsremote-on lfsremote-off
1 #testcases lfsremote-on lfsremote-off
2 #require serve no-reposimplestore no-chg
2 #require serve no-reposimplestore no-chg
3
3
4 This test splits `hg serve` with and without using the extension into separate
4 This test splits `hg serve` with and without using the extension into separate
5 tests cases. The tests are broken down as follows, where "LFS"/"No-LFS"
5 tests cases. The tests are broken down as follows, where "LFS"/"No-LFS"
6 indicates whether or not there are commits that use an LFS file, and "D"/"E"
6 indicates whether or not there are commits that use an LFS file, and "D"/"E"
7 indicates whether or not the extension is loaded. The "X" cases are not tested
7 indicates whether or not the extension is loaded. The "X" cases are not tested
8 individually, because the lfs requirement causes the process to bail early if
8 individually, because the lfs requirement causes the process to bail early if
9 the extension is disabled.
9 the extension is disabled.
10
10
11 . Server
11 . Server
12 .
12 .
13 . No-LFS LFS
13 . No-LFS LFS
14 . +----------------------------+
14 . +----------------------------+
15 . | || D | E | D | E |
15 . | || D | E | D | E |
16 . |---++=======================|
16 . |---++=======================|
17 . C | D || N/A | #1 | X | #4 |
17 . C | D || N/A | #1 | X | #4 |
18 . l No +---++-----------------------|
18 . l No +---++-----------------------|
19 . i LFS | E || #2 | #2 | X | #5 |
19 . i LFS | E || #2 | #2 | X | #5 |
20 . e +---++-----------------------|
20 . e +---++-----------------------|
21 . n | D || X | X | X | X |
21 . n | D || X | X | X | X |
22 . t LFS |---++-----------------------|
22 . t LFS |---++-----------------------|
23 . | E || #3 | #3 | X | #6 |
23 . | E || #3 | #3 | X | #6 |
24 . |---++-----------------------+
24 . |---++-----------------------+
25
25
26 make command server magic visible
26 make command server magic visible
27
27
28 #if windows
28 #if windows
29 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
29 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
30 #else
30 #else
31 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
31 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
32 #endif
32 #endif
33 $ export PYTHONPATH
33 $ export PYTHONPATH
34
34
35 $ hg init server
35 $ hg init server
36 $ SERVER_REQUIRES="$TESTTMP/server/.hg/requires"
36 $ SERVER_REQUIRES="$TESTTMP/server/.hg/requires"
37
37
38 $ cat > $TESTTMP/debugprocessors.py <<EOF
38 $ cat > $TESTTMP/debugprocessors.py <<EOF
39 > from mercurial import (
39 > from mercurial import (
40 > cmdutil,
40 > cmdutil,
41 > commands,
41 > commands,
42 > pycompat,
42 > pycompat,
43 > registrar,
43 > registrar,
44 > )
44 > )
45 > cmdtable = {}
45 > cmdtable = {}
46 > command = registrar.command(cmdtable)
46 > command = registrar.command(cmdtable)
47 > @command(b'debugprocessors', [], b'FILE')
47 > @command(b'debugprocessors', [], b'FILE')
48 > def debugprocessors(ui, repo, file_=None, **opts):
48 > def debugprocessors(ui, repo, file_=None, **opts):
49 > opts = pycompat.byteskwargs(opts)
49 > opts = pycompat.byteskwargs(opts)
50 > opts[b'changelog'] = False
50 > opts[b'changelog'] = False
51 > opts[b'manifest'] = False
51 > opts[b'manifest'] = False
52 > opts[b'dir'] = False
52 > opts[b'dir'] = False
53 > rl = cmdutil.openrevlog(repo, b'debugprocessors', file_, opts)
53 > rl = cmdutil.openrevlog(repo, b'debugprocessors', file_, opts)
54 > for flag, proc in rl._flagprocessors.items():
54 > for flag, proc in rl._flagprocessors.items():
55 > ui.status(b"registered processor '%#x'\n" % (flag))
55 > ui.status(b"registered processor '%#x'\n" % (flag))
56 > EOF
56 > EOF
57
57
58 Skip the experimental.changegroup3=True config. Failure to agree on this comes
58 Skip the experimental.changegroup3=True config. Failure to agree on this comes
59 first, and causes an "abort: no common changegroup version" if the extension is
59 first, and causes an "abort: no common changegroup version" if the extension is
60 only loaded on one side. If that *is* enabled, the subsequent failure is "abort:
60 only loaded on one side. If that *is* enabled, the subsequent failure is "abort:
61 missing processor for flag '0x2000'!" if the extension is only loaded on one side
61 missing processor for flag '0x2000'!" if the extension is only loaded on one side
62 (possibly also masked by the Internal Server Error message).
62 (possibly also masked by the Internal Server Error message).
63 $ cat >> $HGRCPATH <<EOF
63 $ cat >> $HGRCPATH <<EOF
64 > [extensions]
64 > [extensions]
65 > debugprocessors = $TESTTMP/debugprocessors.py
65 > debugprocessors = $TESTTMP/debugprocessors.py
66 > [experimental]
66 > [experimental]
67 > lfs.disableusercache = True
67 > lfs.disableusercache = True
68 > [lfs]
68 > [lfs]
69 > threshold=10
69 > threshold=10
70 > [web]
70 > [web]
71 > allow_push=*
71 > allow_push=*
72 > push_ssl=False
72 > push_ssl=False
73 > EOF
73 > EOF
74
74
75 $ cp $HGRCPATH $HGRCPATH.orig
75 $ cp $HGRCPATH $HGRCPATH.orig
76
76
77 #if lfsremote-on
77 #if lfsremote-on
78 $ hg --config extensions.lfs= -R server \
78 $ hg --config extensions.lfs= -R server \
79 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
79 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
80 #else
80 #else
81 $ hg --config extensions.lfs=! -R server \
81 $ hg --config extensions.lfs=! -R server \
82 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
82 > serve -p $HGPORT -d --pid-file=hg.pid --errorlog=$TESTTMP/errors.log
83 #endif
83 #endif
84
84
85 $ cat hg.pid >> $DAEMON_PIDS
85 $ cat hg.pid >> $DAEMON_PIDS
86 $ hg clone -q http://localhost:$HGPORT client
86 $ hg clone -q http://localhost:$HGPORT client
87 $ grep 'lfs' client/.hg/requires $SERVER_REQUIRES
87 $ grep 'lfs' client/.hg/requires $SERVER_REQUIRES
88 [1]
88 [1]
89
89
90 This trivial repo will force commandserver to load the extension, but not call
90 This trivial repo will force commandserver to load the extension, but not call
91 reposetup() on another repo actually being operated on. This gives coverage
91 reposetup() on another repo actually being operated on. This gives coverage
92 that wrapper functions are not assuming reposetup() was called.
92 that wrapper functions are not assuming reposetup() was called.
93
93
94 $ hg init $TESTTMP/cmdservelfs
94 $ hg init $TESTTMP/cmdservelfs
95 $ cat >> $TESTTMP/cmdservelfs/.hg/hgrc << EOF
95 $ cat >> $TESTTMP/cmdservelfs/.hg/hgrc << EOF
96 > [extensions]
96 > [extensions]
97 > lfs =
97 > lfs =
98 > EOF
98 > EOF
99
99
100 --------------------------------------------------------------------------------
100 --------------------------------------------------------------------------------
101 Case #1: client with non-lfs content and the extension disabled; server with
101 Case #1: client with non-lfs content and the extension disabled; server with
102 non-lfs content, and the extension enabled.
102 non-lfs content, and the extension enabled.
103
103
104 $ cd client
104 $ cd client
105 $ echo 'non-lfs' > nonlfs.txt
105 $ echo 'non-lfs' > nonlfs.txt
106 >>> from __future__ import absolute_import
106 >>> from __future__ import absolute_import
107 >>> from hgclient import check, readchannel, runcommand
107 >>> from hgclient import check, readchannel, runcommand
108 >>> @check
108 >>> @check
109 ... def diff(server):
109 ... def diff(server):
110 ... readchannel(server)
110 ... readchannel(server)
111 ... # run an arbitrary command in the repo with the extension loaded
111 ... # run an arbitrary command in the repo with the extension loaded
112 ... runcommand(server, [b'id', b'-R', b'../cmdservelfs'])
112 ... runcommand(server, [b'id', b'-R', b'../cmdservelfs'])
113 ... # now run a command in a repo without the extension to ensure that
113 ... # now run a command in a repo without the extension to ensure that
114 ... # files are added safely..
114 ... # files are added safely..
115 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
115 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
116 ... # .. and that scmutil.prefetchfiles() safely no-ops..
116 ... # .. and that scmutil.prefetchfiles() safely no-ops..
117 ... runcommand(server, [b'diff', b'-r', b'.~1'])
117 ... runcommand(server, [b'diff', b'-r', b'.~1'])
118 ... # .. and that debugupgraderepo safely no-ops.
118 ... # .. and that debugupgraderepo safely no-ops.
119 ... runcommand(server, [b'debugupgraderepo', b'-q', b'--run'])
119 ... runcommand(server, [b'debugupgraderepo', b'-q', b'--run'])
120 *** runcommand id -R ../cmdservelfs
120 *** runcommand id -R ../cmdservelfs
121 000000000000 tip
121 000000000000 tip
122 *** runcommand ci -Aqm non-lfs
122 *** runcommand ci -Aqm non-lfs
123 *** runcommand diff -r .~1
123 *** runcommand diff -r .~1
124 diff -r 000000000000 nonlfs.txt
124 diff -r 000000000000 nonlfs.txt
125 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
125 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
126 +++ b/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
126 +++ b/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
127 @@ -0,0 +1,1 @@
127 @@ -0,0 +1,1 @@
128 +non-lfs
128 +non-lfs
129 *** runcommand debugupgraderepo -q --run
129 *** runcommand debugupgraderepo -q --run
130 upgrade will perform the following actions:
130 upgrade will perform the following actions:
131
131
132 requirements
132 requirements
133 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
133 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
134
134
135 sidedata
136 Allows storage of extra data alongside a revision.
137
135 beginning upgrade...
138 beginning upgrade...
136 repository locked and read-only
139 repository locked and read-only
137 creating temporary repository to stage migrated data: * (glob)
140 creating temporary repository to stage migrated data: * (glob)
138 (it is safe to interrupt this process any time before data migration completes)
141 (it is safe to interrupt this process any time before data migration completes)
139 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
142 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
140 migrating 324 bytes in store; 129 bytes tracked data
143 migrating 324 bytes in store; 129 bytes tracked data
141 migrating 1 filelogs containing 1 revisions (73 bytes in store; 8 bytes tracked data)
144 migrating 1 filelogs containing 1 revisions (73 bytes in store; 8 bytes tracked data)
142 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
145 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
143 migrating 1 manifests containing 1 revisions (117 bytes in store; 52 bytes tracked data)
146 migrating 1 manifests containing 1 revisions (117 bytes in store; 52 bytes tracked data)
144 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
147 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
145 migrating changelog containing 1 revisions (134 bytes in store; 69 bytes tracked data)
148 migrating changelog containing 1 revisions (134 bytes in store; 69 bytes tracked data)
146 finished migrating 1 changelog revisions; change in size: 0 bytes
149 finished migrating 1 changelog revisions; change in size: 0 bytes
147 finished migrating 3 total revisions; total change in store size: 0 bytes
150 finished migrating 3 total revisions; total change in store size: 0 bytes
148 copying phaseroots
151 copying phaseroots
149 data fully migrated to temporary repository
152 data fully migrated to temporary repository
150 marking source repository as being upgraded; clients will be unable to read from repository
153 marking source repository as being upgraded; clients will be unable to read from repository
151 starting in-place swap of repository data
154 starting in-place swap of repository data
152 replaced files will be backed up at * (glob)
155 replaced files will be backed up at * (glob)
153 replacing store...
156 replacing store...
154 store replacement complete; repository was inconsistent for *s (glob)
157 store replacement complete; repository was inconsistent for *s (glob)
155 finalizing requirements file and making repository readable again
158 finalizing requirements file and making repository readable again
156 removing temporary repository * (glob)
159 removing temporary repository * (glob)
157 copy of old repository backed up at * (glob)
160 copy of old repository backed up at * (glob)
158 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
161 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
159
162
160 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
163 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
161 [1]
164 [1]
162
165
163 #if lfsremote-on
166 #if lfsremote-on
164
167
165 $ hg push -q
168 $ hg push -q
166 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
169 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
167 [1]
170 [1]
168
171
169 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client1_clone
172 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client1_clone
170 $ grep 'lfs' $TESTTMP/client1_clone/.hg/requires $SERVER_REQUIRES
173 $ grep 'lfs' $TESTTMP/client1_clone/.hg/requires $SERVER_REQUIRES
171 [1]
174 [1]
172
175
173 $ hg init $TESTTMP/client1_pull
176 $ hg init $TESTTMP/client1_pull
174 $ hg -R $TESTTMP/client1_pull pull -q http://localhost:$HGPORT
177 $ hg -R $TESTTMP/client1_pull pull -q http://localhost:$HGPORT
175 $ grep 'lfs' $TESTTMP/client1_pull/.hg/requires $SERVER_REQUIRES
178 $ grep 'lfs' $TESTTMP/client1_pull/.hg/requires $SERVER_REQUIRES
176 [1]
179 [1]
177
180
178 $ hg identify http://localhost:$HGPORT
181 $ hg identify http://localhost:$HGPORT
179 d437e1d24fbd
182 d437e1d24fbd
180
183
181 #endif
184 #endif
182
185
183 --------------------------------------------------------------------------------
186 --------------------------------------------------------------------------------
184 Case #2: client with non-lfs content and the extension enabled; server with
187 Case #2: client with non-lfs content and the extension enabled; server with
185 non-lfs content, and the extension state controlled by #testcases.
188 non-lfs content, and the extension state controlled by #testcases.
186
189
187 $ cat >> $HGRCPATH <<EOF
190 $ cat >> $HGRCPATH <<EOF
188 > [extensions]
191 > [extensions]
189 > lfs =
192 > lfs =
190 > EOF
193 > EOF
191 $ echo 'non-lfs' > nonlfs2.txt
194 $ echo 'non-lfs' > nonlfs2.txt
192 $ hg ci -Aqm 'non-lfs file with lfs client'
195 $ hg ci -Aqm 'non-lfs file with lfs client'
193
196
194 Since no lfs content has been added yet, the push is allowed, even when the
197 Since no lfs content has been added yet, the push is allowed, even when the
195 extension is not enabled remotely.
198 extension is not enabled remotely.
196
199
197 $ hg push -q
200 $ hg push -q
198 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
201 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
199 [1]
202 [1]
200
203
201 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client2_clone
204 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client2_clone
202 $ grep 'lfs' $TESTTMP/client2_clone/.hg/requires $SERVER_REQUIRES
205 $ grep 'lfs' $TESTTMP/client2_clone/.hg/requires $SERVER_REQUIRES
203 [1]
206 [1]
204
207
205 $ hg init $TESTTMP/client2_pull
208 $ hg init $TESTTMP/client2_pull
206 $ hg -R $TESTTMP/client2_pull pull -q http://localhost:$HGPORT
209 $ hg -R $TESTTMP/client2_pull pull -q http://localhost:$HGPORT
207 $ grep 'lfs' $TESTTMP/client2_pull/.hg/requires $SERVER_REQUIRES
210 $ grep 'lfs' $TESTTMP/client2_pull/.hg/requires $SERVER_REQUIRES
208 [1]
211 [1]
209
212
210 $ hg identify http://localhost:$HGPORT
213 $ hg identify http://localhost:$HGPORT
211 1477875038c6
214 1477875038c6
212
215
213 --------------------------------------------------------------------------------
216 --------------------------------------------------------------------------------
214 Case #3: client with lfs content and the extension enabled; server with
217 Case #3: client with lfs content and the extension enabled; server with
215 non-lfs content, and the extension state controlled by #testcases. The server
218 non-lfs content, and the extension state controlled by #testcases. The server
216 should have an 'lfs' requirement after it picks up its first commit with a blob.
219 should have an 'lfs' requirement after it picks up its first commit with a blob.
217
220
218 $ echo 'this is a big lfs file' > lfs.bin
221 $ echo 'this is a big lfs file' > lfs.bin
219 $ hg ci -Aqm 'lfs'
222 $ hg ci -Aqm 'lfs'
220 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
223 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
221 .hg/requires:lfs
224 .hg/requires:lfs
222
225
223 #if lfsremote-off
226 #if lfsremote-off
224 $ hg push -q
227 $ hg push -q
225 abort: required features are not supported in the destination: lfs
228 abort: required features are not supported in the destination: lfs
226 (enable the lfs extension on the server)
229 (enable the lfs extension on the server)
227 [255]
230 [255]
228 #else
231 #else
229 $ hg push -q
232 $ hg push -q
230 #endif
233 #endif
231 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
234 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
232 .hg/requires:lfs
235 .hg/requires:lfs
233 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
236 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
234
237
235 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone
238 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client3_clone
236 $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES || true
239 $ grep 'lfs' $TESTTMP/client3_clone/.hg/requires $SERVER_REQUIRES || true
237 $TESTTMP/client3_clone/.hg/requires:lfs (lfsremote-on !)
240 $TESTTMP/client3_clone/.hg/requires:lfs (lfsremote-on !)
238 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
241 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
239
242
240 $ hg init $TESTTMP/client3_pull
243 $ hg init $TESTTMP/client3_pull
241 $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT
244 $ hg -R $TESTTMP/client3_pull pull -q http://localhost:$HGPORT
242 $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true
245 $ grep 'lfs' $TESTTMP/client3_pull/.hg/requires $SERVER_REQUIRES || true
243 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
246 $TESTTMP/client3_pull/.hg/requires:lfs (lfsremote-on !)
244 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
247 $TESTTMP/server/.hg/requires:lfs (lfsremote-on !)
245
248
246 Test that the commit/changegroup requirement check hook can be run multiple
249 Test that the commit/changegroup requirement check hook can be run multiple
247 times.
250 times.
248
251
249 $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3
252 $ hg clone -qr 0 http://localhost:$HGPORT $TESTTMP/cmdserve_client3
250
253
251 $ cd ../cmdserve_client3
254 $ cd ../cmdserve_client3
252
255
253 >>> from __future__ import absolute_import
256 >>> from __future__ import absolute_import
254 >>> from hgclient import check, readchannel, runcommand
257 >>> from hgclient import check, readchannel, runcommand
255 >>> @check
258 >>> @check
256 ... def addrequirement(server):
259 ... def addrequirement(server):
257 ... readchannel(server)
260 ... readchannel(server)
258 ... # change the repo in a way that adds the lfs requirement
261 ... # change the repo in a way that adds the lfs requirement
259 ... runcommand(server, [b'pull', b'-qu'])
262 ... runcommand(server, [b'pull', b'-qu'])
260 ... # Now cause the requirement adding hook to fire again, without going
263 ... # Now cause the requirement adding hook to fire again, without going
261 ... # through reposetup() again.
264 ... # through reposetup() again.
262 ... with open('file.txt', 'wb') as fp:
265 ... with open('file.txt', 'wb') as fp:
263 ... fp.write(b'data')
266 ... fp.write(b'data')
264 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
267 ... runcommand(server, [b'ci', b'-Aqm', b'non-lfs'])
265 *** runcommand pull -qu
268 *** runcommand pull -qu
266 *** runcommand ci -Aqm non-lfs
269 *** runcommand ci -Aqm non-lfs
267
270
268 $ cd ../client
271 $ cd ../client
269
272
270 The difference here is the push failed above when the extension isn't
273 The difference here is the push failed above when the extension isn't
271 enabled on the server.
274 enabled on the server.
272 $ hg identify http://localhost:$HGPORT
275 $ hg identify http://localhost:$HGPORT
273 8374dc4052cb (lfsremote-on !)
276 8374dc4052cb (lfsremote-on !)
274 1477875038c6 (lfsremote-off !)
277 1477875038c6 (lfsremote-off !)
275
278
276 Don't bother testing the lfsremote-off cases- the server won't be able
279 Don't bother testing the lfsremote-off cases- the server won't be able
277 to launch if there's lfs content and the extension is disabled.
280 to launch if there's lfs content and the extension is disabled.
278
281
279 #if lfsremote-on
282 #if lfsremote-on
280
283
281 --------------------------------------------------------------------------------
284 --------------------------------------------------------------------------------
282 Case #4: client with non-lfs content and the extension disabled; server with
285 Case #4: client with non-lfs content and the extension disabled; server with
283 lfs content, and the extension enabled.
286 lfs content, and the extension enabled.
284
287
285 $ cat >> $HGRCPATH <<EOF
288 $ cat >> $HGRCPATH <<EOF
286 > [extensions]
289 > [extensions]
287 > lfs = !
290 > lfs = !
288 > EOF
291 > EOF
289
292
290 $ hg init $TESTTMP/client4
293 $ hg init $TESTTMP/client4
291 $ cd $TESTTMP/client4
294 $ cd $TESTTMP/client4
292 $ cat >> .hg/hgrc <<EOF
295 $ cat >> .hg/hgrc <<EOF
293 > [paths]
296 > [paths]
294 > default = http://localhost:$HGPORT
297 > default = http://localhost:$HGPORT
295 > EOF
298 > EOF
296 $ echo 'non-lfs' > nonlfs2.txt
299 $ echo 'non-lfs' > nonlfs2.txt
297 $ hg ci -Aqm 'non-lfs'
300 $ hg ci -Aqm 'non-lfs'
298 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
301 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
299 $TESTTMP/server/.hg/requires:lfs
302 $TESTTMP/server/.hg/requires:lfs
300
303
301 $ hg push -q --force
304 $ hg push -q --force
302 warning: repository is unrelated
305 warning: repository is unrelated
303 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
306 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
304 $TESTTMP/server/.hg/requires:lfs
307 $TESTTMP/server/.hg/requires:lfs
305
308
306 $ hg clone http://localhost:$HGPORT $TESTTMP/client4_clone
309 $ hg clone http://localhost:$HGPORT $TESTTMP/client4_clone
307 (remote is using large file support (lfs), but it is explicitly disabled in the local configuration)
310 (remote is using large file support (lfs), but it is explicitly disabled in the local configuration)
308 abort: repository requires features unknown to this Mercurial: lfs!
311 abort: repository requires features unknown to this Mercurial: lfs!
309 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
312 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
310 [255]
313 [255]
311 $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES
314 $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES
312 grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$
315 grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$
313 $TESTTMP/server/.hg/requires:lfs
316 $TESTTMP/server/.hg/requires:lfs
314 [2]
317 [2]
315
318
316 TODO: fail more gracefully.
319 TODO: fail more gracefully.
317
320
318 $ hg init $TESTTMP/client4_pull
321 $ hg init $TESTTMP/client4_pull
319 $ hg -R $TESTTMP/client4_pull pull http://localhost:$HGPORT
322 $ hg -R $TESTTMP/client4_pull pull http://localhost:$HGPORT
320 pulling from http://localhost:$HGPORT/
323 pulling from http://localhost:$HGPORT/
321 requesting all changes
324 requesting all changes
322 remote: abort: no common changegroup version
325 remote: abort: no common changegroup version
323 abort: pull failed on remote
326 abort: pull failed on remote
324 [255]
327 [255]
325 $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
328 $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
326 $TESTTMP/server/.hg/requires:lfs
329 $TESTTMP/server/.hg/requires:lfs
327
330
328 $ hg identify http://localhost:$HGPORT
331 $ hg identify http://localhost:$HGPORT
329 03b080fa9d93
332 03b080fa9d93
330
333
331 --------------------------------------------------------------------------------
334 --------------------------------------------------------------------------------
332 Case #5: client with non-lfs content and the extension enabled; server with
335 Case #5: client with non-lfs content and the extension enabled; server with
333 lfs content, and the extension enabled.
336 lfs content, and the extension enabled.
334
337
335 $ cat >> $HGRCPATH <<EOF
338 $ cat >> $HGRCPATH <<EOF
336 > [extensions]
339 > [extensions]
337 > lfs =
340 > lfs =
338 > EOF
341 > EOF
339 $ echo 'non-lfs' > nonlfs3.txt
342 $ echo 'non-lfs' > nonlfs3.txt
340 $ hg ci -Aqm 'non-lfs file with lfs client'
343 $ hg ci -Aqm 'non-lfs file with lfs client'
341
344
342 $ hg push -q
345 $ hg push -q
343 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
346 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
344 $TESTTMP/server/.hg/requires:lfs
347 $TESTTMP/server/.hg/requires:lfs
345
348
346 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone
349 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client5_clone
347 $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES
350 $ grep 'lfs' $TESTTMP/client5_clone/.hg/requires $SERVER_REQUIRES
348 $TESTTMP/client5_clone/.hg/requires:lfs
351 $TESTTMP/client5_clone/.hg/requires:lfs
349 $TESTTMP/server/.hg/requires:lfs
352 $TESTTMP/server/.hg/requires:lfs
350
353
351 $ hg init $TESTTMP/client5_pull
354 $ hg init $TESTTMP/client5_pull
352 $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT
355 $ hg -R $TESTTMP/client5_pull pull -q http://localhost:$HGPORT
353 $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES
356 $ grep 'lfs' $TESTTMP/client5_pull/.hg/requires $SERVER_REQUIRES
354 $TESTTMP/client5_pull/.hg/requires:lfs
357 $TESTTMP/client5_pull/.hg/requires:lfs
355 $TESTTMP/server/.hg/requires:lfs
358 $TESTTMP/server/.hg/requires:lfs
356
359
357 $ hg identify http://localhost:$HGPORT
360 $ hg identify http://localhost:$HGPORT
358 c729025cc5e3
361 c729025cc5e3
359
362
360 $ mv $HGRCPATH $HGRCPATH.tmp
363 $ mv $HGRCPATH $HGRCPATH.tmp
361 $ cp $HGRCPATH.orig $HGRCPATH
364 $ cp $HGRCPATH.orig $HGRCPATH
362
365
363 >>> from __future__ import absolute_import
366 >>> from __future__ import absolute_import
364 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
367 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
365 >>> @check
368 >>> @check
366 ... def checkflags(server):
369 ... def checkflags(server):
367 ... readchannel(server)
370 ... readchannel(server)
368 ... bprint(b'')
371 ... bprint(b'')
369 ... bprint(b'# LFS required- both lfs and non-lfs revlogs have 0x2000 flag')
372 ... bprint(b'# LFS required- both lfs and non-lfs revlogs have 0x2000 flag')
370 ... stdout.flush()
373 ... stdout.flush()
371 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
374 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
372 ... b'../server'])
375 ... b'../server'])
373 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
376 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
374 ... b'../server'])
377 ... b'../server'])
375 ... runcommand(server, [b'config', b'extensions', b'--cwd',
378 ... runcommand(server, [b'config', b'extensions', b'--cwd',
376 ... b'../server'])
379 ... b'../server'])
377 ...
380 ...
378 ... bprint(b"\n# LFS not enabled- revlogs don't have 0x2000 flag")
381 ... bprint(b"\n# LFS not enabled- revlogs don't have 0x2000 flag")
379 ... stdout.flush()
382 ... stdout.flush()
380 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
383 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
381 ... runcommand(server, [b'config', b'extensions'])
384 ... runcommand(server, [b'config', b'extensions'])
382
385
383 # LFS required- both lfs and non-lfs revlogs have 0x2000 flag
386 # LFS required- both lfs and non-lfs revlogs have 0x2000 flag
384 *** runcommand debugprocessors lfs.bin -R ../server
387 *** runcommand debugprocessors lfs.bin -R ../server
385 registered processor '0x8000'
388 registered processor '0x8000'
386 registered processor '0x2000'
389 registered processor '0x2000'
387 *** runcommand debugprocessors nonlfs2.txt -R ../server
390 *** runcommand debugprocessors nonlfs2.txt -R ../server
388 registered processor '0x8000'
391 registered processor '0x8000'
389 registered processor '0x2000'
392 registered processor '0x2000'
390 *** runcommand config extensions --cwd ../server
393 *** runcommand config extensions --cwd ../server
391 extensions.debugprocessors=$TESTTMP/debugprocessors.py
394 extensions.debugprocessors=$TESTTMP/debugprocessors.py
392 extensions.lfs=
395 extensions.lfs=
393
396
394 # LFS not enabled- revlogs don't have 0x2000 flag
397 # LFS not enabled- revlogs don't have 0x2000 flag
395 *** runcommand debugprocessors nonlfs3.txt
398 *** runcommand debugprocessors nonlfs3.txt
396 registered processor '0x8000'
399 registered processor '0x8000'
397 *** runcommand config extensions
400 *** runcommand config extensions
398 extensions.debugprocessors=$TESTTMP/debugprocessors.py
401 extensions.debugprocessors=$TESTTMP/debugprocessors.py
399
402
400 $ rm $HGRCPATH
403 $ rm $HGRCPATH
401 $ mv $HGRCPATH.tmp $HGRCPATH
404 $ mv $HGRCPATH.tmp $HGRCPATH
402
405
403 $ hg clone $TESTTMP/client $TESTTMP/nonlfs -qr 0 --config extensions.lfs=
406 $ hg clone $TESTTMP/client $TESTTMP/nonlfs -qr 0 --config extensions.lfs=
404 $ cat >> $TESTTMP/nonlfs/.hg/hgrc <<EOF
407 $ cat >> $TESTTMP/nonlfs/.hg/hgrc <<EOF
405 > [extensions]
408 > [extensions]
406 > lfs = !
409 > lfs = !
407 > EOF
410 > EOF
408
411
409 >>> from __future__ import absolute_import, print_function
412 >>> from __future__ import absolute_import, print_function
410 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
413 >>> from hgclient import bprint, check, readchannel, runcommand, stdout
411 >>> @check
414 >>> @check
412 ... def checkflags2(server):
415 ... def checkflags2(server):
413 ... readchannel(server)
416 ... readchannel(server)
414 ... bprint(b'')
417 ... bprint(b'')
415 ... bprint(b'# LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag')
418 ... bprint(b'# LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag')
416 ... stdout.flush()
419 ... stdout.flush()
417 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
420 ... runcommand(server, [b'debugprocessors', b'lfs.bin', b'-R',
418 ... b'../server'])
421 ... b'../server'])
419 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
422 ... runcommand(server, [b'debugprocessors', b'nonlfs2.txt', b'-R',
420 ... b'../server'])
423 ... b'../server'])
421 ... runcommand(server, [b'config', b'extensions', b'--cwd',
424 ... runcommand(server, [b'config', b'extensions', b'--cwd',
422 ... b'../server'])
425 ... b'../server'])
423 ...
426 ...
424 ... bprint(b'\n# LFS enabled without requirement- revlogs have 0x2000 flag')
427 ... bprint(b'\n# LFS enabled without requirement- revlogs have 0x2000 flag')
425 ... stdout.flush()
428 ... stdout.flush()
426 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
429 ... runcommand(server, [b'debugprocessors', b'nonlfs3.txt'])
427 ... runcommand(server, [b'config', b'extensions'])
430 ... runcommand(server, [b'config', b'extensions'])
428 ...
431 ...
429 ... bprint(b"\n# LFS disabled locally- revlogs don't have 0x2000 flag")
432 ... bprint(b"\n# LFS disabled locally- revlogs don't have 0x2000 flag")
430 ... stdout.flush()
433 ... stdout.flush()
431 ... runcommand(server, [b'debugprocessors', b'nonlfs.txt', b'-R',
434 ... runcommand(server, [b'debugprocessors', b'nonlfs.txt', b'-R',
432 ... b'../nonlfs'])
435 ... b'../nonlfs'])
433 ... runcommand(server, [b'config', b'extensions', b'--cwd',
436 ... runcommand(server, [b'config', b'extensions', b'--cwd',
434 ... b'../nonlfs'])
437 ... b'../nonlfs'])
435
438
436 # LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag
439 # LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag
437 *** runcommand debugprocessors lfs.bin -R ../server
440 *** runcommand debugprocessors lfs.bin -R ../server
438 registered processor '0x8000'
441 registered processor '0x8000'
439 registered processor '0x2000'
442 registered processor '0x2000'
440 *** runcommand debugprocessors nonlfs2.txt -R ../server
443 *** runcommand debugprocessors nonlfs2.txt -R ../server
441 registered processor '0x8000'
444 registered processor '0x8000'
442 registered processor '0x2000'
445 registered processor '0x2000'
443 *** runcommand config extensions --cwd ../server
446 *** runcommand config extensions --cwd ../server
444 extensions.debugprocessors=$TESTTMP/debugprocessors.py
447 extensions.debugprocessors=$TESTTMP/debugprocessors.py
445 extensions.lfs=
448 extensions.lfs=
446
449
447 # LFS enabled without requirement- revlogs have 0x2000 flag
450 # LFS enabled without requirement- revlogs have 0x2000 flag
448 *** runcommand debugprocessors nonlfs3.txt
451 *** runcommand debugprocessors nonlfs3.txt
449 registered processor '0x8000'
452 registered processor '0x8000'
450 registered processor '0x2000'
453 registered processor '0x2000'
451 *** runcommand config extensions
454 *** runcommand config extensions
452 extensions.debugprocessors=$TESTTMP/debugprocessors.py
455 extensions.debugprocessors=$TESTTMP/debugprocessors.py
453 extensions.lfs=
456 extensions.lfs=
454
457
455 # LFS disabled locally- revlogs don't have 0x2000 flag
458 # LFS disabled locally- revlogs don't have 0x2000 flag
456 *** runcommand debugprocessors nonlfs.txt -R ../nonlfs
459 *** runcommand debugprocessors nonlfs.txt -R ../nonlfs
457 registered processor '0x8000'
460 registered processor '0x8000'
458 *** runcommand config extensions --cwd ../nonlfs
461 *** runcommand config extensions --cwd ../nonlfs
459 extensions.debugprocessors=$TESTTMP/debugprocessors.py
462 extensions.debugprocessors=$TESTTMP/debugprocessors.py
460 extensions.lfs=!
463 extensions.lfs=!
461
464
462 --------------------------------------------------------------------------------
465 --------------------------------------------------------------------------------
463 Case #6: client with lfs content and the extension enabled; server with
466 Case #6: client with lfs content and the extension enabled; server with
464 lfs content, and the extension enabled.
467 lfs content, and the extension enabled.
465
468
466 $ echo 'this is another lfs file' > lfs2.txt
469 $ echo 'this is another lfs file' > lfs2.txt
467 $ hg ci -Aqm 'lfs file with lfs client'
470 $ hg ci -Aqm 'lfs file with lfs client'
468
471
469 $ hg --config paths.default= push -v http://localhost:$HGPORT
472 $ hg --config paths.default= push -v http://localhost:$HGPORT
470 pushing to http://localhost:$HGPORT/
473 pushing to http://localhost:$HGPORT/
471 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
474 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
472 searching for changes
475 searching for changes
473 remote has heads on branch 'default' that are not known locally: 8374dc4052cb
476 remote has heads on branch 'default' that are not known locally: 8374dc4052cb
474 lfs: uploading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
477 lfs: uploading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
475 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
478 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
476 lfs: uploaded 1 files (25 bytes)
479 lfs: uploaded 1 files (25 bytes)
477 1 changesets found
480 1 changesets found
478 uncompressed size of bundle content:
481 uncompressed size of bundle content:
479 206 (changelog)
482 206 (changelog)
480 172 (manifests)
483 172 (manifests)
481 275 lfs2.txt
484 275 lfs2.txt
482 remote: adding changesets
485 remote: adding changesets
483 remote: adding manifests
486 remote: adding manifests
484 remote: adding file changes
487 remote: adding file changes
485 remote: added 1 changesets with 1 changes to 1 files
488 remote: added 1 changesets with 1 changes to 1 files
486 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
489 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
487 .hg/requires:lfs
490 .hg/requires:lfs
488 $TESTTMP/server/.hg/requires:lfs
491 $TESTTMP/server/.hg/requires:lfs
489
492
490 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone
493 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client6_clone
491 $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES
494 $ grep 'lfs' $TESTTMP/client6_clone/.hg/requires $SERVER_REQUIRES
492 $TESTTMP/client6_clone/.hg/requires:lfs
495 $TESTTMP/client6_clone/.hg/requires:lfs
493 $TESTTMP/server/.hg/requires:lfs
496 $TESTTMP/server/.hg/requires:lfs
494
497
495 $ hg init $TESTTMP/client6_pull
498 $ hg init $TESTTMP/client6_pull
496 $ hg -R $TESTTMP/client6_pull pull -u -v http://localhost:$HGPORT
499 $ hg -R $TESTTMP/client6_pull pull -u -v http://localhost:$HGPORT
497 pulling from http://localhost:$HGPORT/
500 pulling from http://localhost:$HGPORT/
498 requesting all changes
501 requesting all changes
499 adding changesets
502 adding changesets
500 adding manifests
503 adding manifests
501 adding file changes
504 adding file changes
502 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
505 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
503 added 6 changesets with 5 changes to 5 files (+1 heads)
506 added 6 changesets with 5 changes to 5 files (+1 heads)
504 new changesets d437e1d24fbd:d3b84d50eacb
507 new changesets d437e1d24fbd:d3b84d50eacb
505 resolving manifests
508 resolving manifests
506 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
509 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
507 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
510 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
508 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
511 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
509 lfs: downloaded 1 files (25 bytes)
512 lfs: downloaded 1 files (25 bytes)
510 getting lfs2.txt
513 getting lfs2.txt
511 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
514 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
512 getting nonlfs2.txt
515 getting nonlfs2.txt
513 getting nonlfs3.txt
516 getting nonlfs3.txt
514 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
517 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
515 updated to "d3b84d50eacb: lfs file with lfs client"
518 updated to "d3b84d50eacb: lfs file with lfs client"
516 1 other heads for branch "default"
519 1 other heads for branch "default"
517 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
520 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
518 $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES
521 $ grep 'lfs' $TESTTMP/client6_pull/.hg/requires $SERVER_REQUIRES
519 $TESTTMP/client6_pull/.hg/requires:lfs
522 $TESTTMP/client6_pull/.hg/requires:lfs
520 $TESTTMP/server/.hg/requires:lfs
523 $TESTTMP/server/.hg/requires:lfs
521
524
522 $ hg identify http://localhost:$HGPORT
525 $ hg identify http://localhost:$HGPORT
523 d3b84d50eacb
526 d3b84d50eacb
524
527
525 --------------------------------------------------------------------------------
528 --------------------------------------------------------------------------------
526 Misc: process dies early if a requirement exists and the extension is disabled
529 Misc: process dies early if a requirement exists and the extension is disabled
527
530
528 $ hg --config extensions.lfs=! summary
531 $ hg --config extensions.lfs=! summary
529 abort: repository requires features unknown to this Mercurial: lfs!
532 abort: repository requires features unknown to this Mercurial: lfs!
530 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
533 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
531 [255]
534 [255]
532
535
533 $ echo 'this is an lfs file' > $TESTTMP/client6_clone/lfspair1.bin
536 $ echo 'this is an lfs file' > $TESTTMP/client6_clone/lfspair1.bin
534 $ echo 'this is an lfs file too' > $TESTTMP/client6_clone/lfspair2.bin
537 $ echo 'this is an lfs file too' > $TESTTMP/client6_clone/lfspair2.bin
535 $ hg -R $TESTTMP/client6_clone ci -Aqm 'add lfs pair'
538 $ hg -R $TESTTMP/client6_clone ci -Aqm 'add lfs pair'
536 $ hg -R $TESTTMP/client6_clone push -q
539 $ hg -R $TESTTMP/client6_clone push -q
537
540
538 $ hg clone -qU http://localhost:$HGPORT $TESTTMP/bulkfetch
541 $ hg clone -qU http://localhost:$HGPORT $TESTTMP/bulkfetch
539
542
540 Cat doesn't prefetch unless data is needed (e.g. '-T {rawdata}' doesn't need it)
543 Cat doesn't prefetch unless data is needed (e.g. '-T {rawdata}' doesn't need it)
541
544
542 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{rawdata}\n{path}\n'
545 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{rawdata}\n{path}\n'
543 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
546 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
544 version https://git-lfs.github.com/spec/v1
547 version https://git-lfs.github.com/spec/v1
545 oid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
548 oid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
546 size 20
549 size 20
547 x-is-binary 0
550 x-is-binary 0
548
551
549 lfspair1.bin
552 lfspair1.bin
550
553
551 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T json
554 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T json
552 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
555 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
553 [lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
556 [lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
554 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
557 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
555 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
558 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
556 lfs: downloaded 1 files (20 bytes)
559 lfs: downloaded 1 files (20 bytes)
557 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
560 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
558
561
559 {
562 {
560 "data": "this is an lfs file\n",
563 "data": "this is an lfs file\n",
561 "path": "lfspair1.bin",
564 "path": "lfspair1.bin",
562 "rawdata": "version https://git-lfs.github.com/spec/v1\noid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782\nsize 20\nx-is-binary 0\n"
565 "rawdata": "version https://git-lfs.github.com/spec/v1\noid sha256:cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782\nsize 20\nx-is-binary 0\n"
563 }
566 }
564 ]
567 ]
565
568
566 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
569 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
567
570
568 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{data}\n'
571 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair1.bin -T '{data}\n'
569 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
572 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
570 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
573 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
571 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
574 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
572 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
575 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
573 lfs: downloaded 1 files (20 bytes)
576 lfs: downloaded 1 files (20 bytes)
574 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
577 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
575 this is an lfs file
578 this is an lfs file
576
579
577 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair2.bin
580 $ hg --cwd $TESTTMP/bulkfetch cat -vr tip lfspair2.bin
578 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
581 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
579 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
582 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
580 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
583 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
581 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
584 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
582 lfs: downloaded 1 files (24 bytes)
585 lfs: downloaded 1 files (24 bytes)
583 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
586 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
584 this is an lfs file too
587 this is an lfs file too
585
588
586 Export will prefetch all needed files across all needed revisions
589 Export will prefetch all needed files across all needed revisions
587
590
588 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
591 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
589 $ hg -R $TESTTMP/bulkfetch -v export -r 0:tip -o all.export
592 $ hg -R $TESTTMP/bulkfetch -v export -r 0:tip -o all.export
590 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
593 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
591 exporting patches:
594 exporting patches:
592 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
595 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
593 lfs: need to transfer 4 objects (92 bytes)
596 lfs: need to transfer 4 objects (92 bytes)
594 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
597 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
595 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
598 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
596 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
599 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
597 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
600 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
598 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
601 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
599 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
602 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
600 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
603 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
601 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
604 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
602 lfs: downloaded 4 files (92 bytes)
605 lfs: downloaded 4 files (92 bytes)
603 all.export
606 all.export
604 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
607 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
605 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
608 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
606 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
609 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
607 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
610 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
608
611
609 Export with selected files is used with `extdiff --patch`
612 Export with selected files is used with `extdiff --patch`
610
613
611 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
614 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
612 $ hg --config extensions.extdiff= \
615 $ hg --config extensions.extdiff= \
613 > -R $TESTTMP/bulkfetch -v extdiff -r 2:tip --patch $TESTTMP/bulkfetch/lfs.bin
616 > -R $TESTTMP/bulkfetch -v extdiff -r 2:tip --patch $TESTTMP/bulkfetch/lfs.bin
614 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
617 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
615 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
618 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
616 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
619 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
617 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
620 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
618 lfs: downloaded 1 files (23 bytes)
621 lfs: downloaded 1 files (23 bytes)
619 */hg-8374dc4052cb.patch (glob)
622 */hg-8374dc4052cb.patch (glob)
620 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
623 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
621 */hg-9640b57e77b1.patch (glob)
624 */hg-9640b57e77b1.patch (glob)
622 --- */hg-8374dc4052cb.patch * (glob)
625 --- */hg-8374dc4052cb.patch * (glob)
623 +++ */hg-9640b57e77b1.patch * (glob)
626 +++ */hg-9640b57e77b1.patch * (glob)
624 @@ -2,12 +2,7 @@
627 @@ -2,12 +2,7 @@
625 # User test
628 # User test
626 # Date 0 0
629 # Date 0 0
627 # Thu Jan 01 00:00:00 1970 +0000
630 # Thu Jan 01 00:00:00 1970 +0000
628 -# Node ID 8374dc4052cbd388e79d9dc4ddb29784097aa354
631 -# Node ID 8374dc4052cbd388e79d9dc4ddb29784097aa354
629 -# Parent 1477875038c60152e391238920a16381c627b487
632 -# Parent 1477875038c60152e391238920a16381c627b487
630 -lfs
633 -lfs
631 +# Node ID 9640b57e77b14c3a0144fb4478b6cc13e13ea0d1
634 +# Node ID 9640b57e77b14c3a0144fb4478b6cc13e13ea0d1
632 +# Parent d3b84d50eacbd56638e11abce6b8616aaba54420
635 +# Parent d3b84d50eacbd56638e11abce6b8616aaba54420
633 +add lfs pair
636 +add lfs pair
634
637
635 -diff -r 1477875038c6 -r 8374dc4052cb lfs.bin
638 -diff -r 1477875038c6 -r 8374dc4052cb lfs.bin
636 ---- /dev/null Thu Jan 01 00:00:00 1970 +0000
639 ---- /dev/null Thu Jan 01 00:00:00 1970 +0000
637 -+++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000
640 -+++ b/lfs.bin Thu Jan 01 00:00:00 1970 +0000
638 -@@ -0,0 +1,1 @@
641 -@@ -0,0 +1,1 @@
639 -+this is a big lfs file
642 -+this is a big lfs file
640 cleaning up temp directory
643 cleaning up temp directory
641 [1]
644 [1]
642
645
643 Diff will prefetch files
646 Diff will prefetch files
644
647
645 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
648 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
646 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip
649 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip
647 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
650 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
648 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
651 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
649 lfs: need to transfer 4 objects (92 bytes)
652 lfs: need to transfer 4 objects (92 bytes)
650 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
653 lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
651 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
654 lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
652 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
655 lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
653 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
656 lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
654 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
657 lfs: downloading cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 (20 bytes)
655 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
658 lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
656 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
659 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
657 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
660 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
658 lfs: downloaded 4 files (92 bytes)
661 lfs: downloaded 4 files (92 bytes)
659 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
662 lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
660 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
663 lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
661 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
664 lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
662 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
665 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
663 diff -r 8374dc4052cb -r 9640b57e77b1 lfs.bin
666 diff -r 8374dc4052cb -r 9640b57e77b1 lfs.bin
664 --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000
667 --- a/lfs.bin Thu Jan 01 00:00:00 1970 +0000
665 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
668 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
666 @@ -1,1 +0,0 @@
669 @@ -1,1 +0,0 @@
667 -this is a big lfs file
670 -this is a big lfs file
668 diff -r 8374dc4052cb -r 9640b57e77b1 lfs2.txt
671 diff -r 8374dc4052cb -r 9640b57e77b1 lfs2.txt
669 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
672 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
670 +++ b/lfs2.txt Thu Jan 01 00:00:00 1970 +0000
673 +++ b/lfs2.txt Thu Jan 01 00:00:00 1970 +0000
671 @@ -0,0 +1,1 @@
674 @@ -0,0 +1,1 @@
672 +this is another lfs file
675 +this is another lfs file
673 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair1.bin
676 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair1.bin
674 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
677 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
675 +++ b/lfspair1.bin Thu Jan 01 00:00:00 1970 +0000
678 +++ b/lfspair1.bin Thu Jan 01 00:00:00 1970 +0000
676 @@ -0,0 +1,1 @@
679 @@ -0,0 +1,1 @@
677 +this is an lfs file
680 +this is an lfs file
678 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
681 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
679 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
682 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
680 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
683 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
681 @@ -0,0 +1,1 @@
684 @@ -0,0 +1,1 @@
682 +this is an lfs file too
685 +this is an lfs file too
683 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs.txt
686 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs.txt
684 --- a/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
687 --- a/nonlfs.txt Thu Jan 01 00:00:00 1970 +0000
685 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
688 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
686 @@ -1,1 +0,0 @@
689 @@ -1,1 +0,0 @@
687 -non-lfs
690 -non-lfs
688 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs3.txt
691 diff -r 8374dc4052cb -r 9640b57e77b1 nonlfs3.txt
689 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
692 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
690 +++ b/nonlfs3.txt Thu Jan 01 00:00:00 1970 +0000
693 +++ b/nonlfs3.txt Thu Jan 01 00:00:00 1970 +0000
691 @@ -0,0 +1,1 @@
694 @@ -0,0 +1,1 @@
692 +non-lfs
695 +non-lfs
693
696
694 Only the files required by diff are prefetched
697 Only the files required by diff are prefetched
695
698
696 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
699 $ rm -r $TESTTMP/bulkfetch/.hg/store/lfs
697 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip $TESTTMP/bulkfetch/lfspair2.bin
700 $ hg -R $TESTTMP/bulkfetch -v diff -r 2:tip $TESTTMP/bulkfetch/lfspair2.bin
698 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
701 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
699 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
702 lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
700 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
703 lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
701 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
704 lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
702 lfs: downloaded 1 files (24 bytes)
705 lfs: downloaded 1 files (24 bytes)
703 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
706 lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
704 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
707 diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
705 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
708 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
706 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
709 +++ b/lfspair2.bin Thu Jan 01 00:00:00 1970 +0000
707 @@ -0,0 +1,1 @@
710 @@ -0,0 +1,1 @@
708 +this is an lfs file too
711 +this is an lfs file too
709
712
710 #endif
713 #endif
711
714
712 $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS
715 $ "$PYTHON" $TESTDIR/killdaemons.py $DAEMON_PIDS
713
716
714 $ cat $TESTTMP/errors.log
717 $ cat $TESTTMP/errors.log
@@ -1,1259 +1,1333 b''
1 #require no-reposimplestore
1 #require no-reposimplestore
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > share =
5 > share =
6 > EOF
6 > EOF
7
7
8 store and revlogv1 are required in source
8 store and revlogv1 are required in source
9
9
10 $ hg --config format.usestore=false init no-store
10 $ hg --config format.usestore=false init no-store
11 $ hg -R no-store debugupgraderepo
11 $ hg -R no-store debugupgraderepo
12 abort: cannot upgrade repository; requirement missing: store
12 abort: cannot upgrade repository; requirement missing: store
13 [255]
13 [255]
14
14
15 $ hg init no-revlogv1
15 $ hg init no-revlogv1
16 $ cat > no-revlogv1/.hg/requires << EOF
16 $ cat > no-revlogv1/.hg/requires << EOF
17 > dotencode
17 > dotencode
18 > fncache
18 > fncache
19 > generaldelta
19 > generaldelta
20 > store
20 > store
21 > EOF
21 > EOF
22
22
23 $ hg -R no-revlogv1 debugupgraderepo
23 $ hg -R no-revlogv1 debugupgraderepo
24 abort: cannot upgrade repository; requirement missing: revlogv1
24 abort: cannot upgrade repository; requirement missing: revlogv1
25 [255]
25 [255]
26
26
27 Cannot upgrade shared repositories
27 Cannot upgrade shared repositories
28
28
29 $ hg init share-parent
29 $ hg init share-parent
30 $ hg -q share share-parent share-child
30 $ hg -q share share-parent share-child
31
31
32 $ hg -R share-child debugupgraderepo
32 $ hg -R share-child debugupgraderepo
33 abort: cannot upgrade repository; unsupported source requirement: shared
33 abort: cannot upgrade repository; unsupported source requirement: shared
34 [255]
34 [255]
35
35
36 Do not yet support upgrading treemanifest repos
36 Do not yet support upgrading treemanifest repos
37
37
38 $ hg --config experimental.treemanifest=true init treemanifest
38 $ hg --config experimental.treemanifest=true init treemanifest
39 $ hg -R treemanifest debugupgraderepo
39 $ hg -R treemanifest debugupgraderepo
40 abort: cannot upgrade repository; unsupported source requirement: treemanifest
40 abort: cannot upgrade repository; unsupported source requirement: treemanifest
41 [255]
41 [255]
42
42
43 Cannot add treemanifest requirement during upgrade
43 Cannot add treemanifest requirement during upgrade
44
44
45 $ hg init disallowaddedreq
45 $ hg init disallowaddedreq
46 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
46 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
47 abort: cannot upgrade repository; do not support adding requirement: treemanifest
47 abort: cannot upgrade repository; do not support adding requirement: treemanifest
48 [255]
48 [255]
49
49
50 An upgrade of a repository created with recommended settings only suggests optimizations
50 An upgrade of a repository created with recommended settings only suggests optimizations
51
51
52 $ hg init empty
52 $ hg init empty
53 $ cd empty
53 $ cd empty
54 $ hg debugformat
54 $ hg debugformat
55 format-variant repo
55 format-variant repo
56 fncache: yes
56 fncache: yes
57 dotencode: yes
57 dotencode: yes
58 generaldelta: yes
58 generaldelta: yes
59 sparserevlog: yes
59 sparserevlog: yes
60 sidedata: no
60 plain-cl-delta: yes
61 plain-cl-delta: yes
61 compression: zlib
62 compression: zlib
62 compression-level: default
63 compression-level: default
63 $ hg debugformat --verbose
64 $ hg debugformat --verbose
64 format-variant repo config default
65 format-variant repo config default
65 fncache: yes yes yes
66 fncache: yes yes yes
66 dotencode: yes yes yes
67 dotencode: yes yes yes
67 generaldelta: yes yes yes
68 generaldelta: yes yes yes
68 sparserevlog: yes yes yes
69 sparserevlog: yes yes yes
70 sidedata: no no no
69 plain-cl-delta: yes yes yes
71 plain-cl-delta: yes yes yes
70 compression: zlib zlib zlib
72 compression: zlib zlib zlib
71 compression-level: default default default
73 compression-level: default default default
72 $ hg debugformat --verbose --config format.usefncache=no
74 $ hg debugformat --verbose --config format.usefncache=no
73 format-variant repo config default
75 format-variant repo config default
74 fncache: yes no yes
76 fncache: yes no yes
75 dotencode: yes no yes
77 dotencode: yes no yes
76 generaldelta: yes yes yes
78 generaldelta: yes yes yes
77 sparserevlog: yes yes yes
79 sparserevlog: yes yes yes
80 sidedata: no no no
78 plain-cl-delta: yes yes yes
81 plain-cl-delta: yes yes yes
79 compression: zlib zlib zlib
82 compression: zlib zlib zlib
80 compression-level: default default default
83 compression-level: default default default
81 $ hg debugformat --verbose --config format.usefncache=no --color=debug
84 $ hg debugformat --verbose --config format.usefncache=no --color=debug
82 format-variant repo config default
85 format-variant repo config default
83 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
86 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
84 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
87 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
85 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
88 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
86 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
89 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
90 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
87 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
91 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
88 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
92 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
89 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
93 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
90 $ hg debugformat -Tjson
94 $ hg debugformat -Tjson
91 [
95 [
92 {
96 {
93 "config": true,
97 "config": true,
94 "default": true,
98 "default": true,
95 "name": "fncache",
99 "name": "fncache",
96 "repo": true
100 "repo": true
97 },
101 },
98 {
102 {
99 "config": true,
103 "config": true,
100 "default": true,
104 "default": true,
101 "name": "dotencode",
105 "name": "dotencode",
102 "repo": true
106 "repo": true
103 },
107 },
104 {
108 {
105 "config": true,
109 "config": true,
106 "default": true,
110 "default": true,
107 "name": "generaldelta",
111 "name": "generaldelta",
108 "repo": true
112 "repo": true
109 },
113 },
110 {
114 {
111 "config": true,
115 "config": true,
112 "default": true,
116 "default": true,
113 "name": "sparserevlog",
117 "name": "sparserevlog",
114 "repo": true
118 "repo": true
115 },
119 },
116 {
120 {
121 "config": false,
122 "default": false,
123 "name": "sidedata",
124 "repo": false
125 },
126 {
117 "config": true,
127 "config": true,
118 "default": true,
128 "default": true,
119 "name": "plain-cl-delta",
129 "name": "plain-cl-delta",
120 "repo": true
130 "repo": true
121 },
131 },
122 {
132 {
123 "config": "zlib",
133 "config": "zlib",
124 "default": "zlib",
134 "default": "zlib",
125 "name": "compression",
135 "name": "compression",
126 "repo": "zlib"
136 "repo": "zlib"
127 },
137 },
128 {
138 {
129 "config": "default",
139 "config": "default",
130 "default": "default",
140 "default": "default",
131 "name": "compression-level",
141 "name": "compression-level",
132 "repo": "default"
142 "repo": "default"
133 }
143 }
134 ]
144 ]
135 $ hg debugupgraderepo
145 $ hg debugupgraderepo
136 (no feature deficiencies found in existing repository)
146 (no feature deficiencies found in existing repository)
137 performing an upgrade with "--run" will make the following changes:
147 performing an upgrade with "--run" will make the following changes:
138
148
139 requirements
149 requirements
140 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
150 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
141
151
152 sidedata
153 Allows storage of extra data alongside a revision.
154
142 additional optimizations are available by specifying "--optimize <name>":
155 additional optimizations are available by specifying "--optimize <name>":
143
156
144 re-delta-parent
157 re-delta-parent
145 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
158 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
146
159
147 re-delta-multibase
160 re-delta-multibase
148 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
161 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
149
162
150 re-delta-all
163 re-delta-all
151 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
164 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
152
165
153 re-delta-fulladd
166 re-delta-fulladd
154 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
167 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
155
168
156
169
157 --optimize can be used to add optimizations
170 --optimize can be used to add optimizations
158
171
159 $ hg debugupgrade --optimize redeltaparent
172 $ hg debugupgrade --optimize redeltaparent
160 (no feature deficiencies found in existing repository)
173 (no feature deficiencies found in existing repository)
161 performing an upgrade with "--run" will make the following changes:
174 performing an upgrade with "--run" will make the following changes:
162
175
163 requirements
176 requirements
164 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
177 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
165
178
179 sidedata
180 Allows storage of extra data alongside a revision.
181
166 re-delta-parent
182 re-delta-parent
167 deltas within internal storage will choose a new base revision if needed
183 deltas within internal storage will choose a new base revision if needed
168
184
169 additional optimizations are available by specifying "--optimize <name>":
185 additional optimizations are available by specifying "--optimize <name>":
170
186
171 re-delta-multibase
187 re-delta-multibase
172 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
188 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
173
189
174 re-delta-all
190 re-delta-all
175 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
191 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
176
192
177 re-delta-fulladd
193 re-delta-fulladd
178 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
194 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
179
195
180
196
181 modern form of the option
197 modern form of the option
182
198
183 $ hg debugupgrade --optimize re-delta-parent
199 $ hg debugupgrade --optimize re-delta-parent
184 (no feature deficiencies found in existing repository)
200 (no feature deficiencies found in existing repository)
185 performing an upgrade with "--run" will make the following changes:
201 performing an upgrade with "--run" will make the following changes:
186
202
187 requirements
203 requirements
188 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
204 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
189
205
206 sidedata
207 Allows storage of extra data alongside a revision.
208
190 re-delta-parent
209 re-delta-parent
191 deltas within internal storage will choose a new base revision if needed
210 deltas within internal storage will choose a new base revision if needed
192
211
193 additional optimizations are available by specifying "--optimize <name>":
212 additional optimizations are available by specifying "--optimize <name>":
194
213
195 re-delta-multibase
214 re-delta-multibase
196 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
215 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
197
216
198 re-delta-all
217 re-delta-all
199 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
218 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
200
219
201 re-delta-fulladd
220 re-delta-fulladd
202 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
221 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
203
222
204
223
205 unknown optimization:
224 unknown optimization:
206
225
207 $ hg debugupgrade --optimize foobar
226 $ hg debugupgrade --optimize foobar
208 abort: unknown optimization action requested: foobar
227 abort: unknown optimization action requested: foobar
209 (run without arguments to see valid optimizations)
228 (run without arguments to see valid optimizations)
210 [255]
229 [255]
211
230
212 Various sub-optimal detections work
231 Various sub-optimal detections work
213
232
214 $ cat > .hg/requires << EOF
233 $ cat > .hg/requires << EOF
215 > revlogv1
234 > revlogv1
216 > store
235 > store
217 > EOF
236 > EOF
218
237
219 $ hg debugformat
238 $ hg debugformat
220 format-variant repo
239 format-variant repo
221 fncache: no
240 fncache: no
222 dotencode: no
241 dotencode: no
223 generaldelta: no
242 generaldelta: no
224 sparserevlog: no
243 sparserevlog: no
244 sidedata: no
225 plain-cl-delta: yes
245 plain-cl-delta: yes
226 compression: zlib
246 compression: zlib
227 compression-level: default
247 compression-level: default
228 $ hg debugformat --verbose
248 $ hg debugformat --verbose
229 format-variant repo config default
249 format-variant repo config default
230 fncache: no yes yes
250 fncache: no yes yes
231 dotencode: no yes yes
251 dotencode: no yes yes
232 generaldelta: no yes yes
252 generaldelta: no yes yes
233 sparserevlog: no yes yes
253 sparserevlog: no yes yes
254 sidedata: no no no
234 plain-cl-delta: yes yes yes
255 plain-cl-delta: yes yes yes
235 compression: zlib zlib zlib
256 compression: zlib zlib zlib
236 compression-level: default default default
257 compression-level: default default default
237 $ hg debugformat --verbose --config format.usegeneraldelta=no
258 $ hg debugformat --verbose --config format.usegeneraldelta=no
238 format-variant repo config default
259 format-variant repo config default
239 fncache: no yes yes
260 fncache: no yes yes
240 dotencode: no yes yes
261 dotencode: no yes yes
241 generaldelta: no no yes
262 generaldelta: no no yes
242 sparserevlog: no no yes
263 sparserevlog: no no yes
264 sidedata: no no no
243 plain-cl-delta: yes yes yes
265 plain-cl-delta: yes yes yes
244 compression: zlib zlib zlib
266 compression: zlib zlib zlib
245 compression-level: default default default
267 compression-level: default default default
246 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
268 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
247 format-variant repo config default
269 format-variant repo config default
248 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
270 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
249 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
271 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
250 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
272 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
251 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
273 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
274 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
252 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
275 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
253 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
276 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
254 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
277 [formatvariant.name.uptodate|compression-level:][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
255 $ hg debugupgraderepo
278 $ hg debugupgraderepo
256 repository lacks features recommended by current config options:
279 repository lacks features recommended by current config options:
257
280
258 fncache
281 fncache
259 long and reserved filenames may not work correctly; repository performance is sub-optimal
282 long and reserved filenames may not work correctly; repository performance is sub-optimal
260
283
261 dotencode
284 dotencode
262 storage of filenames beginning with a period or space may not work correctly
285 storage of filenames beginning with a period or space may not work correctly
263
286
264 generaldelta
287 generaldelta
265 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
288 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
266
289
267 sparserevlog
290 sparserevlog
268 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
291 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
269
292
270
293
271 performing an upgrade with "--run" will make the following changes:
294 performing an upgrade with "--run" will make the following changes:
272
295
273 requirements
296 requirements
274 preserved: revlogv1, store
297 preserved: revlogv1, store
275 added: dotencode, fncache, generaldelta, sparserevlog
298 added: dotencode, fncache, generaldelta, sparserevlog
276
299
277 fncache
300 fncache
278 repository will be more resilient to storing certain paths and performance of certain operations should be improved
301 repository will be more resilient to storing certain paths and performance of certain operations should be improved
279
302
280 dotencode
303 dotencode
281 repository will be better able to store files beginning with a space or period
304 repository will be better able to store files beginning with a space or period
282
305
283 generaldelta
306 generaldelta
284 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
307 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
285
308
286 sparserevlog
309 sparserevlog
287 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
310 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
288
311
312 sidedata
313 Allows storage of extra data alongside a revision.
314
289 additional optimizations are available by specifying "--optimize <name>":
315 additional optimizations are available by specifying "--optimize <name>":
290
316
291 re-delta-parent
317 re-delta-parent
292 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
318 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
293
319
294 re-delta-multibase
320 re-delta-multibase
295 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
321 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
296
322
297 re-delta-all
323 re-delta-all
298 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
324 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
299
325
300 re-delta-fulladd
326 re-delta-fulladd
301 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
327 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
302
328
303
329
304 $ hg --config format.dotencode=false debugupgraderepo
330 $ hg --config format.dotencode=false debugupgraderepo
305 repository lacks features recommended by current config options:
331 repository lacks features recommended by current config options:
306
332
307 fncache
333 fncache
308 long and reserved filenames may not work correctly; repository performance is sub-optimal
334 long and reserved filenames may not work correctly; repository performance is sub-optimal
309
335
310 generaldelta
336 generaldelta
311 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
337 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
312
338
313 sparserevlog
339 sparserevlog
314 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
340 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
315
341
316 repository lacks features used by the default config options:
342 repository lacks features used by the default config options:
317
343
318 dotencode
344 dotencode
319 storage of filenames beginning with a period or space may not work correctly
345 storage of filenames beginning with a period or space may not work correctly
320
346
321
347
322 performing an upgrade with "--run" will make the following changes:
348 performing an upgrade with "--run" will make the following changes:
323
349
324 requirements
350 requirements
325 preserved: revlogv1, store
351 preserved: revlogv1, store
326 added: fncache, generaldelta, sparserevlog
352 added: fncache, generaldelta, sparserevlog
327
353
328 fncache
354 fncache
329 repository will be more resilient to storing certain paths and performance of certain operations should be improved
355 repository will be more resilient to storing certain paths and performance of certain operations should be improved
330
356
331 generaldelta
357 generaldelta
332 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
358 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
333
359
334 sparserevlog
360 sparserevlog
335 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
361 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
336
362
363 sidedata
364 Allows storage of extra data alongside a revision.
365
337 additional optimizations are available by specifying "--optimize <name>":
366 additional optimizations are available by specifying "--optimize <name>":
338
367
339 re-delta-parent
368 re-delta-parent
340 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
369 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
341
370
342 re-delta-multibase
371 re-delta-multibase
343 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
372 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
344
373
345 re-delta-all
374 re-delta-all
346 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
375 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
347
376
348 re-delta-fulladd
377 re-delta-fulladd
349 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
378 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
350
379
351
380
352 $ cd ..
381 $ cd ..
353
382
354 Upgrading a repository that is already modern essentially no-ops
383 Upgrading a repository that is already modern essentially no-ops
355
384
356 $ hg init modern
385 $ hg init modern
357 $ hg -R modern debugupgraderepo --run
386 $ hg -R modern debugupgraderepo --run
358 upgrade will perform the following actions:
387 upgrade will perform the following actions:
359
388
360 requirements
389 requirements
361 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
390 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
362
391
392 sidedata
393 Allows storage of extra data alongside a revision.
394
363 beginning upgrade...
395 beginning upgrade...
364 repository locked and read-only
396 repository locked and read-only
365 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
397 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
366 (it is safe to interrupt this process any time before data migration completes)
398 (it is safe to interrupt this process any time before data migration completes)
367 data fully migrated to temporary repository
399 data fully migrated to temporary repository
368 marking source repository as being upgraded; clients will be unable to read from repository
400 marking source repository as being upgraded; clients will be unable to read from repository
369 starting in-place swap of repository data
401 starting in-place swap of repository data
370 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
402 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
371 replacing store...
403 replacing store...
372 store replacement complete; repository was inconsistent for *s (glob)
404 store replacement complete; repository was inconsistent for *s (glob)
373 finalizing requirements file and making repository readable again
405 finalizing requirements file and making repository readable again
374 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
406 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
375 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
407 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
376 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
408 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
377
409
378 Upgrading a repository to generaldelta works
410 Upgrading a repository to generaldelta works
379
411
380 $ hg --config format.usegeneraldelta=false init upgradegd
412 $ hg --config format.usegeneraldelta=false init upgradegd
381 $ cd upgradegd
413 $ cd upgradegd
382 $ touch f0
414 $ touch f0
383 $ hg -q commit -A -m initial
415 $ hg -q commit -A -m initial
384 $ mkdir FooBarDirectory.d
416 $ mkdir FooBarDirectory.d
385 $ touch FooBarDirectory.d/f1
417 $ touch FooBarDirectory.d/f1
386 $ hg -q commit -A -m 'add f1'
418 $ hg -q commit -A -m 'add f1'
387 $ hg -q up -r 0
419 $ hg -q up -r 0
388 >>> from __future__ import absolute_import, print_function
420 >>> from __future__ import absolute_import, print_function
389 >>> import random
421 >>> import random
390 >>> random.seed(0) # have a reproducible content
422 >>> random.seed(0) # have a reproducible content
391 >>> with open("f2", "w") as f:
423 >>> with open("f2", "w") as f:
392 ... for i in range(100000):
424 ... for i in range(100000):
393 ... f.write("%d\n" % random.randint(1000000000, 9999999999)) and None
425 ... f.write("%d\n" % random.randint(1000000000, 9999999999)) and None
394 $ hg -q commit -A -m 'add f2'
426 $ hg -q commit -A -m 'add f2'
395
427
396 make sure we have a .d file
428 make sure we have a .d file
397
429
398 $ ls -d .hg/store/data/*
430 $ ls -d .hg/store/data/*
399 .hg/store/data/_foo_bar_directory.d.hg
431 .hg/store/data/_foo_bar_directory.d.hg
400 .hg/store/data/f0.i
432 .hg/store/data/f0.i
401 .hg/store/data/f2.d
433 .hg/store/data/f2.d
402 .hg/store/data/f2.i
434 .hg/store/data/f2.i
403
435
404 $ hg debugupgraderepo --run --config format.sparse-revlog=false
436 $ hg debugupgraderepo --run --config format.sparse-revlog=false
405 upgrade will perform the following actions:
437 upgrade will perform the following actions:
406
438
407 requirements
439 requirements
408 preserved: dotencode, fncache, revlogv1, store
440 preserved: dotencode, fncache, revlogv1, store
409 added: generaldelta
441 added: generaldelta
410
442
411 generaldelta
443 generaldelta
412 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
444 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
413
445
446 sidedata
447 Allows storage of extra data alongside a revision.
448
414 beginning upgrade...
449 beginning upgrade...
415 repository locked and read-only
450 repository locked and read-only
416 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
451 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
417 (it is safe to interrupt this process any time before data migration completes)
452 (it is safe to interrupt this process any time before data migration completes)
418 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
453 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
419 migrating 519 KB in store; 1.05 MB tracked data
454 migrating 519 KB in store; 1.05 MB tracked data
420 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
455 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
421 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
456 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
422 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
457 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
423 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
458 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
424 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
459 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
425 finished migrating 3 changelog revisions; change in size: 0 bytes
460 finished migrating 3 changelog revisions; change in size: 0 bytes
426 finished migrating 9 total revisions; total change in store size: -17 bytes
461 finished migrating 9 total revisions; total change in store size: -17 bytes
427 copying phaseroots
462 copying phaseroots
428 data fully migrated to temporary repository
463 data fully migrated to temporary repository
429 marking source repository as being upgraded; clients will be unable to read from repository
464 marking source repository as being upgraded; clients will be unable to read from repository
430 starting in-place swap of repository data
465 starting in-place swap of repository data
431 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
466 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
432 replacing store...
467 replacing store...
433 store replacement complete; repository was inconsistent for *s (glob)
468 store replacement complete; repository was inconsistent for *s (glob)
434 finalizing requirements file and making repository readable again
469 finalizing requirements file and making repository readable again
435 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
470 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
436 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
471 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
437 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
472 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
438
473
439 Original requirements backed up
474 Original requirements backed up
440
475
441 $ cat .hg/upgradebackup.*/requires
476 $ cat .hg/upgradebackup.*/requires
442 dotencode
477 dotencode
443 fncache
478 fncache
444 revlogv1
479 revlogv1
445 store
480 store
446
481
447 generaldelta added to original requirements files
482 generaldelta added to original requirements files
448
483
449 $ cat .hg/requires
484 $ cat .hg/requires
450 dotencode
485 dotencode
451 fncache
486 fncache
452 generaldelta
487 generaldelta
453 revlogv1
488 revlogv1
454 store
489 store
455
490
456 store directory has files we expect
491 store directory has files we expect
457
492
458 $ ls .hg/store
493 $ ls .hg/store
459 00changelog.i
494 00changelog.i
460 00manifest.i
495 00manifest.i
461 data
496 data
462 fncache
497 fncache
463 phaseroots
498 phaseroots
464 undo
499 undo
465 undo.backupfiles
500 undo.backupfiles
466 undo.phaseroots
501 undo.phaseroots
467
502
468 manifest should be generaldelta
503 manifest should be generaldelta
469
504
470 $ hg debugrevlog -m | grep flags
505 $ hg debugrevlog -m | grep flags
471 flags : inline, generaldelta
506 flags : inline, generaldelta
472
507
473 verify should be happy
508 verify should be happy
474
509
475 $ hg verify
510 $ hg verify
476 checking changesets
511 checking changesets
477 checking manifests
512 checking manifests
478 crosschecking files in changesets and manifests
513 crosschecking files in changesets and manifests
479 checking files
514 checking files
480 checked 3 changesets with 3 changes to 3 files
515 checked 3 changesets with 3 changes to 3 files
481
516
482 old store should be backed up
517 old store should be backed up
483
518
484 $ ls -d .hg/upgradebackup.*/
519 $ ls -d .hg/upgradebackup.*/
485 .hg/upgradebackup.*/ (glob)
520 .hg/upgradebackup.*/ (glob)
486 $ ls .hg/upgradebackup.*/store
521 $ ls .hg/upgradebackup.*/store
487 00changelog.i
522 00changelog.i
488 00manifest.i
523 00manifest.i
489 data
524 data
490 fncache
525 fncache
491 phaseroots
526 phaseroots
492 undo
527 undo
493 undo.backup.fncache
528 undo.backup.fncache
494 undo.backupfiles
529 undo.backupfiles
495 undo.phaseroots
530 undo.phaseroots
496
531
497 unless --no-backup is passed
532 unless --no-backup is passed
498
533
499 $ rm -rf .hg/upgradebackup.*/
534 $ rm -rf .hg/upgradebackup.*/
500 $ hg debugupgraderepo --run --no-backup
535 $ hg debugupgraderepo --run --no-backup
501 upgrade will perform the following actions:
536 upgrade will perform the following actions:
502
537
503 requirements
538 requirements
504 preserved: dotencode, fncache, generaldelta, revlogv1, store
539 preserved: dotencode, fncache, generaldelta, revlogv1, store
505 added: sparserevlog
540 added: sparserevlog
506
541
507 sparserevlog
542 sparserevlog
508 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
543 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
509
544
545 sidedata
546 Allows storage of extra data alongside a revision.
547
510 beginning upgrade...
548 beginning upgrade...
511 repository locked and read-only
549 repository locked and read-only
512 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
550 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
513 (it is safe to interrupt this process any time before data migration completes)
551 (it is safe to interrupt this process any time before data migration completes)
514 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
552 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
515 migrating 519 KB in store; 1.05 MB tracked data
553 migrating 519 KB in store; 1.05 MB tracked data
516 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
554 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
517 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
555 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
518 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
556 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
519 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
557 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
520 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
558 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
521 finished migrating 3 changelog revisions; change in size: 0 bytes
559 finished migrating 3 changelog revisions; change in size: 0 bytes
522 finished migrating 9 total revisions; total change in store size: 0 bytes
560 finished migrating 9 total revisions; total change in store size: 0 bytes
523 copying phaseroots
561 copying phaseroots
524 data fully migrated to temporary repository
562 data fully migrated to temporary repository
525 marking source repository as being upgraded; clients will be unable to read from repository
563 marking source repository as being upgraded; clients will be unable to read from repository
526 starting in-place swap of repository data
564 starting in-place swap of repository data
527 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
565 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
528 replacing store...
566 replacing store...
529 store replacement complete; repository was inconsistent for * (glob)
567 store replacement complete; repository was inconsistent for * (glob)
530 finalizing requirements file and making repository readable again
568 finalizing requirements file and making repository readable again
531 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
569 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
532 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
570 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
533 $ ls -1 .hg/ | grep upgradebackup
571 $ ls -1 .hg/ | grep upgradebackup
534 [1]
572 [1]
535
573
536 We can restrict optimization to some revlog:
574 We can restrict optimization to some revlog:
537
575
538 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
576 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
539 upgrade will perform the following actions:
577 upgrade will perform the following actions:
540
578
541 requirements
579 requirements
542 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
580 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
543
581
582 sidedata
583 Allows storage of extra data alongside a revision.
584
544 re-delta-parent
585 re-delta-parent
545 deltas within internal storage will choose a new base revision if needed
586 deltas within internal storage will choose a new base revision if needed
546
587
547 beginning upgrade...
588 beginning upgrade...
548 repository locked and read-only
589 repository locked and read-only
549 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
590 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
550 (it is safe to interrupt this process any time before data migration completes)
591 (it is safe to interrupt this process any time before data migration completes)
551 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
592 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
552 migrating 519 KB in store; 1.05 MB tracked data
593 migrating 519 KB in store; 1.05 MB tracked data
553 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
594 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
554 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
595 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
555 blindly copying data/f0.i containing 1 revisions
596 blindly copying data/f0.i containing 1 revisions
556 blindly copying data/f2.i containing 1 revisions
597 blindly copying data/f2.i containing 1 revisions
557 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
598 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
558 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
599 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
559 cloning 3 revisions from 00manifest.i
600 cloning 3 revisions from 00manifest.i
560 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
601 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
561 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
602 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
562 blindly copying 00changelog.i containing 3 revisions
603 blindly copying 00changelog.i containing 3 revisions
563 finished migrating 3 changelog revisions; change in size: 0 bytes
604 finished migrating 3 changelog revisions; change in size: 0 bytes
564 finished migrating 9 total revisions; total change in store size: 0 bytes
605 finished migrating 9 total revisions; total change in store size: 0 bytes
565 copying phaseroots
606 copying phaseroots
566 data fully migrated to temporary repository
607 data fully migrated to temporary repository
567 marking source repository as being upgraded; clients will be unable to read from repository
608 marking source repository as being upgraded; clients will be unable to read from repository
568 starting in-place swap of repository data
609 starting in-place swap of repository data
569 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
610 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
570 replacing store...
611 replacing store...
571 store replacement complete; repository was inconsistent for *s (glob)
612 store replacement complete; repository was inconsistent for *s (glob)
572 finalizing requirements file and making repository readable again
613 finalizing requirements file and making repository readable again
573 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
614 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
574 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
615 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
575
616
576 Check that the repo still works fine
617 Check that the repo still works fine
577
618
578 $ hg log -G --stat
619 $ hg log -G --stat
579 @ changeset: 2:76d4395f5413
620 @ changeset: 2:76d4395f5413
580 | tag: tip
621 | tag: tip
581 | parent: 0:ba592bf28da2
622 | parent: 0:ba592bf28da2
582 | user: test
623 | user: test
583 | date: Thu Jan 01 00:00:00 1970 +0000
624 | date: Thu Jan 01 00:00:00 1970 +0000
584 | summary: add f2
625 | summary: add f2
585 |
626 |
586 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
627 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
587 | 1 files changed, 100000 insertions(+), 0 deletions(-)
628 | 1 files changed, 100000 insertions(+), 0 deletions(-)
588 |
629 |
589 | o changeset: 1:2029ce2354e2
630 | o changeset: 1:2029ce2354e2
590 |/ user: test
631 |/ user: test
591 | date: Thu Jan 01 00:00:00 1970 +0000
632 | date: Thu Jan 01 00:00:00 1970 +0000
592 | summary: add f1
633 | summary: add f1
593 |
634 |
594 |
635 |
595 o changeset: 0:ba592bf28da2
636 o changeset: 0:ba592bf28da2
596 user: test
637 user: test
597 date: Thu Jan 01 00:00:00 1970 +0000
638 date: Thu Jan 01 00:00:00 1970 +0000
598 summary: initial
639 summary: initial
599
640
600
641
601
642
602 $ hg verify
643 $ hg verify
603 checking changesets
644 checking changesets
604 checking manifests
645 checking manifests
605 crosschecking files in changesets and manifests
646 crosschecking files in changesets and manifests
606 checking files
647 checking files
607 checked 3 changesets with 3 changes to 3 files
648 checked 3 changesets with 3 changes to 3 files
608
649
609 Check we can select negatively
650 Check we can select negatively
610
651
611 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
652 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
612 upgrade will perform the following actions:
653 upgrade will perform the following actions:
613
654
614 requirements
655 requirements
615 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
656 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
616
657
658 sidedata
659 Allows storage of extra data alongside a revision.
660
617 re-delta-parent
661 re-delta-parent
618 deltas within internal storage will choose a new base revision if needed
662 deltas within internal storage will choose a new base revision if needed
619
663
620 beginning upgrade...
664 beginning upgrade...
621 repository locked and read-only
665 repository locked and read-only
622 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
666 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
623 (it is safe to interrupt this process any time before data migration completes)
667 (it is safe to interrupt this process any time before data migration completes)
624 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
668 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
625 migrating 519 KB in store; 1.05 MB tracked data
669 migrating 519 KB in store; 1.05 MB tracked data
626 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
670 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
627 cloning 1 revisions from data/FooBarDirectory.d/f1.i
671 cloning 1 revisions from data/FooBarDirectory.d/f1.i
628 cloning 1 revisions from data/f0.i
672 cloning 1 revisions from data/f0.i
629 cloning 1 revisions from data/f2.i
673 cloning 1 revisions from data/f2.i
630 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
674 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
631 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
675 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
632 blindly copying 00manifest.i containing 3 revisions
676 blindly copying 00manifest.i containing 3 revisions
633 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
677 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
634 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
678 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
635 cloning 3 revisions from 00changelog.i
679 cloning 3 revisions from 00changelog.i
636 finished migrating 3 changelog revisions; change in size: 0 bytes
680 finished migrating 3 changelog revisions; change in size: 0 bytes
637 finished migrating 9 total revisions; total change in store size: 0 bytes
681 finished migrating 9 total revisions; total change in store size: 0 bytes
638 copying phaseroots
682 copying phaseroots
639 data fully migrated to temporary repository
683 data fully migrated to temporary repository
640 marking source repository as being upgraded; clients will be unable to read from repository
684 marking source repository as being upgraded; clients will be unable to read from repository
641 starting in-place swap of repository data
685 starting in-place swap of repository data
642 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
686 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
643 replacing store...
687 replacing store...
644 store replacement complete; repository was inconsistent for *s (glob)
688 store replacement complete; repository was inconsistent for *s (glob)
645 finalizing requirements file and making repository readable again
689 finalizing requirements file and making repository readable again
646 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
690 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
647 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
691 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
648 $ hg verify
692 $ hg verify
649 checking changesets
693 checking changesets
650 checking manifests
694 checking manifests
651 crosschecking files in changesets and manifests
695 crosschecking files in changesets and manifests
652 checking files
696 checking files
653 checked 3 changesets with 3 changes to 3 files
697 checked 3 changesets with 3 changes to 3 files
654
698
655 Check that we can select changelog only
699 Check that we can select changelog only
656
700
657 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
701 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
658 upgrade will perform the following actions:
702 upgrade will perform the following actions:
659
703
660 requirements
704 requirements
661 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
705 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
662
706
707 sidedata
708 Allows storage of extra data alongside a revision.
709
663 re-delta-parent
710 re-delta-parent
664 deltas within internal storage will choose a new base revision if needed
711 deltas within internal storage will choose a new base revision if needed
665
712
666 beginning upgrade...
713 beginning upgrade...
667 repository locked and read-only
714 repository locked and read-only
668 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
715 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
669 (it is safe to interrupt this process any time before data migration completes)
716 (it is safe to interrupt this process any time before data migration completes)
670 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
717 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
671 migrating 519 KB in store; 1.05 MB tracked data
718 migrating 519 KB in store; 1.05 MB tracked data
672 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
719 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
673 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
720 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
674 blindly copying data/f0.i containing 1 revisions
721 blindly copying data/f0.i containing 1 revisions
675 blindly copying data/f2.i containing 1 revisions
722 blindly copying data/f2.i containing 1 revisions
676 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
723 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
677 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
724 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
678 blindly copying 00manifest.i containing 3 revisions
725 blindly copying 00manifest.i containing 3 revisions
679 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
726 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
680 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
727 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
681 cloning 3 revisions from 00changelog.i
728 cloning 3 revisions from 00changelog.i
682 finished migrating 3 changelog revisions; change in size: 0 bytes
729 finished migrating 3 changelog revisions; change in size: 0 bytes
683 finished migrating 9 total revisions; total change in store size: 0 bytes
730 finished migrating 9 total revisions; total change in store size: 0 bytes
684 copying phaseroots
731 copying phaseroots
685 data fully migrated to temporary repository
732 data fully migrated to temporary repository
686 marking source repository as being upgraded; clients will be unable to read from repository
733 marking source repository as being upgraded; clients will be unable to read from repository
687 starting in-place swap of repository data
734 starting in-place swap of repository data
688 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
735 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
689 replacing store...
736 replacing store...
690 store replacement complete; repository was inconsistent for *s (glob)
737 store replacement complete; repository was inconsistent for *s (glob)
691 finalizing requirements file and making repository readable again
738 finalizing requirements file and making repository readable again
692 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
739 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
693 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
740 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
694 $ hg verify
741 $ hg verify
695 checking changesets
742 checking changesets
696 checking manifests
743 checking manifests
697 crosschecking files in changesets and manifests
744 crosschecking files in changesets and manifests
698 checking files
745 checking files
699 checked 3 changesets with 3 changes to 3 files
746 checked 3 changesets with 3 changes to 3 files
700
747
701 Check that we can select filelog only
748 Check that we can select filelog only
702
749
703 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
750 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
704 upgrade will perform the following actions:
751 upgrade will perform the following actions:
705
752
706 requirements
753 requirements
707 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
754 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
708
755
756 sidedata
757 Allows storage of extra data alongside a revision.
758
709 re-delta-parent
759 re-delta-parent
710 deltas within internal storage will choose a new base revision if needed
760 deltas within internal storage will choose a new base revision if needed
711
761
712 beginning upgrade...
762 beginning upgrade...
713 repository locked and read-only
763 repository locked and read-only
714 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
764 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
715 (it is safe to interrupt this process any time before data migration completes)
765 (it is safe to interrupt this process any time before data migration completes)
716 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
766 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
717 migrating 519 KB in store; 1.05 MB tracked data
767 migrating 519 KB in store; 1.05 MB tracked data
718 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
768 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
719 cloning 1 revisions from data/FooBarDirectory.d/f1.i
769 cloning 1 revisions from data/FooBarDirectory.d/f1.i
720 cloning 1 revisions from data/f0.i
770 cloning 1 revisions from data/f0.i
721 cloning 1 revisions from data/f2.i
771 cloning 1 revisions from data/f2.i
722 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
772 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
723 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
773 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
724 blindly copying 00manifest.i containing 3 revisions
774 blindly copying 00manifest.i containing 3 revisions
725 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
775 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
726 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
776 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
727 blindly copying 00changelog.i containing 3 revisions
777 blindly copying 00changelog.i containing 3 revisions
728 finished migrating 3 changelog revisions; change in size: 0 bytes
778 finished migrating 3 changelog revisions; change in size: 0 bytes
729 finished migrating 9 total revisions; total change in store size: 0 bytes
779 finished migrating 9 total revisions; total change in store size: 0 bytes
730 copying phaseroots
780 copying phaseroots
731 data fully migrated to temporary repository
781 data fully migrated to temporary repository
732 marking source repository as being upgraded; clients will be unable to read from repository
782 marking source repository as being upgraded; clients will be unable to read from repository
733 starting in-place swap of repository data
783 starting in-place swap of repository data
734 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
784 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
735 replacing store...
785 replacing store...
736 store replacement complete; repository was inconsistent for *s (glob)
786 store replacement complete; repository was inconsistent for *s (glob)
737 finalizing requirements file and making repository readable again
787 finalizing requirements file and making repository readable again
738 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
788 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
739 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
789 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
740 $ hg verify
790 $ hg verify
741 checking changesets
791 checking changesets
742 checking manifests
792 checking manifests
743 crosschecking files in changesets and manifests
793 crosschecking files in changesets and manifests
744 checking files
794 checking files
745 checked 3 changesets with 3 changes to 3 files
795 checked 3 changesets with 3 changes to 3 files
746
796
747
797
748 Check you can't skip revlog clone during important format downgrade
798 Check you can't skip revlog clone during important format downgrade
749
799
750 $ echo "[format]" > .hg/hgrc
800 $ echo "[format]" > .hg/hgrc
751 $ echo "sparse-revlog=no" >> .hg/hgrc
801 $ echo "sparse-revlog=no" >> .hg/hgrc
752 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
802 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
753 ignoring revlogs selection flags, format requirements change: sparserevlog
803 ignoring revlogs selection flags, format requirements change: sparserevlog
754 upgrade will perform the following actions:
804 upgrade will perform the following actions:
755
805
756 requirements
806 requirements
757 preserved: dotencode, fncache, generaldelta, revlogv1, store
807 preserved: dotencode, fncache, generaldelta, revlogv1, store
758 removed: sparserevlog
808 removed: sparserevlog
759
809
810 sidedata
811 Allows storage of extra data alongside a revision.
812
760 re-delta-parent
813 re-delta-parent
761 deltas within internal storage will choose a new base revision if needed
814 deltas within internal storage will choose a new base revision if needed
762
815
763 beginning upgrade...
816 beginning upgrade...
764 repository locked and read-only
817 repository locked and read-only
765 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
818 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
766 (it is safe to interrupt this process any time before data migration completes)
819 (it is safe to interrupt this process any time before data migration completes)
767 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
820 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
768 migrating 519 KB in store; 1.05 MB tracked data
821 migrating 519 KB in store; 1.05 MB tracked data
769 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
822 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
770 cloning 1 revisions from data/FooBarDirectory.d/f1.i
823 cloning 1 revisions from data/FooBarDirectory.d/f1.i
771 cloning 1 revisions from data/f0.i
824 cloning 1 revisions from data/f0.i
772 cloning 1 revisions from data/f2.i
825 cloning 1 revisions from data/f2.i
773 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
826 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
774 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
827 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
775 cloning 3 revisions from 00manifest.i
828 cloning 3 revisions from 00manifest.i
776 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
829 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
777 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
830 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
778 cloning 3 revisions from 00changelog.i
831 cloning 3 revisions from 00changelog.i
779 finished migrating 3 changelog revisions; change in size: 0 bytes
832 finished migrating 3 changelog revisions; change in size: 0 bytes
780 finished migrating 9 total revisions; total change in store size: 0 bytes
833 finished migrating 9 total revisions; total change in store size: 0 bytes
781 copying phaseroots
834 copying phaseroots
782 data fully migrated to temporary repository
835 data fully migrated to temporary repository
783 marking source repository as being upgraded; clients will be unable to read from repository
836 marking source repository as being upgraded; clients will be unable to read from repository
784 starting in-place swap of repository data
837 starting in-place swap of repository data
785 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
838 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
786 replacing store...
839 replacing store...
787 store replacement complete; repository was inconsistent for *s (glob)
840 store replacement complete; repository was inconsistent for *s (glob)
788 finalizing requirements file and making repository readable again
841 finalizing requirements file and making repository readable again
789 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
842 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
790 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
843 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
791 $ hg verify
844 $ hg verify
792 checking changesets
845 checking changesets
793 checking manifests
846 checking manifests
794 crosschecking files in changesets and manifests
847 crosschecking files in changesets and manifests
795 checking files
848 checking files
796 checked 3 changesets with 3 changes to 3 files
849 checked 3 changesets with 3 changes to 3 files
797
850
798 Check you can't skip revlog clone during important format upgrade
851 Check you can't skip revlog clone during important format upgrade
799
852
800 $ echo "sparse-revlog=yes" >> .hg/hgrc
853 $ echo "sparse-revlog=yes" >> .hg/hgrc
801 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
854 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
802 ignoring revlogs selection flags, format requirements change: sparserevlog
855 ignoring revlogs selection flags, format requirements change: sparserevlog
803 upgrade will perform the following actions:
856 upgrade will perform the following actions:
804
857
805 requirements
858 requirements
806 preserved: dotencode, fncache, generaldelta, revlogv1, store
859 preserved: dotencode, fncache, generaldelta, revlogv1, store
807 added: sparserevlog
860 added: sparserevlog
808
861
809 sparserevlog
862 sparserevlog
810 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
863 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
811
864
865 sidedata
866 Allows storage of extra data alongside a revision.
867
812 re-delta-parent
868 re-delta-parent
813 deltas within internal storage will choose a new base revision if needed
869 deltas within internal storage will choose a new base revision if needed
814
870
815 beginning upgrade...
871 beginning upgrade...
816 repository locked and read-only
872 repository locked and read-only
817 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
873 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
818 (it is safe to interrupt this process any time before data migration completes)
874 (it is safe to interrupt this process any time before data migration completes)
819 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
875 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
820 migrating 519 KB in store; 1.05 MB tracked data
876 migrating 519 KB in store; 1.05 MB tracked data
821 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
877 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
822 cloning 1 revisions from data/FooBarDirectory.d/f1.i
878 cloning 1 revisions from data/FooBarDirectory.d/f1.i
823 cloning 1 revisions from data/f0.i
879 cloning 1 revisions from data/f0.i
824 cloning 1 revisions from data/f2.i
880 cloning 1 revisions from data/f2.i
825 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
881 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
826 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
882 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
827 cloning 3 revisions from 00manifest.i
883 cloning 3 revisions from 00manifest.i
828 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
884 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
829 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
885 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
830 cloning 3 revisions from 00changelog.i
886 cloning 3 revisions from 00changelog.i
831 finished migrating 3 changelog revisions; change in size: 0 bytes
887 finished migrating 3 changelog revisions; change in size: 0 bytes
832 finished migrating 9 total revisions; total change in store size: 0 bytes
888 finished migrating 9 total revisions; total change in store size: 0 bytes
833 copying phaseroots
889 copying phaseroots
834 data fully migrated to temporary repository
890 data fully migrated to temporary repository
835 marking source repository as being upgraded; clients will be unable to read from repository
891 marking source repository as being upgraded; clients will be unable to read from repository
836 starting in-place swap of repository data
892 starting in-place swap of repository data
837 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
893 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
838 replacing store...
894 replacing store...
839 store replacement complete; repository was inconsistent for *s (glob)
895 store replacement complete; repository was inconsistent for *s (glob)
840 finalizing requirements file and making repository readable again
896 finalizing requirements file and making repository readable again
841 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
897 removing old repository content$TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
842 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
898 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
843 $ hg verify
899 $ hg verify
844 checking changesets
900 checking changesets
845 checking manifests
901 checking manifests
846 crosschecking files in changesets and manifests
902 crosschecking files in changesets and manifests
847 checking files
903 checking files
848 checked 3 changesets with 3 changes to 3 files
904 checked 3 changesets with 3 changes to 3 files
849
905
850 $ cd ..
906 $ cd ..
851
907
852 store files with special filenames aren't encoded during copy
908 store files with special filenames aren't encoded during copy
853
909
854 $ hg init store-filenames
910 $ hg init store-filenames
855 $ cd store-filenames
911 $ cd store-filenames
856 $ touch foo
912 $ touch foo
857 $ hg -q commit -A -m initial
913 $ hg -q commit -A -m initial
858 $ touch .hg/store/.XX_special_filename
914 $ touch .hg/store/.XX_special_filename
859
915
860 $ hg debugupgraderepo --run
916 $ hg debugupgraderepo --run
861 upgrade will perform the following actions:
917 upgrade will perform the following actions:
862
918
863 requirements
919 requirements
864 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
920 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
865
921
922 sidedata
923 Allows storage of extra data alongside a revision.
924
866 beginning upgrade...
925 beginning upgrade...
867 repository locked and read-only
926 repository locked and read-only
868 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
927 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
869 (it is safe to interrupt this process any time before data migration completes)
928 (it is safe to interrupt this process any time before data migration completes)
870 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
929 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
871 migrating 301 bytes in store; 107 bytes tracked data
930 migrating 301 bytes in store; 107 bytes tracked data
872 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
931 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
873 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
932 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
874 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
933 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
875 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
934 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
876 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
935 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
877 finished migrating 1 changelog revisions; change in size: 0 bytes
936 finished migrating 1 changelog revisions; change in size: 0 bytes
878 finished migrating 3 total revisions; total change in store size: 0 bytes
937 finished migrating 3 total revisions; total change in store size: 0 bytes
879 copying .XX_special_filename
938 copying .XX_special_filename
880 copying phaseroots
939 copying phaseroots
881 data fully migrated to temporary repository
940 data fully migrated to temporary repository
882 marking source repository as being upgraded; clients will be unable to read from repository
941 marking source repository as being upgraded; clients will be unable to read from repository
883 starting in-place swap of repository data
942 starting in-place swap of repository data
884 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
943 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
885 replacing store...
944 replacing store...
886 store replacement complete; repository was inconsistent for *s (glob)
945 store replacement complete; repository was inconsistent for *s (glob)
887 finalizing requirements file and making repository readable again
946 finalizing requirements file and making repository readable again
888 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
947 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
889 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
948 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
890 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
949 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
891 $ hg debugupgraderepo --run --optimize redeltafulladd
950 $ hg debugupgraderepo --run --optimize redeltafulladd
892 upgrade will perform the following actions:
951 upgrade will perform the following actions:
893
952
894 requirements
953 requirements
895 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
954 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
896
955
956 sidedata
957 Allows storage of extra data alongside a revision.
958
897 re-delta-fulladd
959 re-delta-fulladd
898 each revision will be added as new content to the internal storage; this will likely drastically slow down execution time, but some extensions might need it
960 each revision will be added as new content to the internal storage; this will likely drastically slow down execution time, but some extensions might need it
899
961
900 beginning upgrade...
962 beginning upgrade...
901 repository locked and read-only
963 repository locked and read-only
902 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
964 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
903 (it is safe to interrupt this process any time before data migration completes)
965 (it is safe to interrupt this process any time before data migration completes)
904 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
966 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
905 migrating 301 bytes in store; 107 bytes tracked data
967 migrating 301 bytes in store; 107 bytes tracked data
906 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
968 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
907 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
969 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
908 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
970 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
909 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
971 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
910 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
972 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
911 finished migrating 1 changelog revisions; change in size: 0 bytes
973 finished migrating 1 changelog revisions; change in size: 0 bytes
912 finished migrating 3 total revisions; total change in store size: 0 bytes
974 finished migrating 3 total revisions; total change in store size: 0 bytes
913 copying .XX_special_filename
975 copying .XX_special_filename
914 copying phaseroots
976 copying phaseroots
915 data fully migrated to temporary repository
977 data fully migrated to temporary repository
916 marking source repository as being upgraded; clients will be unable to read from repository
978 marking source repository as being upgraded; clients will be unable to read from repository
917 starting in-place swap of repository data
979 starting in-place swap of repository data
918 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
980 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
919 replacing store...
981 replacing store...
920 store replacement complete; repository was inconsistent for *s (glob)
982 store replacement complete; repository was inconsistent for *s (glob)
921 finalizing requirements file and making repository readable again
983 finalizing requirements file and making repository readable again
922 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
984 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
923 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
985 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
924 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
986 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
925
987
926 fncache is valid after upgrade
988 fncache is valid after upgrade
927
989
928 $ hg debugrebuildfncache
990 $ hg debugrebuildfncache
929 fncache already up to date
991 fncache already up to date
930
992
931 $ cd ..
993 $ cd ..
932
994
933 Check upgrading a large file repository
995 Check upgrading a large file repository
934 ---------------------------------------
996 ---------------------------------------
935
997
936 $ hg init largefilesrepo
998 $ hg init largefilesrepo
937 $ cat << EOF >> largefilesrepo/.hg/hgrc
999 $ cat << EOF >> largefilesrepo/.hg/hgrc
938 > [extensions]
1000 > [extensions]
939 > largefiles =
1001 > largefiles =
940 > EOF
1002 > EOF
941
1003
942 $ cd largefilesrepo
1004 $ cd largefilesrepo
943 $ touch foo
1005 $ touch foo
944 $ hg add --large foo
1006 $ hg add --large foo
945 $ hg -q commit -m initial
1007 $ hg -q commit -m initial
946 $ cat .hg/requires
1008 $ cat .hg/requires
947 dotencode
1009 dotencode
948 fncache
1010 fncache
949 generaldelta
1011 generaldelta
950 largefiles
1012 largefiles
951 revlogv1
1013 revlogv1
952 sparserevlog
1014 sparserevlog
953 store
1015 store
954
1016
955 $ hg debugupgraderepo --run
1017 $ hg debugupgraderepo --run
956 upgrade will perform the following actions:
1018 upgrade will perform the following actions:
957
1019
958 requirements
1020 requirements
959 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
1021 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
960
1022
1023 sidedata
1024 Allows storage of extra data alongside a revision.
1025
961 beginning upgrade...
1026 beginning upgrade...
962 repository locked and read-only
1027 repository locked and read-only
963 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1028 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
964 (it is safe to interrupt this process any time before data migration completes)
1029 (it is safe to interrupt this process any time before data migration completes)
965 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1030 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
966 migrating 355 bytes in store; 160 bytes tracked data
1031 migrating 355 bytes in store; 160 bytes tracked data
967 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
1032 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
968 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1033 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
969 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
1034 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
970 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1035 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
971 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
1036 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
972 finished migrating 1 changelog revisions; change in size: 0 bytes
1037 finished migrating 1 changelog revisions; change in size: 0 bytes
973 finished migrating 3 total revisions; total change in store size: 0 bytes
1038 finished migrating 3 total revisions; total change in store size: 0 bytes
974 copying phaseroots
1039 copying phaseroots
975 data fully migrated to temporary repository
1040 data fully migrated to temporary repository
976 marking source repository as being upgraded; clients will be unable to read from repository
1041 marking source repository as being upgraded; clients will be unable to read from repository
977 starting in-place swap of repository data
1042 starting in-place swap of repository data
978 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1043 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
979 replacing store...
1044 replacing store...
980 store replacement complete; repository was inconsistent for *s (glob)
1045 store replacement complete; repository was inconsistent for *s (glob)
981 finalizing requirements file and making repository readable again
1046 finalizing requirements file and making repository readable again
982 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1047 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
983 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1048 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
984 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1049 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
985 $ cat .hg/requires
1050 $ cat .hg/requires
986 dotencode
1051 dotencode
987 fncache
1052 fncache
988 generaldelta
1053 generaldelta
989 largefiles
1054 largefiles
990 revlogv1
1055 revlogv1
991 sparserevlog
1056 sparserevlog
992 store
1057 store
993
1058
994 $ cat << EOF >> .hg/hgrc
1059 $ cat << EOF >> .hg/hgrc
995 > [extensions]
1060 > [extensions]
996 > lfs =
1061 > lfs =
997 > [lfs]
1062 > [lfs]
998 > threshold = 10
1063 > threshold = 10
999 > EOF
1064 > EOF
1000 $ echo '123456789012345' > lfs.bin
1065 $ echo '123456789012345' > lfs.bin
1001 $ hg ci -Am 'lfs.bin'
1066 $ hg ci -Am 'lfs.bin'
1002 adding lfs.bin
1067 adding lfs.bin
1003 $ grep lfs .hg/requires
1068 $ grep lfs .hg/requires
1004 lfs
1069 lfs
1005 $ find .hg/store/lfs -type f
1070 $ find .hg/store/lfs -type f
1006 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1071 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1007
1072
1008 $ hg debugupgraderepo --run
1073 $ hg debugupgraderepo --run
1009 upgrade will perform the following actions:
1074 upgrade will perform the following actions:
1010
1075
1011 requirements
1076 requirements
1012 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1077 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1013
1078
1079 sidedata
1080 Allows storage of extra data alongside a revision.
1081
1014 beginning upgrade...
1082 beginning upgrade...
1015 repository locked and read-only
1083 repository locked and read-only
1016 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1084 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1017 (it is safe to interrupt this process any time before data migration completes)
1085 (it is safe to interrupt this process any time before data migration completes)
1018 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1086 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1019 migrating 801 bytes in store; 467 bytes tracked data
1087 migrating 801 bytes in store; 467 bytes tracked data
1020 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1088 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1021 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1089 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1022 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1090 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1023 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1091 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1024 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1092 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1025 finished migrating 2 changelog revisions; change in size: 0 bytes
1093 finished migrating 2 changelog revisions; change in size: 0 bytes
1026 finished migrating 6 total revisions; total change in store size: 0 bytes
1094 finished migrating 6 total revisions; total change in store size: 0 bytes
1027 copying phaseroots
1095 copying phaseroots
1028 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1096 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1029 data fully migrated to temporary repository
1097 data fully migrated to temporary repository
1030 marking source repository as being upgraded; clients will be unable to read from repository
1098 marking source repository as being upgraded; clients will be unable to read from repository
1031 starting in-place swap of repository data
1099 starting in-place swap of repository data
1032 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1100 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1033 replacing store...
1101 replacing store...
1034 store replacement complete; repository was inconsistent for *s (glob)
1102 store replacement complete; repository was inconsistent for *s (glob)
1035 finalizing requirements file and making repository readable again
1103 finalizing requirements file and making repository readable again
1036 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1104 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1037 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1105 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1038 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1106 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1039
1107
1040 $ grep lfs .hg/requires
1108 $ grep lfs .hg/requires
1041 lfs
1109 lfs
1042 $ find .hg/store/lfs -type f
1110 $ find .hg/store/lfs -type f
1043 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1111 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1044 $ hg verify
1112 $ hg verify
1045 checking changesets
1113 checking changesets
1046 checking manifests
1114 checking manifests
1047 crosschecking files in changesets and manifests
1115 crosschecking files in changesets and manifests
1048 checking files
1116 checking files
1049 checked 2 changesets with 2 changes to 2 files
1117 checked 2 changesets with 2 changes to 2 files
1050 $ hg debugdata lfs.bin 0
1118 $ hg debugdata lfs.bin 0
1051 version https://git-lfs.github.com/spec/v1
1119 version https://git-lfs.github.com/spec/v1
1052 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1120 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1053 size 16
1121 size 16
1054 x-is-binary 0
1122 x-is-binary 0
1055
1123
1056 $ cd ..
1124 $ cd ..
1057
1125
1058 repository config is taken in account
1126 repository config is taken in account
1059 -------------------------------------
1127 -------------------------------------
1060
1128
1061 $ cat << EOF >> $HGRCPATH
1129 $ cat << EOF >> $HGRCPATH
1062 > [format]
1130 > [format]
1063 > maxchainlen = 1
1131 > maxchainlen = 1
1064 > EOF
1132 > EOF
1065
1133
1066 $ hg init localconfig
1134 $ hg init localconfig
1067 $ cd localconfig
1135 $ cd localconfig
1068 $ cat << EOF > file
1136 $ cat << EOF > file
1069 > some content
1137 > some content
1070 > with some length
1138 > with some length
1071 > to make sure we get a delta
1139 > to make sure we get a delta
1072 > after changes
1140 > after changes
1073 > very long
1141 > very long
1074 > very long
1142 > very long
1075 > very long
1143 > very long
1076 > very long
1144 > very long
1077 > very long
1145 > very long
1078 > very long
1146 > very long
1079 > very long
1147 > very long
1080 > very long
1148 > very long
1081 > very long
1149 > very long
1082 > very long
1150 > very long
1083 > very long
1151 > very long
1084 > EOF
1152 > EOF
1085 $ hg -q commit -A -m A
1153 $ hg -q commit -A -m A
1086 $ echo "new line" >> file
1154 $ echo "new line" >> file
1087 $ hg -q commit -m B
1155 $ hg -q commit -m B
1088 $ echo "new line" >> file
1156 $ echo "new line" >> file
1089 $ hg -q commit -m C
1157 $ hg -q commit -m C
1090
1158
1091 $ cat << EOF >> .hg/hgrc
1159 $ cat << EOF >> .hg/hgrc
1092 > [format]
1160 > [format]
1093 > maxchainlen = 9001
1161 > maxchainlen = 9001
1094 > EOF
1162 > EOF
1095 $ hg config format
1163 $ hg config format
1096 format.maxchainlen=9001
1164 format.maxchainlen=9001
1097 $ hg debugdeltachain file
1165 $ hg debugdeltachain file
1098 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1166 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1099 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1167 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1100 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1168 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1101 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1169 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1102
1170
1103 $ hg debugupgraderepo --run --optimize redeltaall
1171 $ hg debugupgraderepo --run --optimize redeltaall
1104 upgrade will perform the following actions:
1172 upgrade will perform the following actions:
1105
1173
1106 requirements
1174 requirements
1107 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1175 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1108
1176
1177 sidedata
1178 Allows storage of extra data alongside a revision.
1179
1109 re-delta-all
1180 re-delta-all
1110 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1181 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1111
1182
1112 beginning upgrade...
1183 beginning upgrade...
1113 repository locked and read-only
1184 repository locked and read-only
1114 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1185 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1115 (it is safe to interrupt this process any time before data migration completes)
1186 (it is safe to interrupt this process any time before data migration completes)
1116 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1187 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1117 migrating 1019 bytes in store; 882 bytes tracked data
1188 migrating 1019 bytes in store; 882 bytes tracked data
1118 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1189 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1119 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1190 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1120 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1191 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1121 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1192 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1122 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1193 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1123 finished migrating 3 changelog revisions; change in size: 0 bytes
1194 finished migrating 3 changelog revisions; change in size: 0 bytes
1124 finished migrating 9 total revisions; total change in store size: -9 bytes
1195 finished migrating 9 total revisions; total change in store size: -9 bytes
1125 copying phaseroots
1196 copying phaseroots
1126 data fully migrated to temporary repository
1197 data fully migrated to temporary repository
1127 marking source repository as being upgraded; clients will be unable to read from repository
1198 marking source repository as being upgraded; clients will be unable to read from repository
1128 starting in-place swap of repository data
1199 starting in-place swap of repository data
1129 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1200 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1130 replacing store...
1201 replacing store...
1131 store replacement complete; repository was inconsistent for *s (glob)
1202 store replacement complete; repository was inconsistent for *s (glob)
1132 finalizing requirements file and making repository readable again
1203 finalizing requirements file and making repository readable again
1133 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1204 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1134 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1205 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1135 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1206 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1136 $ hg debugdeltachain file
1207 $ hg debugdeltachain file
1137 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1208 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1138 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1209 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1139 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1210 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1140 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1211 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1141 $ cd ..
1212 $ cd ..
1142
1213
1143 $ cat << EOF >> $HGRCPATH
1214 $ cat << EOF >> $HGRCPATH
1144 > [format]
1215 > [format]
1145 > maxchainlen = 9001
1216 > maxchainlen = 9001
1146 > EOF
1217 > EOF
1147
1218
1148 Check upgrading a sparse-revlog repository
1219 Check upgrading a sparse-revlog repository
1149 ---------------------------------------
1220 ---------------------------------------
1150
1221
1151 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1222 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1152 $ cd sparserevlogrepo
1223 $ cd sparserevlogrepo
1153 $ touch foo
1224 $ touch foo
1154 $ hg add foo
1225 $ hg add foo
1155 $ hg -q commit -m "foo"
1226 $ hg -q commit -m "foo"
1156 $ cat .hg/requires
1227 $ cat .hg/requires
1157 dotencode
1228 dotencode
1158 fncache
1229 fncache
1159 generaldelta
1230 generaldelta
1160 revlogv1
1231 revlogv1
1161 store
1232 store
1162
1233
1163 Check that we can add the sparse-revlog format requirement
1234 Check that we can add the sparse-revlog format requirement
1164 $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
1235 $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
1165 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1236 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1166 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1237 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1167 $ cat .hg/requires
1238 $ cat .hg/requires
1168 dotencode
1239 dotencode
1169 fncache
1240 fncache
1170 generaldelta
1241 generaldelta
1171 revlogv1
1242 revlogv1
1172 sparserevlog
1243 sparserevlog
1173 store
1244 store
1174
1245
1175 Check that we can remove the sparse-revlog format requirement
1246 Check that we can remove the sparse-revlog format requirement
1176 $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
1247 $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
1177 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1248 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1178 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1249 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1179 $ cat .hg/requires
1250 $ cat .hg/requires
1180 dotencode
1251 dotencode
1181 fncache
1252 fncache
1182 generaldelta
1253 generaldelta
1183 revlogv1
1254 revlogv1
1184 store
1255 store
1185
1256
1186 #if zstd
1257 #if zstd
1187
1258
1188 Check upgrading to a zstd revlog
1259 Check upgrading to a zstd revlog
1189 --------------------------------
1260 --------------------------------
1190
1261
1191 upgrade
1262 upgrade
1192
1263
1193 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
1264 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
1194 $ hg debugformat -v
1265 $ hg debugformat -v
1195 format-variant repo config default
1266 format-variant repo config default
1196 fncache: yes yes yes
1267 fncache: yes yes yes
1197 dotencode: yes yes yes
1268 dotencode: yes yes yes
1198 generaldelta: yes yes yes
1269 generaldelta: yes yes yes
1199 sparserevlog: yes yes yes
1270 sparserevlog: yes yes yes
1271 sidedata: no no no
1200 plain-cl-delta: yes yes yes
1272 plain-cl-delta: yes yes yes
1201 compression: zstd zlib zlib
1273 compression: zstd zlib zlib
1202 compression-level: default default default
1274 compression-level: default default default
1203 $ cat .hg/requires
1275 $ cat .hg/requires
1204 dotencode
1276 dotencode
1205 fncache
1277 fncache
1206 generaldelta
1278 generaldelta
1207 revlog-compression-zstd
1279 revlog-compression-zstd
1208 revlogv1
1280 revlogv1
1209 sparserevlog
1281 sparserevlog
1210 store
1282 store
1211
1283
1212 downgrade
1284 downgrade
1213
1285
1214 $ hg debugupgraderepo --run --no-backup > /dev/null
1286 $ hg debugupgraderepo --run --no-backup > /dev/null
1215 $ hg debugformat -v
1287 $ hg debugformat -v
1216 format-variant repo config default
1288 format-variant repo config default
1217 fncache: yes yes yes
1289 fncache: yes yes yes
1218 dotencode: yes yes yes
1290 dotencode: yes yes yes
1219 generaldelta: yes yes yes
1291 generaldelta: yes yes yes
1220 sparserevlog: yes yes yes
1292 sparserevlog: yes yes yes
1293 sidedata: no no no
1221 plain-cl-delta: yes yes yes
1294 plain-cl-delta: yes yes yes
1222 compression: zlib zlib zlib
1295 compression: zlib zlib zlib
1223 compression-level: default default default
1296 compression-level: default default default
1224 $ cat .hg/requires
1297 $ cat .hg/requires
1225 dotencode
1298 dotencode
1226 fncache
1299 fncache
1227 generaldelta
1300 generaldelta
1228 revlogv1
1301 revlogv1
1229 sparserevlog
1302 sparserevlog
1230 store
1303 store
1231
1304
1232 upgrade from hgrc
1305 upgrade from hgrc
1233
1306
1234 $ cat >> .hg/hgrc << EOF
1307 $ cat >> .hg/hgrc << EOF
1235 > [format]
1308 > [format]
1236 > revlog-compression=zstd
1309 > revlog-compression=zstd
1237 > EOF
1310 > EOF
1238 $ hg debugupgraderepo --run --no-backup > /dev/null
1311 $ hg debugupgraderepo --run --no-backup > /dev/null
1239 $ hg debugformat -v
1312 $ hg debugformat -v
1240 format-variant repo config default
1313 format-variant repo config default
1241 fncache: yes yes yes
1314 fncache: yes yes yes
1242 dotencode: yes yes yes
1315 dotencode: yes yes yes
1243 generaldelta: yes yes yes
1316 generaldelta: yes yes yes
1244 sparserevlog: yes yes yes
1317 sparserevlog: yes yes yes
1318 sidedata: no no no
1245 plain-cl-delta: yes yes yes
1319 plain-cl-delta: yes yes yes
1246 compression: zstd zstd zlib
1320 compression: zstd zstd zlib
1247 compression-level: default default default
1321 compression-level: default default default
1248 $ cat .hg/requires
1322 $ cat .hg/requires
1249 dotencode
1323 dotencode
1250 fncache
1324 fncache
1251 generaldelta
1325 generaldelta
1252 revlog-compression-zstd
1326 revlog-compression-zstd
1253 revlogv1
1327 revlogv1
1254 sparserevlog
1328 sparserevlog
1255 store
1329 store
1256
1330
1257 $ cd ..
1331 $ cd ..
1258
1332
1259 #endif
1333 #endif
General Comments 0
You need to be logged in to leave comments. Login now