##// END OF EJS Templates
upgrade: migrated -> upgraded in ui messages...
Pulkit Goyal -
r46839:e22aed08 default
parent child Browse files
Show More
@@ -1,231 +1,231 b''
1 1 # upgrade.py - functions for in place upgrade of Mercurial repository
2 2 #
3 3 # Copyright (c) 2016-present, Gregory Szorc
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 11 from . import (
12 12 error,
13 13 hg,
14 14 localrepo,
15 15 pycompat,
16 16 )
17 17
18 18 from .upgrade_utils import (
19 19 actions as upgrade_actions,
20 20 engine as upgrade_engine,
21 21 )
22 22
23 23 allformatvariant = upgrade_actions.allformatvariant
24 24
25 25
26 26 def upgraderepo(
27 27 ui,
28 28 repo,
29 29 run=False,
30 30 optimize=None,
31 31 backup=True,
32 32 manifest=None,
33 33 changelog=None,
34 34 filelogs=None,
35 35 ):
36 36 """Upgrade a repository in place."""
37 37 if optimize is None:
38 38 optimize = {}
39 39 repo = repo.unfiltered()
40 40
41 41 revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
42 42 specentries = (
43 43 (upgrade_engine.UPGRADE_CHANGELOG, changelog),
44 44 (upgrade_engine.UPGRADE_MANIFEST, manifest),
45 45 (upgrade_engine.UPGRADE_FILELOGS, filelogs),
46 46 )
47 47 specified = [(y, x) for (y, x) in specentries if x is not None]
48 48 if specified:
49 49 # we have some limitation on revlogs to be recloned
50 50 if any(x for y, x in specified):
51 51 revlogs = set()
52 52 for upgrade, enabled in specified:
53 53 if enabled:
54 54 revlogs.add(upgrade)
55 55 else:
56 56 # none are enabled
57 57 for upgrade, __ in specified:
58 58 revlogs.discard(upgrade)
59 59
60 60 # Ensure the repository can be upgraded.
61 61 upgrade_actions.check_source_requirements(repo)
62 62
63 63 default_options = localrepo.defaultcreateopts(repo.ui)
64 64 newreqs = localrepo.newreporequirements(repo.ui, default_options)
65 65 newreqs.update(upgrade_actions.preservedrequirements(repo))
66 66
67 67 upgrade_actions.check_requirements_changes(repo, newreqs)
68 68
69 69 # Find and validate all improvements that can be made.
70 70 alloptimizations = upgrade_actions.findoptimizations(repo)
71 71
72 72 # Apply and Validate arguments.
73 73 optimizations = []
74 74 for o in alloptimizations:
75 75 if o.name in optimize:
76 76 optimizations.append(o)
77 77 optimize.discard(o.name)
78 78
79 79 if optimize: # anything left is unknown
80 80 raise error.Abort(
81 81 _(b'unknown optimization action requested: %s')
82 82 % b', '.join(sorted(optimize)),
83 83 hint=_(b'run without arguments to see valid optimizations'),
84 84 )
85 85
86 86 format_upgrades = upgrade_actions.find_format_upgrades(repo)
87 87 up_actions = upgrade_actions.determine_upgrade_actions(
88 88 repo, format_upgrades, optimizations, repo.requirements, newreqs
89 89 )
90 90 removed_actions = upgrade_actions.find_format_downgrades(repo)
91 91
92 92 removedreqs = repo.requirements - newreqs
93 93 addedreqs = newreqs - repo.requirements
94 94
95 95 if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS:
96 96 incompatible = upgrade_actions.RECLONES_REQUIREMENTS & (
97 97 removedreqs | addedreqs
98 98 )
99 99 if incompatible:
100 100 msg = _(
101 101 b'ignoring revlogs selection flags, format requirements '
102 102 b'change: %s\n'
103 103 )
104 104 ui.warn(msg % b', '.join(sorted(incompatible)))
105 105 revlogs = upgrade_engine.UPGRADE_ALL_REVLOGS
106 106
107 107 upgrade_op = upgrade_actions.UpgradeOperation(
108 108 ui,
109 109 newreqs,
110 110 repo.requirements,
111 111 up_actions,
112 112 removed_actions,
113 113 revlogs,
114 114 )
115 115
116 116 if not run:
117 117 fromconfig = []
118 118 onlydefault = []
119 119
120 120 for d in format_upgrades:
121 121 if d.fromconfig(repo):
122 122 fromconfig.append(d)
123 123 elif d.default:
124 124 onlydefault.append(d)
125 125
126 126 if fromconfig or onlydefault:
127 127
128 128 if fromconfig:
129 129 ui.status(
130 130 _(
131 131 b'repository lacks features recommended by '
132 132 b'current config options:\n\n'
133 133 )
134 134 )
135 135 for i in fromconfig:
136 136 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
137 137
138 138 if onlydefault:
139 139 ui.status(
140 140 _(
141 141 b'repository lacks features used by the default '
142 142 b'config options:\n\n'
143 143 )
144 144 )
145 145 for i in onlydefault:
146 146 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
147 147
148 148 ui.status(b'\n')
149 149 else:
150 150 ui.status(_(b'(no format upgrades found in existing repository)\n'))
151 151
152 152 ui.status(
153 153 _(
154 154 b'performing an upgrade with "--run" will make the following '
155 155 b'changes:\n\n'
156 156 )
157 157 )
158 158
159 159 upgrade_op.print_requirements()
160 160 upgrade_op.print_optimisations()
161 161 upgrade_op.print_upgrade_actions()
162 162 upgrade_op.print_affected_revlogs()
163 163
164 164 if upgrade_op.unused_optimizations:
165 165 ui.status(
166 166 _(
167 167 b'additional optimizations are available by specifying '
168 168 b'"--optimize <name>":\n\n'
169 169 )
170 170 )
171 171 upgrade_op.print_unused_optimizations()
172 172 return
173 173
174 174 # Else we're in the run=true case.
175 175 ui.write(_(b'upgrade will perform the following actions:\n\n'))
176 176 upgrade_op.print_requirements()
177 177 upgrade_op.print_optimisations()
178 178 upgrade_op.print_upgrade_actions()
179 179 upgrade_op.print_affected_revlogs()
180 180
181 181 ui.status(_(b'beginning upgrade...\n'))
182 182 with repo.wlock(), repo.lock():
183 183 ui.status(_(b'repository locked and read-only\n'))
184 184 # Our strategy for upgrading the repository is to create a new,
185 185 # temporary repository, write data to it, then do a swap of the
186 186 # data. There are less heavyweight ways to do this, but it is easier
187 187 # to create a new repo object than to instantiate all the components
188 188 # (like the store) separately.
189 189 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
190 190 backuppath = None
191 191 try:
192 192 ui.status(
193 193 _(
194 b'creating temporary repository to stage migrated '
194 b'creating temporary repository to stage upgraded '
195 195 b'data: %s\n'
196 196 )
197 197 % tmppath
198 198 )
199 199
200 200 # clone ui without using ui.copy because repo.ui is protected
201 201 repoui = repo.ui.__class__(repo.ui)
202 202 dstrepo = hg.repository(repoui, path=tmppath, create=True)
203 203
204 204 with dstrepo.wlock(), dstrepo.lock():
205 205 backuppath = upgrade_engine.upgrade(
206 206 ui, repo, dstrepo, upgrade_op
207 207 )
208 208 if not backup:
209 209 ui.status(
210 210 _(b'removing old repository content %s\n') % backuppath
211 211 )
212 212 repo.vfs.rmtree(backuppath, forcibly=True)
213 213 backuppath = None
214 214
215 215 finally:
216 216 ui.status(_(b'removing temporary repository %s\n') % tmppath)
217 217 repo.vfs.rmtree(tmppath, forcibly=True)
218 218
219 219 if backuppath and not ui.quiet:
220 220 ui.warn(
221 221 _(b'copy of old repository backed up at %s\n') % backuppath
222 222 )
223 223 ui.warn(
224 224 _(
225 225 b'the old repository will not be deleted; remove '
226 226 b'it to free up disk space once the upgraded '
227 227 b'repository is verified\n'
228 228 )
229 229 )
230 230
231 231 upgrade_op.print_post_op_messages()
@@ -1,538 +1,538 b''
1 1 # upgrade.py - functions for in place upgrade of Mercurial repository
2 2 #
3 3 # Copyright (c) 2016-present, Gregory Szorc
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import stat
11 11
12 12 from ..i18n import _
13 13 from ..pycompat import getattr
14 14 from .. import (
15 15 changelog,
16 16 error,
17 17 filelog,
18 18 manifest,
19 19 metadata,
20 20 pycompat,
21 21 requirements,
22 22 revlog,
23 23 scmutil,
24 24 util,
25 25 vfs as vfsmod,
26 26 )
27 27
28 28
29 29 def _revlogfrompath(repo, path):
30 30 """Obtain a revlog from a repo path.
31 31
32 32 An instance of the appropriate class is returned.
33 33 """
34 34 if path == b'00changelog.i':
35 35 return changelog.changelog(repo.svfs)
36 36 elif path.endswith(b'00manifest.i'):
37 37 mandir = path[: -len(b'00manifest.i')]
38 38 return manifest.manifestrevlog(repo.svfs, tree=mandir)
39 39 else:
40 40 # reverse of "/".join(("data", path + ".i"))
41 41 return filelog.filelog(repo.svfs, path[5:-2])
42 42
43 43
44 44 def _copyrevlog(tr, destrepo, oldrl, unencodedname):
45 45 """copy all relevant files for `oldrl` into `destrepo` store
46 46
47 47 Files are copied "as is" without any transformation. The copy is performed
48 48 without extra checks. Callers are responsible for making sure the copied
49 49 content is compatible with format of the destination repository.
50 50 """
51 51 oldrl = getattr(oldrl, '_revlog', oldrl)
52 52 newrl = _revlogfrompath(destrepo, unencodedname)
53 53 newrl = getattr(newrl, '_revlog', newrl)
54 54
55 55 oldvfs = oldrl.opener
56 56 newvfs = newrl.opener
57 57 oldindex = oldvfs.join(oldrl.indexfile)
58 58 newindex = newvfs.join(newrl.indexfile)
59 59 olddata = oldvfs.join(oldrl.datafile)
60 60 newdata = newvfs.join(newrl.datafile)
61 61
62 62 with newvfs(newrl.indexfile, b'w'):
63 63 pass # create all the directories
64 64
65 65 util.copyfile(oldindex, newindex)
66 66 copydata = oldrl.opener.exists(oldrl.datafile)
67 67 if copydata:
68 68 util.copyfile(olddata, newdata)
69 69
70 70 if not (
71 71 unencodedname.endswith(b'00changelog.i')
72 72 or unencodedname.endswith(b'00manifest.i')
73 73 ):
74 74 destrepo.svfs.fncache.add(unencodedname)
75 75 if copydata:
76 76 destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
77 77
78 78
79 79 UPGRADE_CHANGELOG = b"changelog"
80 80 UPGRADE_MANIFEST = b"manifest"
81 81 UPGRADE_FILELOGS = b"all-filelogs"
82 82
83 83 UPGRADE_ALL_REVLOGS = frozenset(
84 84 [UPGRADE_CHANGELOG, UPGRADE_MANIFEST, UPGRADE_FILELOGS]
85 85 )
86 86
87 87
88 88 def getsidedatacompanion(srcrepo, dstrepo):
89 89 sidedatacompanion = None
90 90 removedreqs = srcrepo.requirements - dstrepo.requirements
91 91 addedreqs = dstrepo.requirements - srcrepo.requirements
92 92 if requirements.SIDEDATA_REQUIREMENT in removedreqs:
93 93
94 94 def sidedatacompanion(rl, rev):
95 95 rl = getattr(rl, '_revlog', rl)
96 96 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
97 97 return True, (), {}, 0, 0
98 98 return False, (), {}, 0, 0
99 99
100 100 elif requirements.COPIESSDC_REQUIREMENT in addedreqs:
101 101 sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo)
102 102 elif requirements.COPIESSDC_REQUIREMENT in removedreqs:
103 103 sidedatacompanion = metadata.getsidedataremover(srcrepo, dstrepo)
104 104 return sidedatacompanion
105 105
106 106
107 107 def matchrevlog(revlogfilter, entry):
108 108 """check if a revlog is selected for cloning.
109 109
110 110 In other words, are there any updates which need to be done on revlog
111 111 or it can be blindly copied.
112 112
113 113 The store entry is checked against the passed filter"""
114 114 if entry.endswith(b'00changelog.i'):
115 115 return UPGRADE_CHANGELOG in revlogfilter
116 116 elif entry.endswith(b'00manifest.i'):
117 117 return UPGRADE_MANIFEST in revlogfilter
118 118 return UPGRADE_FILELOGS in revlogfilter
119 119
120 120
121 121 def _perform_clone(
122 122 ui,
123 123 dstrepo,
124 124 tr,
125 125 old_revlog,
126 126 unencoded,
127 127 upgrade_op,
128 128 sidedatacompanion,
129 129 oncopiedrevision,
130 130 ):
131 131 """ returns the new revlog object created"""
132 132 newrl = None
133 133 if matchrevlog(upgrade_op.revlogs_to_process, unencoded):
134 134 ui.note(
135 135 _(b'cloning %d revisions from %s\n') % (len(old_revlog), unencoded)
136 136 )
137 137 newrl = _revlogfrompath(dstrepo, unencoded)
138 138 old_revlog.clone(
139 139 tr,
140 140 newrl,
141 141 addrevisioncb=oncopiedrevision,
142 142 deltareuse=upgrade_op.delta_reuse_mode,
143 143 forcedeltabothparents=upgrade_op.force_re_delta_both_parents,
144 144 sidedatacompanion=sidedatacompanion,
145 145 )
146 146 else:
147 147 msg = _(b'blindly copying %s containing %i revisions\n')
148 148 ui.note(msg % (unencoded, len(old_revlog)))
149 149 _copyrevlog(tr, dstrepo, old_revlog, unencoded)
150 150
151 151 newrl = _revlogfrompath(dstrepo, unencoded)
152 152 return newrl
153 153
154 154
155 155 def _clonerevlogs(
156 156 ui,
157 157 srcrepo,
158 158 dstrepo,
159 159 tr,
160 160 upgrade_op,
161 161 ):
162 162 """Copy revlogs between 2 repos."""
163 163 revcount = 0
164 164 srcsize = 0
165 165 srcrawsize = 0
166 166 dstsize = 0
167 167 fcount = 0
168 168 frevcount = 0
169 169 fsrcsize = 0
170 170 frawsize = 0
171 171 fdstsize = 0
172 172 mcount = 0
173 173 mrevcount = 0
174 174 msrcsize = 0
175 175 mrawsize = 0
176 176 mdstsize = 0
177 177 crevcount = 0
178 178 csrcsize = 0
179 179 crawsize = 0
180 180 cdstsize = 0
181 181
182 182 alldatafiles = list(srcrepo.store.walk())
183 183 # mapping of data files which needs to be cloned
184 184 # key is unencoded filename
185 185 # value is revlog_object_from_srcrepo
186 186 manifests = {}
187 187 changelogs = {}
188 188 filelogs = {}
189 189
190 190 # Perform a pass to collect metadata. This validates we can open all
191 191 # source files and allows a unified progress bar to be displayed.
192 192 for unencoded, encoded, size in alldatafiles:
193 193 if unencoded.endswith(b'.d'):
194 194 continue
195 195
196 196 rl = _revlogfrompath(srcrepo, unencoded)
197 197
198 198 info = rl.storageinfo(
199 199 exclusivefiles=True,
200 200 revisionscount=True,
201 201 trackedsize=True,
202 202 storedsize=True,
203 203 )
204 204
205 205 revcount += info[b'revisionscount'] or 0
206 206 datasize = info[b'storedsize'] or 0
207 207 rawsize = info[b'trackedsize'] or 0
208 208
209 209 srcsize += datasize
210 210 srcrawsize += rawsize
211 211
212 212 # This is for the separate progress bars.
213 213 if isinstance(rl, changelog.changelog):
214 214 changelogs[unencoded] = rl
215 215 crevcount += len(rl)
216 216 csrcsize += datasize
217 217 crawsize += rawsize
218 218 elif isinstance(rl, manifest.manifestrevlog):
219 219 manifests[unencoded] = rl
220 220 mcount += 1
221 221 mrevcount += len(rl)
222 222 msrcsize += datasize
223 223 mrawsize += rawsize
224 224 elif isinstance(rl, filelog.filelog):
225 225 filelogs[unencoded] = rl
226 226 fcount += 1
227 227 frevcount += len(rl)
228 228 fsrcsize += datasize
229 229 frawsize += rawsize
230 230 else:
231 231 error.ProgrammingError(b'unknown revlog type')
232 232
233 233 if not revcount:
234 234 return
235 235
236 236 ui.status(
237 237 _(
238 238 b'migrating %d total revisions (%d in filelogs, %d in manifests, '
239 239 b'%d in changelog)\n'
240 240 )
241 241 % (revcount, frevcount, mrevcount, crevcount)
242 242 )
243 243 ui.status(
244 244 _(b'migrating %s in store; %s tracked data\n')
245 245 % ((util.bytecount(srcsize), util.bytecount(srcrawsize)))
246 246 )
247 247
248 248 # Used to keep track of progress.
249 249 progress = None
250 250
251 251 def oncopiedrevision(rl, rev, node):
252 252 progress.increment()
253 253
254 254 sidedatacompanion = getsidedatacompanion(srcrepo, dstrepo)
255 255
256 256 # Migrating filelogs
257 257 ui.status(
258 258 _(
259 259 b'migrating %d filelogs containing %d revisions '
260 260 b'(%s in store; %s tracked data)\n'
261 261 )
262 262 % (
263 263 fcount,
264 264 frevcount,
265 265 util.bytecount(fsrcsize),
266 266 util.bytecount(frawsize),
267 267 )
268 268 )
269 269 progress = srcrepo.ui.makeprogress(_(b'file revisions'), total=frevcount)
270 270 for unencoded, oldrl in sorted(filelogs.items()):
271 271 newrl = _perform_clone(
272 272 ui,
273 273 dstrepo,
274 274 tr,
275 275 oldrl,
276 276 unencoded,
277 277 upgrade_op,
278 278 sidedatacompanion,
279 279 oncopiedrevision,
280 280 )
281 281 info = newrl.storageinfo(storedsize=True)
282 282 fdstsize += info[b'storedsize'] or 0
283 283 ui.status(
284 284 _(
285 285 b'finished migrating %d filelog revisions across %d '
286 286 b'filelogs; change in size: %s\n'
287 287 )
288 288 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize))
289 289 )
290 290
291 291 # Migrating manifests
292 292 ui.status(
293 293 _(
294 294 b'migrating %d manifests containing %d revisions '
295 295 b'(%s in store; %s tracked data)\n'
296 296 )
297 297 % (
298 298 mcount,
299 299 mrevcount,
300 300 util.bytecount(msrcsize),
301 301 util.bytecount(mrawsize),
302 302 )
303 303 )
304 304 if progress:
305 305 progress.complete()
306 306 progress = srcrepo.ui.makeprogress(
307 307 _(b'manifest revisions'), total=mrevcount
308 308 )
309 309 for unencoded, oldrl in sorted(manifests.items()):
310 310 newrl = _perform_clone(
311 311 ui,
312 312 dstrepo,
313 313 tr,
314 314 oldrl,
315 315 unencoded,
316 316 upgrade_op,
317 317 sidedatacompanion,
318 318 oncopiedrevision,
319 319 )
320 320 info = newrl.storageinfo(storedsize=True)
321 321 mdstsize += info[b'storedsize'] or 0
322 322 ui.status(
323 323 _(
324 324 b'finished migrating %d manifest revisions across %d '
325 325 b'manifests; change in size: %s\n'
326 326 )
327 327 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize))
328 328 )
329 329
330 330 # Migrating changelog
331 331 ui.status(
332 332 _(
333 333 b'migrating changelog containing %d revisions '
334 334 b'(%s in store; %s tracked data)\n'
335 335 )
336 336 % (
337 337 crevcount,
338 338 util.bytecount(csrcsize),
339 339 util.bytecount(crawsize),
340 340 )
341 341 )
342 342 if progress:
343 343 progress.complete()
344 344 progress = srcrepo.ui.makeprogress(
345 345 _(b'changelog revisions'), total=crevcount
346 346 )
347 347 for unencoded, oldrl in sorted(changelogs.items()):
348 348 newrl = _perform_clone(
349 349 ui,
350 350 dstrepo,
351 351 tr,
352 352 oldrl,
353 353 unencoded,
354 354 upgrade_op,
355 355 sidedatacompanion,
356 356 oncopiedrevision,
357 357 )
358 358 info = newrl.storageinfo(storedsize=True)
359 359 cdstsize += info[b'storedsize'] or 0
360 360 progress.complete()
361 361 ui.status(
362 362 _(
363 363 b'finished migrating %d changelog revisions; change in size: '
364 364 b'%s\n'
365 365 )
366 366 % (crevcount, util.bytecount(cdstsize - csrcsize))
367 367 )
368 368
369 369 dstsize = fdstsize + mdstsize + cdstsize
370 370 ui.status(
371 371 _(
372 372 b'finished migrating %d total revisions; total change in store '
373 373 b'size: %s\n'
374 374 )
375 375 % (revcount, util.bytecount(dstsize - srcsize))
376 376 )
377 377
378 378
379 379 def _filterstorefile(srcrepo, dstrepo, requirements, path, mode, st):
380 380 """Determine whether to copy a store file during upgrade.
381 381
382 382 This function is called when migrating store files from ``srcrepo`` to
383 383 ``dstrepo`` as part of upgrading a repository.
384 384
385 385 Args:
386 386 srcrepo: repo we are copying from
387 387 dstrepo: repo we are copying to
388 388 requirements: set of requirements for ``dstrepo``
389 389 path: store file being examined
390 390 mode: the ``ST_MODE`` file type of ``path``
391 391 st: ``stat`` data structure for ``path``
392 392
393 393 Function should return ``True`` if the file is to be copied.
394 394 """
395 395 # Skip revlogs.
396 396 if path.endswith((b'.i', b'.d', b'.n', b'.nd')):
397 397 return False
398 398 # Skip transaction related files.
399 399 if path.startswith(b'undo'):
400 400 return False
401 401 # Only copy regular files.
402 402 if mode != stat.S_IFREG:
403 403 return False
404 404 # Skip other skipped files.
405 405 if path in (b'lock', b'fncache'):
406 406 return False
407 407
408 408 return True
409 409
410 410
411 411 def _replacestores(currentrepo, upgradedrepo, backupvfs, upgrade_op):
412 412 """Replace the stores after current repository is upgraded
413 413
414 414 Creates a backup of current repository store at backup path
415 415 Replaces upgraded store files in current repo from upgraded one
416 416
417 417 Arguments:
418 418 currentrepo: repo object of current repository
419 419 upgradedrepo: repo object of the upgraded data
420 420 backupvfs: vfs object for the backup path
421 421 upgrade_op: upgrade operation object
422 422 to be used to decide what all is upgraded
423 423 """
424 424 # TODO: don't blindly rename everything in store
425 425 # There can be upgrades where store is not touched at all
426 426 util.rename(currentrepo.spath, backupvfs.join(b'store'))
427 427 util.rename(upgradedrepo.spath, currentrepo.spath)
428 428
429 429
430 430 def finishdatamigration(ui, srcrepo, dstrepo, requirements):
431 431 """Hook point for extensions to perform additional actions during upgrade.
432 432
433 433 This function is called after revlogs and store files have been copied but
434 434 before the new store is swapped into the original location.
435 435 """
436 436
437 437
438 438 def upgrade(ui, srcrepo, dstrepo, upgrade_op):
439 439 """Do the low-level work of upgrading a repository.
440 440
441 441 The upgrade is effectively performed as a copy between a source
442 442 repository and a temporary destination repository.
443 443
444 444 The source repository is unmodified for as long as possible so the
445 445 upgrade can abort at any time without causing loss of service for
446 446 readers and without corrupting the source repository.
447 447 """
448 448 assert srcrepo.currentwlock()
449 449 assert dstrepo.currentwlock()
450 450
451 451 ui.status(
452 452 _(
453 453 b'(it is safe to interrupt this process any time before '
454 454 b'data migration completes)\n'
455 455 )
456 456 )
457 457
458 458 with dstrepo.transaction(b'upgrade') as tr:
459 459 _clonerevlogs(
460 460 ui,
461 461 srcrepo,
462 462 dstrepo,
463 463 tr,
464 464 upgrade_op,
465 465 )
466 466
467 467 # Now copy other files in the store directory.
468 468 # The sorted() makes execution deterministic.
469 469 for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)):
470 470 if not _filterstorefile(
471 471 srcrepo, dstrepo, upgrade_op.new_requirements, p, kind, st
472 472 ):
473 473 continue
474 474
475 475 srcrepo.ui.status(_(b'copying %s\n') % p)
476 476 src = srcrepo.store.rawvfs.join(p)
477 477 dst = dstrepo.store.rawvfs.join(p)
478 478 util.copyfile(src, dst, copystat=True)
479 479
480 480 finishdatamigration(ui, srcrepo, dstrepo, requirements)
481 481
482 ui.status(_(b'data fully migrated to temporary repository\n'))
482 ui.status(_(b'data fully upgraded in a temporary repository\n'))
483 483
484 484 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path)
485 485 backupvfs = vfsmod.vfs(backuppath)
486 486
487 487 # Make a backup of requires file first, as it is the first to be modified.
488 488 util.copyfile(srcrepo.vfs.join(b'requires'), backupvfs.join(b'requires'))
489 489
490 490 # We install an arbitrary requirement that clients must not support
491 491 # as a mechanism to lock out new clients during the data swap. This is
492 492 # better than allowing a client to continue while the repository is in
493 493 # an inconsistent state.
494 494 ui.status(
495 495 _(
496 496 b'marking source repository as being upgraded; clients will be '
497 497 b'unable to read from repository\n'
498 498 )
499 499 )
500 500 scmutil.writereporequirements(
501 501 srcrepo, srcrepo.requirements | {b'upgradeinprogress'}
502 502 )
503 503
504 504 ui.status(_(b'starting in-place swap of repository data\n'))
505 505 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
506 506
507 507 # Now swap in the new store directory. Doing it as a rename should make
508 508 # the operation nearly instantaneous and atomic (at least in well-behaved
509 509 # environments).
510 510 ui.status(_(b'replacing store...\n'))
511 511 tstart = util.timer()
512 512 _replacestores(srcrepo, dstrepo, backupvfs, upgrade_op)
513 513 elapsed = util.timer() - tstart
514 514 ui.status(
515 515 _(
516 516 b'store replacement complete; repository was inconsistent for '
517 517 b'%0.1fs\n'
518 518 )
519 519 % elapsed
520 520 )
521 521
522 522 # We first write the requirements file. Any new requirements will lock
523 523 # out legacy clients.
524 524 ui.status(
525 525 _(
526 526 b'finalizing requirements file and making repository readable '
527 527 b'again\n'
528 528 )
529 529 )
530 530 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
531 531
532 532 # The lock file from the old store won't be removed because nothing has a
533 533 # reference to its new location. So clean it up manually. Alternatively, we
534 534 # could update srcrepo.svfs and other variables to point to the new
535 535 # location. This is simpler.
536 536 backupvfs.unlink(b'store/lock')
537 537
538 538 return backuppath
@@ -1,1646 +1,1646 b''
1 1 #require no-reposimplestore
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 4 > [extensions]
5 5 > share =
6 6 > EOF
7 7
8 8 store and revlogv1 are required in source
9 9
10 10 $ hg --config format.usestore=false init no-store
11 11 $ hg -R no-store debugupgraderepo
12 12 abort: cannot upgrade repository; requirement missing: store
13 13 [255]
14 14
15 15 $ hg init no-revlogv1
16 16 $ cat > no-revlogv1/.hg/requires << EOF
17 17 > dotencode
18 18 > fncache
19 19 > generaldelta
20 20 > store
21 21 > EOF
22 22
23 23 $ hg -R no-revlogv1 debugupgraderepo
24 24 abort: cannot upgrade repository; requirement missing: revlogv1
25 25 [255]
26 26
27 27 Cannot upgrade shared repositories
28 28
29 29 $ hg init share-parent
30 30 $ hg -q share share-parent share-child
31 31
32 32 $ hg -R share-child debugupgraderepo
33 33 abort: cannot upgrade repository; unsupported source requirement: shared
34 34 [255]
35 35
36 36 Do not yet support upgrading treemanifest repos
37 37
38 38 $ hg --config experimental.treemanifest=true init treemanifest
39 39 $ hg -R treemanifest debugupgraderepo
40 40 abort: cannot upgrade repository; unsupported source requirement: treemanifest
41 41 [255]
42 42
43 43 Cannot add treemanifest requirement during upgrade
44 44
45 45 $ hg init disallowaddedreq
46 46 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
47 47 abort: cannot upgrade repository; do not support adding requirement: treemanifest
48 48 [255]
49 49
50 50 An upgrade of a repository created with recommended settings only suggests optimizations
51 51
52 52 $ hg init empty
53 53 $ cd empty
54 54 $ hg debugformat
55 55 format-variant repo
56 56 fncache: yes
57 57 dotencode: yes
58 58 generaldelta: yes
59 59 exp-sharesafe: no
60 60 sparserevlog: yes
61 61 sidedata: no
62 62 persistent-nodemap: no
63 63 copies-sdc: no
64 64 plain-cl-delta: yes
65 65 compression: zlib
66 66 compression-level: default
67 67 $ hg debugformat --verbose
68 68 format-variant repo config default
69 69 fncache: yes yes yes
70 70 dotencode: yes yes yes
71 71 generaldelta: yes yes yes
72 72 exp-sharesafe: no no no
73 73 sparserevlog: yes yes yes
74 74 sidedata: no no no
75 75 persistent-nodemap: no no no
76 76 copies-sdc: no no no
77 77 plain-cl-delta: yes yes yes
78 78 compression: zlib zlib zlib
79 79 compression-level: default default default
80 80 $ hg debugformat --verbose --config format.usefncache=no
81 81 format-variant repo config default
82 82 fncache: yes no yes
83 83 dotencode: yes no yes
84 84 generaldelta: yes yes yes
85 85 exp-sharesafe: no no no
86 86 sparserevlog: yes yes yes
87 87 sidedata: no no no
88 88 persistent-nodemap: no no no
89 89 copies-sdc: no no no
90 90 plain-cl-delta: yes yes yes
91 91 compression: zlib zlib zlib
92 92 compression-level: default default default
93 93 $ hg debugformat --verbose --config format.usefncache=no --color=debug
94 94 format-variant repo config default
95 95 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
96 96 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
97 97 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
98 98 [formatvariant.name.uptodate|exp-sharesafe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
99 99 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
100 100 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
101 101 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
102 102 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
103 103 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
104 104 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
105 105 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
106 106 $ hg debugformat -Tjson
107 107 [
108 108 {
109 109 "config": true,
110 110 "default": true,
111 111 "name": "fncache",
112 112 "repo": true
113 113 },
114 114 {
115 115 "config": true,
116 116 "default": true,
117 117 "name": "dotencode",
118 118 "repo": true
119 119 },
120 120 {
121 121 "config": true,
122 122 "default": true,
123 123 "name": "generaldelta",
124 124 "repo": true
125 125 },
126 126 {
127 127 "config": false,
128 128 "default": false,
129 129 "name": "exp-sharesafe",
130 130 "repo": false
131 131 },
132 132 {
133 133 "config": true,
134 134 "default": true,
135 135 "name": "sparserevlog",
136 136 "repo": true
137 137 },
138 138 {
139 139 "config": false,
140 140 "default": false,
141 141 "name": "sidedata",
142 142 "repo": false
143 143 },
144 144 {
145 145 "config": false,
146 146 "default": false,
147 147 "name": "persistent-nodemap",
148 148 "repo": false
149 149 },
150 150 {
151 151 "config": false,
152 152 "default": false,
153 153 "name": "copies-sdc",
154 154 "repo": false
155 155 },
156 156 {
157 157 "config": true,
158 158 "default": true,
159 159 "name": "plain-cl-delta",
160 160 "repo": true
161 161 },
162 162 {
163 163 "config": "zlib",
164 164 "default": "zlib",
165 165 "name": "compression",
166 166 "repo": "zlib"
167 167 },
168 168 {
169 169 "config": "default",
170 170 "default": "default",
171 171 "name": "compression-level",
172 172 "repo": "default"
173 173 }
174 174 ]
175 175 $ hg debugupgraderepo
176 176 (no format upgrades found in existing repository)
177 177 performing an upgrade with "--run" will make the following changes:
178 178
179 179 requirements
180 180 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
181 181
182 182 processed revlogs:
183 183 - all-filelogs
184 184 - changelog
185 185 - manifest
186 186
187 187 additional optimizations are available by specifying "--optimize <name>":
188 188
189 189 re-delta-parent
190 190 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
191 191
192 192 re-delta-multibase
193 193 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
194 194
195 195 re-delta-all
196 196 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
197 197
198 198 re-delta-fulladd
199 199 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.
200 200
201 201
202 202 $ hg debugupgraderepo --quiet
203 203 requirements
204 204 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
205 205
206 206 processed revlogs:
207 207 - all-filelogs
208 208 - changelog
209 209 - manifest
210 210
211 211
212 212 --optimize can be used to add optimizations
213 213
214 214 $ hg debugupgrade --optimize 're-delta-parent'
215 215 (no format upgrades found in existing repository)
216 216 performing an upgrade with "--run" will make the following changes:
217 217
218 218 requirements
219 219 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
220 220
221 221 optimisations: re-delta-parent
222 222
223 223 re-delta-parent
224 224 deltas within internal storage will choose a new base revision if needed
225 225
226 226 processed revlogs:
227 227 - all-filelogs
228 228 - changelog
229 229 - manifest
230 230
231 231 additional optimizations are available by specifying "--optimize <name>":
232 232
233 233 re-delta-multibase
234 234 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
235 235
236 236 re-delta-all
237 237 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
238 238
239 239 re-delta-fulladd
240 240 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.
241 241
242 242
243 243 modern form of the option
244 244
245 245 $ hg debugupgrade --optimize re-delta-parent
246 246 (no format upgrades found in existing repository)
247 247 performing an upgrade with "--run" will make the following changes:
248 248
249 249 requirements
250 250 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
251 251
252 252 optimisations: re-delta-parent
253 253
254 254 re-delta-parent
255 255 deltas within internal storage will choose a new base revision if needed
256 256
257 257 processed revlogs:
258 258 - all-filelogs
259 259 - changelog
260 260 - manifest
261 261
262 262 additional optimizations are available by specifying "--optimize <name>":
263 263
264 264 re-delta-multibase
265 265 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
266 266
267 267 re-delta-all
268 268 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
269 269
270 270 re-delta-fulladd
271 271 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.
272 272
273 273 $ hg debugupgrade --optimize re-delta-parent --quiet
274 274 requirements
275 275 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
276 276
277 277 optimisations: re-delta-parent
278 278
279 279 processed revlogs:
280 280 - all-filelogs
281 281 - changelog
282 282 - manifest
283 283
284 284
285 285 unknown optimization:
286 286
287 287 $ hg debugupgrade --optimize foobar
288 288 abort: unknown optimization action requested: foobar
289 289 (run without arguments to see valid optimizations)
290 290 [255]
291 291
292 292 Various sub-optimal detections work
293 293
294 294 $ cat > .hg/requires << EOF
295 295 > revlogv1
296 296 > store
297 297 > EOF
298 298
299 299 $ hg debugformat
300 300 format-variant repo
301 301 fncache: no
302 302 dotencode: no
303 303 generaldelta: no
304 304 exp-sharesafe: no
305 305 sparserevlog: no
306 306 sidedata: no
307 307 persistent-nodemap: no
308 308 copies-sdc: no
309 309 plain-cl-delta: yes
310 310 compression: zlib
311 311 compression-level: default
312 312 $ hg debugformat --verbose
313 313 format-variant repo config default
314 314 fncache: no yes yes
315 315 dotencode: no yes yes
316 316 generaldelta: no yes yes
317 317 exp-sharesafe: no no no
318 318 sparserevlog: no yes yes
319 319 sidedata: no no no
320 320 persistent-nodemap: no no no
321 321 copies-sdc: no no no
322 322 plain-cl-delta: yes yes yes
323 323 compression: zlib zlib zlib
324 324 compression-level: default default default
325 325 $ hg debugformat --verbose --config format.usegeneraldelta=no
326 326 format-variant repo config default
327 327 fncache: no yes yes
328 328 dotencode: no yes yes
329 329 generaldelta: no no yes
330 330 exp-sharesafe: no no no
331 331 sparserevlog: no no yes
332 332 sidedata: no no no
333 333 persistent-nodemap: no no no
334 334 copies-sdc: no no no
335 335 plain-cl-delta: yes yes yes
336 336 compression: zlib zlib zlib
337 337 compression-level: default default default
338 338 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
339 339 format-variant repo config default
340 340 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
341 341 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
342 342 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
343 343 [formatvariant.name.uptodate|exp-sharesafe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
344 344 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
345 345 [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
346 346 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
347 347 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
348 348 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
349 349 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib]
350 350 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
351 351 $ hg debugupgraderepo
352 352 repository lacks features recommended by current config options:
353 353
354 354 fncache
355 355 long and reserved filenames may not work correctly; repository performance is sub-optimal
356 356
357 357 dotencode
358 358 storage of filenames beginning with a period or space may not work correctly
359 359
360 360 generaldelta
361 361 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
362 362
363 363 sparserevlog
364 364 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.
365 365
366 366
367 367 performing an upgrade with "--run" will make the following changes:
368 368
369 369 requirements
370 370 preserved: revlogv1, store
371 371 added: dotencode, fncache, generaldelta, sparserevlog
372 372
373 373 fncache
374 374 repository will be more resilient to storing certain paths and performance of certain operations should be improved
375 375
376 376 dotencode
377 377 repository will be better able to store files beginning with a space or period
378 378
379 379 generaldelta
380 380 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
381 381
382 382 sparserevlog
383 383 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.
384 384
385 385 processed revlogs:
386 386 - all-filelogs
387 387 - changelog
388 388 - manifest
389 389
390 390 additional optimizations are available by specifying "--optimize <name>":
391 391
392 392 re-delta-parent
393 393 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
394 394
395 395 re-delta-multibase
396 396 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
397 397
398 398 re-delta-all
399 399 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
400 400
401 401 re-delta-fulladd
402 402 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.
403 403
404 404 $ hg debugupgraderepo --quiet
405 405 requirements
406 406 preserved: revlogv1, store
407 407 added: dotencode, fncache, generaldelta, sparserevlog
408 408
409 409 processed revlogs:
410 410 - all-filelogs
411 411 - changelog
412 412 - manifest
413 413
414 414
415 415 $ hg --config format.dotencode=false debugupgraderepo
416 416 repository lacks features recommended by current config options:
417 417
418 418 fncache
419 419 long and reserved filenames may not work correctly; repository performance is sub-optimal
420 420
421 421 generaldelta
422 422 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
423 423
424 424 sparserevlog
425 425 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.
426 426
427 427 repository lacks features used by the default config options:
428 428
429 429 dotencode
430 430 storage of filenames beginning with a period or space may not work correctly
431 431
432 432
433 433 performing an upgrade with "--run" will make the following changes:
434 434
435 435 requirements
436 436 preserved: revlogv1, store
437 437 added: fncache, generaldelta, sparserevlog
438 438
439 439 fncache
440 440 repository will be more resilient to storing certain paths and performance of certain operations should be improved
441 441
442 442 generaldelta
443 443 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 444
445 445 sparserevlog
446 446 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.
447 447
448 448 processed revlogs:
449 449 - all-filelogs
450 450 - changelog
451 451 - manifest
452 452
453 453 additional optimizations are available by specifying "--optimize <name>":
454 454
455 455 re-delta-parent
456 456 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
457 457
458 458 re-delta-multibase
459 459 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
460 460
461 461 re-delta-all
462 462 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
463 463
464 464 re-delta-fulladd
465 465 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.
466 466
467 467
468 468 $ cd ..
469 469
470 470 Upgrading a repository that is already modern essentially no-ops
471 471
472 472 $ hg init modern
473 473 $ hg -R modern debugupgraderepo --run
474 474 upgrade will perform the following actions:
475 475
476 476 requirements
477 477 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
478 478
479 479 processed revlogs:
480 480 - all-filelogs
481 481 - changelog
482 482 - manifest
483 483
484 484 beginning upgrade...
485 485 repository locked and read-only
486 creating temporary repository to stage migrated data: $TESTTMP/modern/.hg/upgrade.* (glob)
486 creating temporary repository to stage upgraded data: $TESTTMP/modern/.hg/upgrade.* (glob)
487 487 (it is safe to interrupt this process any time before data migration completes)
488 data fully migrated to temporary repository
488 data fully upgraded in a temporary repository
489 489 marking source repository as being upgraded; clients will be unable to read from repository
490 490 starting in-place swap of repository data
491 491 replaced files will be backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
492 492 replacing store...
493 493 store replacement complete; repository was inconsistent for *s (glob)
494 494 finalizing requirements file and making repository readable again
495 495 removing temporary repository $TESTTMP/modern/.hg/upgrade.* (glob)
496 496 copy of old repository backed up at $TESTTMP/modern/.hg/upgradebackup.* (glob)
497 497 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
498 498
499 499 Upgrading a repository to generaldelta works
500 500
501 501 $ hg --config format.usegeneraldelta=false init upgradegd
502 502 $ cd upgradegd
503 503 $ touch f0
504 504 $ hg -q commit -A -m initial
505 505 $ mkdir FooBarDirectory.d
506 506 $ touch FooBarDirectory.d/f1
507 507 $ hg -q commit -A -m 'add f1'
508 508 $ hg -q up -r 0
509 509 >>> from __future__ import absolute_import, print_function
510 510 >>> import random
511 511 >>> random.seed(0) # have a reproducible content
512 512 >>> with open("f2", "wb") as f:
513 513 ... for i in range(100000):
514 514 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
515 515 $ hg -q commit -A -m 'add f2'
516 516
517 517 make sure we have a .d file
518 518
519 519 $ ls -d .hg/store/data/*
520 520 .hg/store/data/_foo_bar_directory.d.hg
521 521 .hg/store/data/f0.i
522 522 .hg/store/data/f2.d
523 523 .hg/store/data/f2.i
524 524
525 525 $ hg debugupgraderepo --run --config format.sparse-revlog=false
526 526 upgrade will perform the following actions:
527 527
528 528 requirements
529 529 preserved: dotencode, fncache, revlogv1, store
530 530 added: generaldelta
531 531
532 532 generaldelta
533 533 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
534 534
535 535 processed revlogs:
536 536 - all-filelogs
537 537 - changelog
538 538 - manifest
539 539
540 540 beginning upgrade...
541 541 repository locked and read-only
542 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
542 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
543 543 (it is safe to interrupt this process any time before data migration completes)
544 544 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
545 545 migrating 519 KB in store; 1.05 MB tracked data
546 546 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
547 547 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
548 548 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
549 549 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
550 550 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
551 551 finished migrating 3 changelog revisions; change in size: 0 bytes
552 552 finished migrating 9 total revisions; total change in store size: -17 bytes
553 553 copying phaseroots
554 data fully migrated to temporary repository
554 data fully upgraded in a temporary repository
555 555 marking source repository as being upgraded; clients will be unable to read from repository
556 556 starting in-place swap of repository data
557 557 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
558 558 replacing store...
559 559 store replacement complete; repository was inconsistent for *s (glob)
560 560 finalizing requirements file and making repository readable again
561 561 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
562 562 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
563 563 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
564 564
565 565 Original requirements backed up
566 566
567 567 $ cat .hg/upgradebackup.*/requires
568 568 dotencode
569 569 fncache
570 570 revlogv1
571 571 store
572 572
573 573 generaldelta added to original requirements files
574 574
575 575 $ cat .hg/requires
576 576 dotencode
577 577 fncache
578 578 generaldelta
579 579 revlogv1
580 580 store
581 581
582 582 store directory has files we expect
583 583
584 584 $ ls .hg/store
585 585 00changelog.i
586 586 00manifest.i
587 587 data
588 588 fncache
589 589 phaseroots
590 590 undo
591 591 undo.backupfiles
592 592 undo.phaseroots
593 593
594 594 manifest should be generaldelta
595 595
596 596 $ hg debugrevlog -m | grep flags
597 597 flags : inline, generaldelta
598 598
599 599 verify should be happy
600 600
601 601 $ hg verify
602 602 checking changesets
603 603 checking manifests
604 604 crosschecking files in changesets and manifests
605 605 checking files
606 606 checked 3 changesets with 3 changes to 3 files
607 607
608 608 old store should be backed up
609 609
610 610 $ ls -d .hg/upgradebackup.*/
611 611 .hg/upgradebackup.*/ (glob)
612 612 $ ls .hg/upgradebackup.*/store
613 613 00changelog.i
614 614 00manifest.i
615 615 data
616 616 fncache
617 617 phaseroots
618 618 undo
619 619 undo.backup.fncache
620 620 undo.backupfiles
621 621 undo.phaseroots
622 622
623 623 unless --no-backup is passed
624 624
625 625 $ rm -rf .hg/upgradebackup.*/
626 626 $ hg debugupgraderepo --run --no-backup
627 627 upgrade will perform the following actions:
628 628
629 629 requirements
630 630 preserved: dotencode, fncache, generaldelta, revlogv1, store
631 631 added: sparserevlog
632 632
633 633 sparserevlog
634 634 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.
635 635
636 636 processed revlogs:
637 637 - all-filelogs
638 638 - changelog
639 639 - manifest
640 640
641 641 beginning upgrade...
642 642 repository locked and read-only
643 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
643 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
644 644 (it is safe to interrupt this process any time before data migration completes)
645 645 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
646 646 migrating 519 KB in store; 1.05 MB tracked data
647 647 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
648 648 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
649 649 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
650 650 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
651 651 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
652 652 finished migrating 3 changelog revisions; change in size: 0 bytes
653 653 finished migrating 9 total revisions; total change in store size: 0 bytes
654 654 copying phaseroots
655 data fully migrated to temporary repository
655 data fully upgraded in a temporary repository
656 656 marking source repository as being upgraded; clients will be unable to read from repository
657 657 starting in-place swap of repository data
658 658 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
659 659 replacing store...
660 660 store replacement complete; repository was inconsistent for * (glob)
661 661 finalizing requirements file and making repository readable again
662 662 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
663 663 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
664 664 $ ls -1 .hg/ | grep upgradebackup
665 665 [1]
666 666
667 667 We can restrict optimization to some revlog:
668 668
669 669 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
670 670 upgrade will perform the following actions:
671 671
672 672 requirements
673 673 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
674 674
675 675 optimisations: re-delta-parent
676 676
677 677 re-delta-parent
678 678 deltas within internal storage will choose a new base revision if needed
679 679
680 680 processed revlogs:
681 681 - manifest
682 682
683 683 beginning upgrade...
684 684 repository locked and read-only
685 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
685 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
686 686 (it is safe to interrupt this process any time before data migration completes)
687 687 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
688 688 migrating 519 KB in store; 1.05 MB tracked data
689 689 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
690 690 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
691 691 blindly copying data/f0.i containing 1 revisions
692 692 blindly copying data/f2.i containing 1 revisions
693 693 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
694 694 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
695 695 cloning 3 revisions from 00manifest.i
696 696 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
697 697 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
698 698 blindly copying 00changelog.i containing 3 revisions
699 699 finished migrating 3 changelog revisions; change in size: 0 bytes
700 700 finished migrating 9 total revisions; total change in store size: 0 bytes
701 701 copying phaseroots
702 data fully migrated to temporary repository
702 data fully upgraded in a temporary repository
703 703 marking source repository as being upgraded; clients will be unable to read from repository
704 704 starting in-place swap of repository data
705 705 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
706 706 replacing store...
707 707 store replacement complete; repository was inconsistent for *s (glob)
708 708 finalizing requirements file and making repository readable again
709 709 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
710 710 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
711 711
712 712 Check that the repo still works fine
713 713
714 714 $ hg log -G --stat
715 715 @ changeset: 2:76d4395f5413 (no-py3 !)
716 716 @ changeset: 2:fca376863211 (py3 !)
717 717 | tag: tip
718 718 | parent: 0:ba592bf28da2
719 719 | user: test
720 720 | date: Thu Jan 01 00:00:00 1970 +0000
721 721 | summary: add f2
722 722 |
723 723 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
724 724 | 1 files changed, 100000 insertions(+), 0 deletions(-)
725 725 |
726 726 | o changeset: 1:2029ce2354e2
727 727 |/ user: test
728 728 | date: Thu Jan 01 00:00:00 1970 +0000
729 729 | summary: add f1
730 730 |
731 731 |
732 732 o changeset: 0:ba592bf28da2
733 733 user: test
734 734 date: Thu Jan 01 00:00:00 1970 +0000
735 735 summary: initial
736 736
737 737
738 738
739 739 $ hg verify
740 740 checking changesets
741 741 checking manifests
742 742 crosschecking files in changesets and manifests
743 743 checking files
744 744 checked 3 changesets with 3 changes to 3 files
745 745
746 746 Check we can select negatively
747 747
748 748 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
749 749 upgrade will perform the following actions:
750 750
751 751 requirements
752 752 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
753 753
754 754 optimisations: re-delta-parent
755 755
756 756 re-delta-parent
757 757 deltas within internal storage will choose a new base revision if needed
758 758
759 759 processed revlogs:
760 760 - all-filelogs
761 761 - changelog
762 762
763 763 beginning upgrade...
764 764 repository locked and read-only
765 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
765 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
766 766 (it is safe to interrupt this process any time before data migration completes)
767 767 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
768 768 migrating 519 KB in store; 1.05 MB tracked data
769 769 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
770 770 cloning 1 revisions from data/FooBarDirectory.d/f1.i
771 771 cloning 1 revisions from data/f0.i
772 772 cloning 1 revisions from data/f2.i
773 773 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
774 774 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
775 775 blindly copying 00manifest.i containing 3 revisions
776 776 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
777 777 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
778 778 cloning 3 revisions from 00changelog.i
779 779 finished migrating 3 changelog revisions; change in size: 0 bytes
780 780 finished migrating 9 total revisions; total change in store size: 0 bytes
781 781 copying phaseroots
782 data fully migrated to temporary repository
782 data fully upgraded in a temporary repository
783 783 marking source repository as being upgraded; clients will be unable to read from repository
784 784 starting in-place swap of repository data
785 785 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
786 786 replacing store...
787 787 store replacement complete; repository was inconsistent for *s (glob)
788 788 finalizing requirements file and making repository readable again
789 789 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
790 790 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
791 791 $ hg verify
792 792 checking changesets
793 793 checking manifests
794 794 crosschecking files in changesets and manifests
795 795 checking files
796 796 checked 3 changesets with 3 changes to 3 files
797 797
798 798 Check that we can select changelog only
799 799
800 800 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
801 801 upgrade will perform the following actions:
802 802
803 803 requirements
804 804 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
805 805
806 806 optimisations: re-delta-parent
807 807
808 808 re-delta-parent
809 809 deltas within internal storage will choose a new base revision if needed
810 810
811 811 processed revlogs:
812 812 - changelog
813 813
814 814 beginning upgrade...
815 815 repository locked and read-only
816 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
816 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
817 817 (it is safe to interrupt this process any time before data migration completes)
818 818 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
819 819 migrating 519 KB in store; 1.05 MB tracked data
820 820 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
821 821 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
822 822 blindly copying data/f0.i containing 1 revisions
823 823 blindly copying data/f2.i containing 1 revisions
824 824 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
825 825 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
826 826 blindly copying 00manifest.i containing 3 revisions
827 827 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
828 828 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
829 829 cloning 3 revisions from 00changelog.i
830 830 finished migrating 3 changelog revisions; change in size: 0 bytes
831 831 finished migrating 9 total revisions; total change in store size: 0 bytes
832 832 copying phaseroots
833 data fully migrated to temporary repository
833 data fully upgraded in a temporary repository
834 834 marking source repository as being upgraded; clients will be unable to read from repository
835 835 starting in-place swap of repository data
836 836 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
837 837 replacing store...
838 838 store replacement complete; repository was inconsistent for *s (glob)
839 839 finalizing requirements file and making repository readable again
840 840 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
841 841 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
842 842 $ hg verify
843 843 checking changesets
844 844 checking manifests
845 845 crosschecking files in changesets and manifests
846 846 checking files
847 847 checked 3 changesets with 3 changes to 3 files
848 848
849 849 Check that we can select filelog only
850 850
851 851 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
852 852 upgrade will perform the following actions:
853 853
854 854 requirements
855 855 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
856 856
857 857 optimisations: re-delta-parent
858 858
859 859 re-delta-parent
860 860 deltas within internal storage will choose a new base revision if needed
861 861
862 862 processed revlogs:
863 863 - all-filelogs
864 864
865 865 beginning upgrade...
866 866 repository locked and read-only
867 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
867 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
868 868 (it is safe to interrupt this process any time before data migration completes)
869 869 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
870 870 migrating 519 KB in store; 1.05 MB tracked data
871 871 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
872 872 cloning 1 revisions from data/FooBarDirectory.d/f1.i
873 873 cloning 1 revisions from data/f0.i
874 874 cloning 1 revisions from data/f2.i
875 875 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
876 876 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
877 877 blindly copying 00manifest.i containing 3 revisions
878 878 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
879 879 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
880 880 blindly copying 00changelog.i containing 3 revisions
881 881 finished migrating 3 changelog revisions; change in size: 0 bytes
882 882 finished migrating 9 total revisions; total change in store size: 0 bytes
883 883 copying phaseroots
884 data fully migrated to temporary repository
884 data fully upgraded in a temporary repository
885 885 marking source repository as being upgraded; clients will be unable to read from repository
886 886 starting in-place swap of repository data
887 887 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
888 888 replacing store...
889 889 store replacement complete; repository was inconsistent for *s (glob)
890 890 finalizing requirements file and making repository readable again
891 891 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
892 892 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
893 893 $ hg verify
894 894 checking changesets
895 895 checking manifests
896 896 crosschecking files in changesets and manifests
897 897 checking files
898 898 checked 3 changesets with 3 changes to 3 files
899 899
900 900
901 901 Check you can't skip revlog clone during important format downgrade
902 902
903 903 $ echo "[format]" > .hg/hgrc
904 904 $ echo "sparse-revlog=no" >> .hg/hgrc
905 905 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
906 906 ignoring revlogs selection flags, format requirements change: sparserevlog
907 907 upgrade will perform the following actions:
908 908
909 909 requirements
910 910 preserved: dotencode, fncache, generaldelta, revlogv1, store
911 911 removed: sparserevlog
912 912
913 913 optimisations: re-delta-parent
914 914
915 915 re-delta-parent
916 916 deltas within internal storage will choose a new base revision if needed
917 917
918 918 processed revlogs:
919 919 - all-filelogs
920 920 - changelog
921 921 - manifest
922 922
923 923 beginning upgrade...
924 924 repository locked and read-only
925 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
925 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
926 926 (it is safe to interrupt this process any time before data migration completes)
927 927 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
928 928 migrating 519 KB in store; 1.05 MB tracked data
929 929 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
930 930 cloning 1 revisions from data/FooBarDirectory.d/f1.i
931 931 cloning 1 revisions from data/f0.i
932 932 cloning 1 revisions from data/f2.i
933 933 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
934 934 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
935 935 cloning 3 revisions from 00manifest.i
936 936 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
937 937 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
938 938 cloning 3 revisions from 00changelog.i
939 939 finished migrating 3 changelog revisions; change in size: 0 bytes
940 940 finished migrating 9 total revisions; total change in store size: 0 bytes
941 941 copying phaseroots
942 data fully migrated to temporary repository
942 data fully upgraded in a temporary repository
943 943 marking source repository as being upgraded; clients will be unable to read from repository
944 944 starting in-place swap of repository data
945 945 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
946 946 replacing store...
947 947 store replacement complete; repository was inconsistent for *s (glob)
948 948 finalizing requirements file and making repository readable again
949 949 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
950 950 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
951 951 $ hg verify
952 952 checking changesets
953 953 checking manifests
954 954 crosschecking files in changesets and manifests
955 955 checking files
956 956 checked 3 changesets with 3 changes to 3 files
957 957
958 958 Check you can't skip revlog clone during important format upgrade
959 959
960 960 $ echo "sparse-revlog=yes" >> .hg/hgrc
961 961 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
962 962 ignoring revlogs selection flags, format requirements change: sparserevlog
963 963 upgrade will perform the following actions:
964 964
965 965 requirements
966 966 preserved: dotencode, fncache, generaldelta, revlogv1, store
967 967 added: sparserevlog
968 968
969 969 optimisations: re-delta-parent
970 970
971 971 sparserevlog
972 972 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.
973 973
974 974 re-delta-parent
975 975 deltas within internal storage will choose a new base revision if needed
976 976
977 977 processed revlogs:
978 978 - all-filelogs
979 979 - changelog
980 980 - manifest
981 981
982 982 beginning upgrade...
983 983 repository locked and read-only
984 creating temporary repository to stage migrated data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
984 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
985 985 (it is safe to interrupt this process any time before data migration completes)
986 986 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
987 987 migrating 519 KB in store; 1.05 MB tracked data
988 988 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
989 989 cloning 1 revisions from data/FooBarDirectory.d/f1.i
990 990 cloning 1 revisions from data/f0.i
991 991 cloning 1 revisions from data/f2.i
992 992 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
993 993 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
994 994 cloning 3 revisions from 00manifest.i
995 995 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
996 996 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
997 997 cloning 3 revisions from 00changelog.i
998 998 finished migrating 3 changelog revisions; change in size: 0 bytes
999 999 finished migrating 9 total revisions; total change in store size: 0 bytes
1000 1000 copying phaseroots
1001 data fully migrated to temporary repository
1001 data fully upgraded in a temporary repository
1002 1002 marking source repository as being upgraded; clients will be unable to read from repository
1003 1003 starting in-place swap of repository data
1004 1004 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
1005 1005 replacing store...
1006 1006 store replacement complete; repository was inconsistent for *s (glob)
1007 1007 finalizing requirements file and making repository readable again
1008 1008 removing old repository content $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
1009 1009 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1010 1010 $ hg verify
1011 1011 checking changesets
1012 1012 checking manifests
1013 1013 crosschecking files in changesets and manifests
1014 1014 checking files
1015 1015 checked 3 changesets with 3 changes to 3 files
1016 1016
1017 1017 $ cd ..
1018 1018
1019 1019 store files with special filenames aren't encoded during copy
1020 1020
1021 1021 $ hg init store-filenames
1022 1022 $ cd store-filenames
1023 1023 $ touch foo
1024 1024 $ hg -q commit -A -m initial
1025 1025 $ touch .hg/store/.XX_special_filename
1026 1026
1027 1027 $ hg debugupgraderepo --run
1028 1028 upgrade will perform the following actions:
1029 1029
1030 1030 requirements
1031 1031 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1032 1032
1033 1033 processed revlogs:
1034 1034 - all-filelogs
1035 1035 - changelog
1036 1036 - manifest
1037 1037
1038 1038 beginning upgrade...
1039 1039 repository locked and read-only
1040 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1040 creating temporary repository to stage upgraded data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1041 1041 (it is safe to interrupt this process any time before data migration completes)
1042 1042 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1043 1043 migrating 301 bytes in store; 107 bytes tracked data
1044 1044 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
1045 1045 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1046 1046 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
1047 1047 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1048 1048 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
1049 1049 finished migrating 1 changelog revisions; change in size: 0 bytes
1050 1050 finished migrating 3 total revisions; total change in store size: 0 bytes
1051 1051 copying .XX_special_filename
1052 1052 copying phaseroots
1053 data fully migrated to temporary repository
1053 data fully upgraded in a temporary repository
1054 1054 marking source repository as being upgraded; clients will be unable to read from repository
1055 1055 starting in-place swap of repository data
1056 1056 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1057 1057 replacing store...
1058 1058 store replacement complete; repository was inconsistent for *s (glob)
1059 1059 finalizing requirements file and making repository readable again
1060 1060 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1061 1061 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1062 1062 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1063 1063 $ hg debugupgraderepo --run --optimize 're-delta-fulladd'
1064 1064 upgrade will perform the following actions:
1065 1065
1066 1066 requirements
1067 1067 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1068 1068
1069 1069 optimisations: re-delta-fulladd
1070 1070
1071 1071 re-delta-fulladd
1072 1072 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
1073 1073
1074 1074 processed revlogs:
1075 1075 - all-filelogs
1076 1076 - changelog
1077 1077 - manifest
1078 1078
1079 1079 beginning upgrade...
1080 1080 repository locked and read-only
1081 creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1081 creating temporary repository to stage upgraded data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1082 1082 (it is safe to interrupt this process any time before data migration completes)
1083 1083 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1084 1084 migrating 301 bytes in store; 107 bytes tracked data
1085 1085 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
1086 1086 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1087 1087 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
1088 1088 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1089 1089 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
1090 1090 finished migrating 1 changelog revisions; change in size: 0 bytes
1091 1091 finished migrating 3 total revisions; total change in store size: 0 bytes
1092 1092 copying .XX_special_filename
1093 1093 copying phaseroots
1094 data fully migrated to temporary repository
1094 data fully upgraded in a temporary repository
1095 1095 marking source repository as being upgraded; clients will be unable to read from repository
1096 1096 starting in-place swap of repository data
1097 1097 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1098 1098 replacing store...
1099 1099 store replacement complete; repository was inconsistent for *s (glob)
1100 1100 finalizing requirements file and making repository readable again
1101 1101 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1102 1102 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1103 1103 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1104 1104
1105 1105 fncache is valid after upgrade
1106 1106
1107 1107 $ hg debugrebuildfncache
1108 1108 fncache already up to date
1109 1109
1110 1110 $ cd ..
1111 1111
1112 1112 Check upgrading a large file repository
1113 1113 ---------------------------------------
1114 1114
1115 1115 $ hg init largefilesrepo
1116 1116 $ cat << EOF >> largefilesrepo/.hg/hgrc
1117 1117 > [extensions]
1118 1118 > largefiles =
1119 1119 > EOF
1120 1120
1121 1121 $ cd largefilesrepo
1122 1122 $ touch foo
1123 1123 $ hg add --large foo
1124 1124 $ hg -q commit -m initial
1125 1125 $ cat .hg/requires
1126 1126 dotencode
1127 1127 fncache
1128 1128 generaldelta
1129 1129 largefiles
1130 1130 revlogv1
1131 1131 sparserevlog
1132 1132 store
1133 1133
1134 1134 $ hg debugupgraderepo --run
1135 1135 upgrade will perform the following actions:
1136 1136
1137 1137 requirements
1138 1138 preserved: dotencode, fncache, generaldelta, largefiles, revlogv1, sparserevlog, store
1139 1139
1140 1140 processed revlogs:
1141 1141 - all-filelogs
1142 1142 - changelog
1143 1143 - manifest
1144 1144
1145 1145 beginning upgrade...
1146 1146 repository locked and read-only
1147 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1147 creating temporary repository to stage upgraded data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1148 1148 (it is safe to interrupt this process any time before data migration completes)
1149 1149 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1150 1150 migrating 355 bytes in store; 160 bytes tracked data
1151 1151 migrating 1 filelogs containing 1 revisions (106 bytes in store; 41 bytes tracked data)
1152 1152 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1153 1153 migrating 1 manifests containing 1 revisions (116 bytes in store; 51 bytes tracked data)
1154 1154 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1155 1155 migrating changelog containing 1 revisions (133 bytes in store; 68 bytes tracked data)
1156 1156 finished migrating 1 changelog revisions; change in size: 0 bytes
1157 1157 finished migrating 3 total revisions; total change in store size: 0 bytes
1158 1158 copying phaseroots
1159 data fully migrated to temporary repository
1159 data fully upgraded in a temporary repository
1160 1160 marking source repository as being upgraded; clients will be unable to read from repository
1161 1161 starting in-place swap of repository data
1162 1162 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1163 1163 replacing store...
1164 1164 store replacement complete; repository was inconsistent for *s (glob)
1165 1165 finalizing requirements file and making repository readable again
1166 1166 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1167 1167 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1168 1168 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1169 1169 $ cat .hg/requires
1170 1170 dotencode
1171 1171 fncache
1172 1172 generaldelta
1173 1173 largefiles
1174 1174 revlogv1
1175 1175 sparserevlog
1176 1176 store
1177 1177
1178 1178 $ cat << EOF >> .hg/hgrc
1179 1179 > [extensions]
1180 1180 > lfs =
1181 1181 > [lfs]
1182 1182 > threshold = 10
1183 1183 > EOF
1184 1184 $ echo '123456789012345' > lfs.bin
1185 1185 $ hg ci -Am 'lfs.bin'
1186 1186 adding lfs.bin
1187 1187 $ grep lfs .hg/requires
1188 1188 lfs
1189 1189 $ find .hg/store/lfs -type f
1190 1190 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1191 1191
1192 1192 $ hg debugupgraderepo --run
1193 1193 upgrade will perform the following actions:
1194 1194
1195 1195 requirements
1196 1196 preserved: dotencode, fncache, generaldelta, largefiles, lfs, revlogv1, sparserevlog, store
1197 1197
1198 1198 processed revlogs:
1199 1199 - all-filelogs
1200 1200 - changelog
1201 1201 - manifest
1202 1202
1203 1203 beginning upgrade...
1204 1204 repository locked and read-only
1205 creating temporary repository to stage migrated data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1205 creating temporary repository to stage upgraded data: $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1206 1206 (it is safe to interrupt this process any time before data migration completes)
1207 1207 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
1208 1208 migrating 801 bytes in store; 467 bytes tracked data
1209 1209 migrating 2 filelogs containing 2 revisions (296 bytes in store; 182 bytes tracked data)
1210 1210 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
1211 1211 migrating 1 manifests containing 2 revisions (241 bytes in store; 151 bytes tracked data)
1212 1212 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
1213 1213 migrating changelog containing 2 revisions (264 bytes in store; 134 bytes tracked data)
1214 1214 finished migrating 2 changelog revisions; change in size: 0 bytes
1215 1215 finished migrating 6 total revisions; total change in store size: 0 bytes
1216 1216 copying phaseroots
1217 1217 copying lfs blob d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1218 data fully migrated to temporary repository
1218 data fully upgraded in a temporary repository
1219 1219 marking source repository as being upgraded; clients will be unable to read from repository
1220 1220 starting in-place swap of repository data
1221 1221 replaced files will be backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1222 1222 replacing store...
1223 1223 store replacement complete; repository was inconsistent for *s (glob)
1224 1224 finalizing requirements file and making repository readable again
1225 1225 removing temporary repository $TESTTMP/largefilesrepo/.hg/upgrade.* (glob)
1226 1226 copy of old repository backed up at $TESTTMP/largefilesrepo/.hg/upgradebackup.* (glob)
1227 1227 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1228 1228
1229 1229 $ grep lfs .hg/requires
1230 1230 lfs
1231 1231 $ find .hg/store/lfs -type f
1232 1232 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1233 1233 $ hg verify
1234 1234 checking changesets
1235 1235 checking manifests
1236 1236 crosschecking files in changesets and manifests
1237 1237 checking files
1238 1238 checked 2 changesets with 2 changes to 2 files
1239 1239 $ hg debugdata lfs.bin 0
1240 1240 version https://git-lfs.github.com/spec/v1
1241 1241 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1242 1242 size 16
1243 1243 x-is-binary 0
1244 1244
1245 1245 $ cd ..
1246 1246
1247 1247 repository config is taken in account
1248 1248 -------------------------------------
1249 1249
1250 1250 $ cat << EOF >> $HGRCPATH
1251 1251 > [format]
1252 1252 > maxchainlen = 1
1253 1253 > EOF
1254 1254
1255 1255 $ hg init localconfig
1256 1256 $ cd localconfig
1257 1257 $ cat << EOF > file
1258 1258 > some content
1259 1259 > with some length
1260 1260 > to make sure we get a delta
1261 1261 > after changes
1262 1262 > very long
1263 1263 > very long
1264 1264 > very long
1265 1265 > very long
1266 1266 > very long
1267 1267 > very long
1268 1268 > very long
1269 1269 > very long
1270 1270 > very long
1271 1271 > very long
1272 1272 > very long
1273 1273 > EOF
1274 1274 $ hg -q commit -A -m A
1275 1275 $ echo "new line" >> file
1276 1276 $ hg -q commit -m B
1277 1277 $ echo "new line" >> file
1278 1278 $ hg -q commit -m C
1279 1279
1280 1280 $ cat << EOF >> .hg/hgrc
1281 1281 > [format]
1282 1282 > maxchainlen = 9001
1283 1283 > EOF
1284 1284 $ hg config format
1285 1285 format.maxchainlen=9001
1286 1286 $ hg debugdeltachain file
1287 1287 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1288 1288 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1289 1289 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1290 1290 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1291 1291
1292 1292 $ hg debugupgraderepo --run --optimize 're-delta-all'
1293 1293 upgrade will perform the following actions:
1294 1294
1295 1295 requirements
1296 1296 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1297 1297
1298 1298 optimisations: re-delta-all
1299 1299
1300 1300 re-delta-all
1301 1301 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1302 1302
1303 1303 processed revlogs:
1304 1304 - all-filelogs
1305 1305 - changelog
1306 1306 - manifest
1307 1307
1308 1308 beginning upgrade...
1309 1309 repository locked and read-only
1310 creating temporary repository to stage migrated data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1310 creating temporary repository to stage upgraded data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1311 1311 (it is safe to interrupt this process any time before data migration completes)
1312 1312 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1313 1313 migrating 1019 bytes in store; 882 bytes tracked data
1314 1314 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1315 1315 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1316 1316 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1317 1317 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1318 1318 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1319 1319 finished migrating 3 changelog revisions; change in size: 0 bytes
1320 1320 finished migrating 9 total revisions; total change in store size: -9 bytes
1321 1321 copying phaseroots
1322 data fully migrated to temporary repository
1322 data fully upgraded in a temporary repository
1323 1323 marking source repository as being upgraded; clients will be unable to read from repository
1324 1324 starting in-place swap of repository data
1325 1325 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1326 1326 replacing store...
1327 1327 store replacement complete; repository was inconsistent for *s (glob)
1328 1328 finalizing requirements file and making repository readable again
1329 1329 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1330 1330 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1331 1331 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1332 1332 $ hg debugdeltachain file
1333 1333 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1334 1334 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1335 1335 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1336 1336 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1337 1337 $ cd ..
1338 1338
1339 1339 $ cat << EOF >> $HGRCPATH
1340 1340 > [format]
1341 1341 > maxchainlen = 9001
1342 1342 > EOF
1343 1343
1344 1344 Check upgrading a sparse-revlog repository
1345 1345 ---------------------------------------
1346 1346
1347 1347 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1348 1348 $ cd sparserevlogrepo
1349 1349 $ touch foo
1350 1350 $ hg add foo
1351 1351 $ hg -q commit -m "foo"
1352 1352 $ cat .hg/requires
1353 1353 dotencode
1354 1354 fncache
1355 1355 generaldelta
1356 1356 revlogv1
1357 1357 store
1358 1358
1359 1359 Check that we can add the sparse-revlog format requirement
1360 1360 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1361 1361 upgrade will perform the following actions:
1362 1362
1363 1363 requirements
1364 1364 preserved: dotencode, fncache, generaldelta, revlogv1, store
1365 1365 added: sparserevlog
1366 1366
1367 1367 processed revlogs:
1368 1368 - all-filelogs
1369 1369 - changelog
1370 1370 - manifest
1371 1371
1372 1372 $ cat .hg/requires
1373 1373 dotencode
1374 1374 fncache
1375 1375 generaldelta
1376 1376 revlogv1
1377 1377 sparserevlog
1378 1378 store
1379 1379
1380 1380 Check that we can remove the sparse-revlog format requirement
1381 1381 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1382 1382 upgrade will perform the following actions:
1383 1383
1384 1384 requirements
1385 1385 preserved: dotencode, fncache, generaldelta, revlogv1, store
1386 1386 removed: sparserevlog
1387 1387
1388 1388 processed revlogs:
1389 1389 - all-filelogs
1390 1390 - changelog
1391 1391 - manifest
1392 1392
1393 1393 $ cat .hg/requires
1394 1394 dotencode
1395 1395 fncache
1396 1396 generaldelta
1397 1397 revlogv1
1398 1398 store
1399 1399
1400 1400 #if zstd
1401 1401
1402 1402 Check upgrading to a zstd revlog
1403 1403 --------------------------------
1404 1404
1405 1405 upgrade
1406 1406
1407 1407 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1408 1408 upgrade will perform the following actions:
1409 1409
1410 1410 requirements
1411 1411 preserved: dotencode, fncache, generaldelta, revlogv1, store
1412 1412 added: revlog-compression-zstd, sparserevlog
1413 1413
1414 1414 processed revlogs:
1415 1415 - all-filelogs
1416 1416 - changelog
1417 1417 - manifest
1418 1418
1419 1419 $ hg debugformat -v
1420 1420 format-variant repo config default
1421 1421 fncache: yes yes yes
1422 1422 dotencode: yes yes yes
1423 1423 generaldelta: yes yes yes
1424 1424 exp-sharesafe: no no no
1425 1425 sparserevlog: yes yes yes
1426 1426 sidedata: no no no
1427 1427 persistent-nodemap: no no no
1428 1428 copies-sdc: no no no
1429 1429 plain-cl-delta: yes yes yes
1430 1430 compression: zstd zlib zlib
1431 1431 compression-level: default default default
1432 1432 $ cat .hg/requires
1433 1433 dotencode
1434 1434 fncache
1435 1435 generaldelta
1436 1436 revlog-compression-zstd
1437 1437 revlogv1
1438 1438 sparserevlog
1439 1439 store
1440 1440
1441 1441 downgrade
1442 1442
1443 1443 $ hg debugupgraderepo --run --no-backup --quiet
1444 1444 upgrade will perform the following actions:
1445 1445
1446 1446 requirements
1447 1447 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1448 1448 removed: revlog-compression-zstd
1449 1449
1450 1450 processed revlogs:
1451 1451 - all-filelogs
1452 1452 - changelog
1453 1453 - manifest
1454 1454
1455 1455 $ hg debugformat -v
1456 1456 format-variant repo config default
1457 1457 fncache: yes yes yes
1458 1458 dotencode: yes yes yes
1459 1459 generaldelta: yes yes yes
1460 1460 exp-sharesafe: no no no
1461 1461 sparserevlog: yes yes yes
1462 1462 sidedata: no no no
1463 1463 persistent-nodemap: no no no
1464 1464 copies-sdc: no no no
1465 1465 plain-cl-delta: yes yes yes
1466 1466 compression: zlib zlib zlib
1467 1467 compression-level: default default default
1468 1468 $ cat .hg/requires
1469 1469 dotencode
1470 1470 fncache
1471 1471 generaldelta
1472 1472 revlogv1
1473 1473 sparserevlog
1474 1474 store
1475 1475
1476 1476 upgrade from hgrc
1477 1477
1478 1478 $ cat >> .hg/hgrc << EOF
1479 1479 > [format]
1480 1480 > revlog-compression=zstd
1481 1481 > EOF
1482 1482 $ hg debugupgraderepo --run --no-backup --quiet
1483 1483 upgrade will perform the following actions:
1484 1484
1485 1485 requirements
1486 1486 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1487 1487 added: revlog-compression-zstd
1488 1488
1489 1489 processed revlogs:
1490 1490 - all-filelogs
1491 1491 - changelog
1492 1492 - manifest
1493 1493
1494 1494 $ hg debugformat -v
1495 1495 format-variant repo config default
1496 1496 fncache: yes yes yes
1497 1497 dotencode: yes yes yes
1498 1498 generaldelta: yes yes yes
1499 1499 exp-sharesafe: no no no
1500 1500 sparserevlog: yes yes yes
1501 1501 sidedata: no no no
1502 1502 persistent-nodemap: no no no
1503 1503 copies-sdc: no no no
1504 1504 plain-cl-delta: yes yes yes
1505 1505 compression: zstd zstd zlib
1506 1506 compression-level: default default default
1507 1507 $ cat .hg/requires
1508 1508 dotencode
1509 1509 fncache
1510 1510 generaldelta
1511 1511 revlog-compression-zstd
1512 1512 revlogv1
1513 1513 sparserevlog
1514 1514 store
1515 1515
1516 1516 #endif
1517 1517
1518 1518 Check upgrading to a side-data revlog
1519 1519 -------------------------------------
1520 1520
1521 1521 upgrade
1522 1522
1523 1523 $ hg --config format.exp-use-side-data=yes debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1524 1524 upgrade will perform the following actions:
1525 1525
1526 1526 requirements
1527 1527 preserved: dotencode, fncache, generaldelta, revlogv1, store (no-zstd !)
1528 1528 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1529 1529 added: exp-sidedata-flag (zstd !)
1530 1530 added: exp-sidedata-flag, sparserevlog (no-zstd !)
1531 1531
1532 1532 processed revlogs:
1533 1533 - all-filelogs
1534 1534 - changelog
1535 1535 - manifest
1536 1536
1537 1537 $ hg debugformat -v
1538 1538 format-variant repo config default
1539 1539 fncache: yes yes yes
1540 1540 dotencode: yes yes yes
1541 1541 generaldelta: yes yes yes
1542 1542 exp-sharesafe: no no no
1543 1543 sparserevlog: yes yes yes
1544 1544 sidedata: yes no no
1545 1545 persistent-nodemap: no no no
1546 1546 copies-sdc: no no no
1547 1547 plain-cl-delta: yes yes yes
1548 1548 compression: zlib zlib zlib (no-zstd !)
1549 1549 compression: zstd zstd zlib (zstd !)
1550 1550 compression-level: default default default
1551 1551 $ cat .hg/requires
1552 1552 dotencode
1553 1553 exp-sidedata-flag
1554 1554 fncache
1555 1555 generaldelta
1556 1556 revlog-compression-zstd (zstd !)
1557 1557 revlogv1
1558 1558 sparserevlog
1559 1559 store
1560 1560 $ hg debugsidedata -c 0
1561 1561 2 sidedata entries
1562 1562 entry-0001 size 4
1563 1563 entry-0002 size 32
1564 1564
1565 1565 downgrade
1566 1566
1567 1567 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup --quiet
1568 1568 upgrade will perform the following actions:
1569 1569
1570 1570 requirements
1571 1571 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1572 1572 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1573 1573 removed: exp-sidedata-flag
1574 1574
1575 1575 processed revlogs:
1576 1576 - all-filelogs
1577 1577 - changelog
1578 1578 - manifest
1579 1579
1580 1580 $ hg debugformat -v
1581 1581 format-variant repo config default
1582 1582 fncache: yes yes yes
1583 1583 dotencode: yes yes yes
1584 1584 generaldelta: yes yes yes
1585 1585 exp-sharesafe: no no no
1586 1586 sparserevlog: yes yes yes
1587 1587 sidedata: no no no
1588 1588 persistent-nodemap: no no no
1589 1589 copies-sdc: no no no
1590 1590 plain-cl-delta: yes yes yes
1591 1591 compression: zlib zlib zlib (no-zstd !)
1592 1592 compression: zstd zstd zlib (zstd !)
1593 1593 compression-level: default default default
1594 1594 $ cat .hg/requires
1595 1595 dotencode
1596 1596 fncache
1597 1597 generaldelta
1598 1598 revlog-compression-zstd (zstd !)
1599 1599 revlogv1
1600 1600 sparserevlog
1601 1601 store
1602 1602 $ hg debugsidedata -c 0
1603 1603
1604 1604 upgrade from hgrc
1605 1605
1606 1606 $ cat >> .hg/hgrc << EOF
1607 1607 > [format]
1608 1608 > exp-use-side-data=yes
1609 1609 > EOF
1610 1610 $ hg debugupgraderepo --run --no-backup --quiet
1611 1611 upgrade will perform the following actions:
1612 1612
1613 1613 requirements
1614 1614 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1615 1615 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1616 1616 added: exp-sidedata-flag
1617 1617
1618 1618 processed revlogs:
1619 1619 - all-filelogs
1620 1620 - changelog
1621 1621 - manifest
1622 1622
1623 1623 $ hg debugformat -v
1624 1624 format-variant repo config default
1625 1625 fncache: yes yes yes
1626 1626 dotencode: yes yes yes
1627 1627 generaldelta: yes yes yes
1628 1628 exp-sharesafe: no no no
1629 1629 sparserevlog: yes yes yes
1630 1630 sidedata: yes yes no
1631 1631 persistent-nodemap: no no no
1632 1632 copies-sdc: no no no
1633 1633 plain-cl-delta: yes yes yes
1634 1634 compression: zlib zlib zlib (no-zstd !)
1635 1635 compression: zstd zstd zlib (zstd !)
1636 1636 compression-level: default default default
1637 1637 $ cat .hg/requires
1638 1638 dotencode
1639 1639 exp-sidedata-flag
1640 1640 fncache
1641 1641 generaldelta
1642 1642 revlog-compression-zstd (zstd !)
1643 1643 revlogv1
1644 1644 sparserevlog
1645 1645 store
1646 1646 $ hg debugsidedata -c 0
General Comments 0
You need to be logged in to leave comments. Login now