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