##// END OF EJS Templates
upgrade: support the --quiet flag...
marmoute -
r45302:e295ba23 default
parent child Browse files
Show More
@@ -807,14 +807,14 b' def _clonerevlogs('
807 807 if not revcount:
808 808 return
809 809
810 ui.write(
810 ui.status(
811 811 _(
812 812 b'migrating %d total revisions (%d in filelogs, %d in manifests, '
813 813 b'%d in changelog)\n'
814 814 )
815 815 % (revcount, frevcount, mrevcount, crevcount)
816 816 )
817 ui.write(
817 ui.status(
818 818 _(b'migrating %s in store; %s tracked data\n')
819 819 % ((util.bytecount(srcsize), util.bytecount(srcrawsize)))
820 820 )
@@ -837,7 +837,7 b' def _clonerevlogs('
837 837 oldrl = _revlogfrompath(srcrepo, unencoded)
838 838
839 839 if isinstance(oldrl, changelog.changelog) and b'c' not in seen:
840 ui.write(
840 ui.status(
841 841 _(
842 842 b'finished migrating %d manifest revisions across %d '
843 843 b'manifests; change in size: %s\n'
@@ -845,7 +845,7 b' def _clonerevlogs('
845 845 % (mrevcount, mcount, util.bytecount(mdstsize - msrcsize))
846 846 )
847 847
848 ui.write(
848 ui.status(
849 849 _(
850 850 b'migrating changelog containing %d revisions '
851 851 b'(%s in store; %s tracked data)\n'
@@ -861,7 +861,7 b' def _clonerevlogs('
861 861 _(b'changelog revisions'), total=crevcount
862 862 )
863 863 elif isinstance(oldrl, manifest.manifestrevlog) and b'm' not in seen:
864 ui.write(
864 ui.status(
865 865 _(
866 866 b'finished migrating %d filelog revisions across %d '
867 867 b'filelogs; change in size: %s\n'
@@ -869,7 +869,7 b' def _clonerevlogs('
869 869 % (frevcount, fcount, util.bytecount(fdstsize - fsrcsize))
870 870 )
871 871
872 ui.write(
872 ui.status(
873 873 _(
874 874 b'migrating %d manifests containing %d revisions '
875 875 b'(%s in store; %s tracked data)\n'
@@ -888,7 +888,7 b' def _clonerevlogs('
888 888 _(b'manifest revisions'), total=mrevcount
889 889 )
890 890 elif b'f' not in seen:
891 ui.write(
891 ui.status(
892 892 _(
893 893 b'migrating %d filelogs containing %d revisions '
894 894 b'(%s in store; %s tracked data)\n'
@@ -941,7 +941,7 b' def _clonerevlogs('
941 941
942 942 progress.complete()
943 943
944 ui.write(
944 ui.status(
945 945 _(
946 946 b'finished migrating %d changelog revisions; change in size: '
947 947 b'%s\n'
@@ -949,7 +949,7 b' def _clonerevlogs('
949 949 % (crevcount, util.bytecount(cdstsize - csrcsize))
950 950 )
951 951
952 ui.write(
952 ui.status(
953 953 _(
954 954 b'finished migrating %d total revisions; total change in store '
955 955 b'size: %s\n'
@@ -1013,7 +1013,7 b' def _upgraderepo('
1013 1013 assert srcrepo.currentwlock()
1014 1014 assert dstrepo.currentwlock()
1015 1015
1016 ui.write(
1016 ui.status(
1017 1017 _(
1018 1018 b'(it is safe to interrupt this process any time before '
1019 1019 b'data migration completes)\n'
@@ -1048,14 +1048,14 b' def _upgraderepo('
1048 1048 if not _filterstorefile(srcrepo, dstrepo, requirements, p, kind, st):
1049 1049 continue
1050 1050
1051 srcrepo.ui.write(_(b'copying %s\n') % p)
1051 srcrepo.ui.status(_(b'copying %s\n') % p)
1052 1052 src = srcrepo.store.rawvfs.join(p)
1053 1053 dst = dstrepo.store.rawvfs.join(p)
1054 1054 util.copyfile(src, dst, copystat=True)
1055 1055
1056 1056 _finishdatamigration(ui, srcrepo, dstrepo, requirements)
1057 1057
1058 ui.write(_(b'data fully migrated to temporary repository\n'))
1058 ui.status(_(b'data fully migrated to temporary repository\n'))
1059 1059
1060 1060 backuppath = pycompat.mkdtemp(prefix=b'upgradebackup.', dir=srcrepo.path)
1061 1061 backupvfs = vfsmod.vfs(backuppath)
@@ -1067,7 +1067,7 b' def _upgraderepo('
1067 1067 # as a mechanism to lock out new clients during the data swap. This is
1068 1068 # better than allowing a client to continue while the repository is in
1069 1069 # an inconsistent state.
1070 ui.write(
1070 ui.status(
1071 1071 _(
1072 1072 b'marking source repository as being upgraded; clients will be '
1073 1073 b'unable to read from repository\n'
@@ -1077,18 +1077,18 b' def _upgraderepo('
1077 1077 srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'}
1078 1078 )
1079 1079
1080 ui.write(_(b'starting in-place swap of repository data\n'))
1081 ui.write(_(b'replaced files will be backed up at %s\n') % backuppath)
1080 ui.status(_(b'starting in-place swap of repository data\n'))
1081 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
1082 1082
1083 1083 # Now swap in the new store directory. Doing it as a rename should make
1084 1084 # the operation nearly instantaneous and atomic (at least in well-behaved
1085 1085 # environments).
1086 ui.write(_(b'replacing store...\n'))
1086 ui.status(_(b'replacing store...\n'))
1087 1087 tstart = util.timer()
1088 1088 util.rename(srcrepo.spath, backupvfs.join(b'store'))
1089 1089 util.rename(dstrepo.spath, srcrepo.spath)
1090 1090 elapsed = util.timer() - tstart
1091 ui.write(
1091 ui.status(
1092 1092 _(
1093 1093 b'store replacement complete; repository was inconsistent for '
1094 1094 b'%0.1fs\n'
@@ -1098,7 +1098,7 b' def _upgraderepo('
1098 1098
1099 1099 # We first write the requirements file. Any new requirements will lock
1100 1100 # out legacy clients.
1101 ui.write(
1101 ui.status(
1102 1102 _(
1103 1103 b'finalizing requirements file and making repository readable '
1104 1104 b'again\n'
@@ -1287,7 +1287,7 b' def upgraderepo('
1287 1287
1288 1288 def printupgradeactions():
1289 1289 for a in actions:
1290 ui.write(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
1290 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
1291 1291
1292 1292 if not run:
1293 1293 fromconfig = []
@@ -1302,35 +1302,35 b' def upgraderepo('
1302 1302 if fromconfig or onlydefault:
1303 1303
1304 1304 if fromconfig:
1305 ui.write(
1305 ui.status(
1306 1306 _(
1307 1307 b'repository lacks features recommended by '
1308 1308 b'current config options:\n\n'
1309 1309 )
1310 1310 )
1311 1311 for i in fromconfig:
1312 ui.write(b'%s\n %s\n\n' % (i.name, i.description))
1312 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1313 1313
1314 1314 if onlydefault:
1315 ui.write(
1315 ui.status(
1316 1316 _(
1317 1317 b'repository lacks features used by the default '
1318 1318 b'config options:\n\n'
1319 1319 )
1320 1320 )
1321 1321 for i in onlydefault:
1322 ui.write(b'%s\n %s\n\n' % (i.name, i.description))
1322 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
1323 1323
1324 ui.write(b'\n')
1324 ui.status(b'\n')
1325 1325 else:
1326 ui.write(
1326 ui.status(
1327 1327 _(
1328 1328 b'(no feature deficiencies found in existing '
1329 1329 b'repository)\n'
1330 1330 )
1331 1331 )
1332 1332
1333 ui.write(
1333 ui.status(
1334 1334 _(
1335 1335 b'performing an upgrade with "--run" will make the following '
1336 1336 b'changes:\n\n'
@@ -1344,14 +1344,14 b' def upgraderepo('
1344 1344 unusedoptimize = [i for i in alloptimizations if i not in actions]
1345 1345
1346 1346 if unusedoptimize:
1347 ui.write(
1347 ui.status(
1348 1348 _(
1349 1349 b'additional optimizations are available by specifying '
1350 1350 b'"--optimize <name>":\n\n'
1351 1351 )
1352 1352 )
1353 1353 for i in unusedoptimize:
1354 ui.write(_(b'%s\n %s\n\n') % (i.name, i.description))
1354 ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
1355 1355 return
1356 1356
1357 1357 # Else we're in the run=true case.
@@ -1362,9 +1362,9 b' def upgraderepo('
1362 1362
1363 1363 upgradeactions = [a.name for a in actions]
1364 1364
1365 ui.write(_(b'beginning upgrade...\n'))
1365 ui.status(_(b'beginning upgrade...\n'))
1366 1366 with repo.wlock(), repo.lock():
1367 ui.write(_(b'repository locked and read-only\n'))
1367 ui.status(_(b'repository locked and read-only\n'))
1368 1368 # Our strategy for upgrading the repository is to create a new,
1369 1369 # temporary repository, write data to it, then do a swap of the
1370 1370 # data. There are less heavyweight ways to do this, but it is easier
@@ -1373,7 +1373,7 b' def upgraderepo('
1373 1373 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
1374 1374 backuppath = None
1375 1375 try:
1376 ui.write(
1376 ui.status(
1377 1377 _(
1378 1378 b'creating temporary repository to stage migrated '
1379 1379 b'data: %s\n'
@@ -1390,15 +1390,17 b' def upgraderepo('
1390 1390 ui, repo, dstrepo, newreqs, upgradeactions, revlogs=revlogs
1391 1391 )
1392 1392 if not (backup or backuppath is None):
1393 ui.write(_(b'removing old repository content%s\n') % backuppath)
1393 ui.status(
1394 _(b'removing old repository content%s\n') % backuppath
1395 )
1394 1396 repo.vfs.rmtree(backuppath, forcibly=True)
1395 1397 backuppath = None
1396 1398
1397 1399 finally:
1398 ui.write(_(b'removing temporary repository %s\n') % tmppath)
1400 ui.status(_(b'removing temporary repository %s\n') % tmppath)
1399 1401 repo.vfs.rmtree(tmppath, forcibly=True)
1400 1402
1401 if backuppath:
1403 if backuppath and not ui.quiet:
1402 1404 ui.warn(
1403 1405 _(b'copy of old repository backed up at %s\n') % backuppath
1404 1406 )
@@ -133,30 +133,6 b' non-lfs content, and the extension enabl'
133 133 requirements
134 134 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
135 135
136 beginning upgrade...
137 repository locked and read-only
138 creating temporary repository to stage migrated data: * (glob)
139 (it is safe to interrupt this process any time before data migration completes)
140 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
141 migrating 324 bytes in store; 129 bytes tracked data
142 migrating 1 filelogs containing 1 revisions (73 bytes in store; 8 bytes tracked data)
143 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
144 migrating 1 manifests containing 1 revisions (117 bytes in store; 52 bytes tracked data)
145 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
146 migrating changelog containing 1 revisions (134 bytes in store; 69 bytes tracked data)
147 finished migrating 1 changelog revisions; change in size: 0 bytes
148 finished migrating 3 total revisions; total change in store size: 0 bytes
149 copying phaseroots
150 data fully migrated to temporary repository
151 marking source repository as being upgraded; clients will be unable to read from repository
152 starting in-place swap of repository data
153 replaced files will be backed up at * (glob)
154 replacing store...
155 store replacement complete; repository was inconsistent for *s (glob)
156 finalizing requirements file and making repository readable again
157 removing temporary repository * (glob)
158 copy of old repository backed up at * (glob)
159 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
160 136
161 137 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
162 138 [1]
@@ -174,6 +174,11 b' An upgrade of a repository created with '
174 174 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.
175 175
176 176
177 $ hg debugupgraderepo --quiet
178 requirements
179 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
180
181
177 182 --optimize can be used to add optimizations
178 183
179 184 $ hg debugupgrade --optimize redeltaparent
@@ -225,6 +230,12 b' modern form of the option'
225 230 re-delta-fulladd
226 231 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.
227 232
233 $ hg debugupgrade --optimize re-delta-parent --quiet
234 requirements
235 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
236
237 optimisations: re-delta-parent
238
228 239
229 240 unknown optimization:
230 241
@@ -332,6 +343,11 b' Various sub-optimal detections work'
332 343 re-delta-fulladd
333 344 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.
334 345
346 $ hg debugupgraderepo --quiet
347 requirements
348 preserved: revlogv1, store
349 added: dotencode, fncache, generaldelta, sparserevlog
350
335 351
336 352 $ hg --config format.dotencode=false debugupgraderepo
337 353 repository lacks features recommended by current config options:
@@ -1210,9 +1226,13 b' Check upgrading a sparse-revlog reposito'
1210 1226 store
1211 1227
1212 1228 Check that we can add the sparse-revlog format requirement
1213 $ hg --config format.sparse-revlog=yes debugupgraderepo --run >/dev/null
1214 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1215 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1229 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1230 upgrade will perform the following actions:
1231
1232 requirements
1233 preserved: dotencode, fncache, generaldelta, revlogv1, store
1234 added: sparserevlog
1235
1216 1236 $ cat .hg/requires
1217 1237 dotencode
1218 1238 fncache
@@ -1222,9 +1242,13 b' Check that we can add the sparse-revlog '
1222 1242 store
1223 1243
1224 1244 Check that we can remove the sparse-revlog format requirement
1225 $ hg --config format.sparse-revlog=no debugupgraderepo --run >/dev/null
1226 copy of old repository backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1227 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1245 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1246 upgrade will perform the following actions:
1247
1248 requirements
1249 preserved: dotencode, fncache, generaldelta, revlogv1, store
1250 removed: sparserevlog
1251
1228 1252 $ cat .hg/requires
1229 1253 dotencode
1230 1254 fncache
@@ -1239,7 +1263,13 b' Check upgrading to a zstd revlog'
1239 1263
1240 1264 upgrade
1241 1265
1242 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup >/dev/null
1266 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1267 upgrade will perform the following actions:
1268
1269 requirements
1270 preserved: dotencode, fncache, generaldelta, revlogv1, store
1271 added: revlog-compression-zstd, sparserevlog
1272
1243 1273 $ hg debugformat -v
1244 1274 format-variant repo config default
1245 1275 fncache: yes yes yes
@@ -1262,7 +1292,13 b' upgrade'
1262 1292
1263 1293 downgrade
1264 1294
1265 $ hg debugupgraderepo --run --no-backup > /dev/null
1295 $ hg debugupgraderepo --run --no-backup --quiet
1296 upgrade will perform the following actions:
1297
1298 requirements
1299 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1300 removed: revlog-compression-zstd
1301
1266 1302 $ hg debugformat -v
1267 1303 format-variant repo config default
1268 1304 fncache: yes yes yes
@@ -1288,7 +1324,13 b' upgrade from hgrc'
1288 1324 > [format]
1289 1325 > revlog-compression=zstd
1290 1326 > EOF
1291 $ hg debugupgraderepo --run --no-backup > /dev/null
1327 $ hg debugupgraderepo --run --no-backup --quiet
1328 upgrade will perform the following actions:
1329
1330 requirements
1331 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
1332 added: revlog-compression-zstd
1333
1292 1334 $ hg debugformat -v
1293 1335 format-variant repo config default
1294 1336 fncache: yes yes yes
@@ -1316,7 +1358,15 b' Check upgrading to a side-data revlog'
1316 1358
1317 1359 upgrade
1318 1360
1319 $ hg --config format.exp-use-side-data=yes debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" >/dev/null
1361 $ hg --config format.exp-use-side-data=yes debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1362 upgrade will perform the following actions:
1363
1364 requirements
1365 preserved: dotencode, fncache, generaldelta, revlogv1, store (no-zstd !)
1366 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1367 added: exp-sidedata-flag (zstd !)
1368 added: exp-sidedata-flag, sparserevlog (no-zstd !)
1369
1320 1370 $ hg debugformat -v
1321 1371 format-variant repo config default
1322 1372 fncache: yes yes yes
@@ -1345,7 +1395,14 b' upgrade'
1345 1395
1346 1396 downgrade
1347 1397
1348 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup > /dev/null
1398 $ hg debugupgraderepo --config format.exp-use-side-data=no --run --no-backup --quiet
1399 upgrade will perform the following actions:
1400
1401 requirements
1402 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1403 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1404 removed: exp-sidedata-flag
1405
1349 1406 $ hg debugformat -v
1350 1407 format-variant repo config default
1351 1408 fncache: yes yes yes
@@ -1374,7 +1431,14 b' upgrade from hgrc'
1374 1431 > [format]
1375 1432 > exp-use-side-data=yes
1376 1433 > EOF
1377 $ hg debugupgraderepo --run --no-backup > /dev/null
1434 $ hg debugupgraderepo --run --no-backup --quiet
1435 upgrade will perform the following actions:
1436
1437 requirements
1438 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !)
1439 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !)
1440 added: exp-sidedata-flag
1441
1378 1442 $ hg debugformat -v
1379 1443 format-variant repo config default
1380 1444 fncache: yes yes yes
General Comments 0
You need to be logged in to leave comments. Login now