Mercurial > hg
comparison tests/test-upgrade-repo.t @ 47320:a43d256c041a
dirstate-v2: Add `hg debugupgraderepo` command support
This command changes changes the file formats used inside an existing
repository to what they would be in a new repository with the current config.
For example:
hg debugupgraderepo --config format.exp-dirstate-v2=1 --run
hg debugupgraderepo --config format.exp-dirstate-v2=0 --run
If a repository has a dirstate in v1 format, the first command would upgrade it
to dirstate-v2. Conversely, if a repository has a dirstate in v2 format, the
second command would downgrade it to v1. (Both may also run some unrelated
upgrades.)
Since `format.exp-dirstate-v2` is currently disabled by default, not specifying
it in `--config` or any configuration file would result in the second command.
Differential Revision: https://phab.mercurial-scm.org/D10769
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 18:35:43 +0200 |
parents | 6c84fc9c9a90 |
children | bf11ff22a9af |
comparison
equal
deleted
inserted
replaced
47319:e985a36c2aa3 | 47320:a43d256c041a |
---|---|
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 dotencode: yes | 61 dotencode: yes |
61 generaldelta: yes | 62 generaldelta: yes |
62 share-safe: no | 63 share-safe: no |
63 sparserevlog: yes | 64 sparserevlog: yes |
64 persistent-nodemap: no (no-rust !) | 65 persistent-nodemap: no (no-rust !) |
70 compression: zlib | 71 compression: zlib |
71 compression-level: default | 72 compression-level: default |
72 $ hg debugformat --verbose | 73 $ hg debugformat --verbose |
73 format-variant repo config default | 74 format-variant repo config default |
74 fncache: yes yes yes | 75 fncache: yes yes yes |
76 dirstate-v2: no no no | |
75 dotencode: yes yes yes | 77 dotencode: yes yes yes |
76 generaldelta: yes yes yes | 78 generaldelta: yes yes yes |
77 share-safe: no no no | 79 share-safe: no no no |
78 sparserevlog: yes yes yes | 80 sparserevlog: yes yes yes |
79 persistent-nodemap: no no no (no-rust !) | 81 persistent-nodemap: no no no (no-rust !) |
86 compression: zlib zlib zstd (zstd !) | 88 compression: zlib zlib zstd (zstd !) |
87 compression-level: default default default | 89 compression-level: default default default |
88 $ hg debugformat --verbose --config format.usefncache=no | 90 $ hg debugformat --verbose --config format.usefncache=no |
89 format-variant repo config default | 91 format-variant repo config default |
90 fncache: yes no yes | 92 fncache: yes no yes |
93 dirstate-v2: no no no | |
91 dotencode: yes no yes | 94 dotencode: yes no yes |
92 generaldelta: yes yes yes | 95 generaldelta: yes yes yes |
93 share-safe: no no no | 96 share-safe: no no no |
94 sparserevlog: yes yes yes | 97 sparserevlog: yes yes yes |
95 persistent-nodemap: no no no (no-rust !) | 98 persistent-nodemap: no no no (no-rust !) |
102 compression: zlib zlib zstd (zstd !) | 105 compression: zlib zlib zstd (zstd !) |
103 compression-level: default default default | 106 compression-level: default default default |
104 $ hg debugformat --verbose --config format.usefncache=no --color=debug | 107 $ hg debugformat --verbose --config format.usefncache=no --color=debug |
105 format-variant repo config default | 108 format-variant repo config default |
106 [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] | |
107 [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] |
108 [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] |
109 [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] |
110 [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] |
111 [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 !) |
122 { | 126 { |
123 "config": true, | 127 "config": true, |
124 "default": true, | 128 "default": true, |
125 "name": "fncache", | 129 "name": "fncache", |
126 "repo": true | 130 "repo": true |
131 }, | |
132 { | |
133 "config": false, | |
134 "default": false, | |
135 "name": "dirstate-v2", | |
136 "repo": false | |
127 }, | 137 }, |
128 { | 138 { |
129 "config": true, | 139 "config": true, |
130 "default": true, | 140 "default": true, |
131 "name": "dotencode", | 141 "name": "dotencode", |
325 > EOF | 335 > EOF |
326 | 336 |
327 $ hg debugformat | 337 $ hg debugformat |
328 format-variant repo | 338 format-variant repo |
329 fncache: no | 339 fncache: no |
340 dirstate-v2: no | |
330 dotencode: no | 341 dotencode: no |
331 generaldelta: no | 342 generaldelta: no |
332 share-safe: no | 343 share-safe: no |
333 sparserevlog: no | 344 sparserevlog: no |
334 persistent-nodemap: no | 345 persistent-nodemap: no |
339 compression: zlib | 350 compression: zlib |
340 compression-level: default | 351 compression-level: default |
341 $ hg debugformat --verbose | 352 $ hg debugformat --verbose |
342 format-variant repo config default | 353 format-variant repo config default |
343 fncache: no yes yes | 354 fncache: no yes yes |
355 dirstate-v2: no no no | |
344 dotencode: no yes yes | 356 dotencode: no yes yes |
345 generaldelta: no yes yes | 357 generaldelta: no yes yes |
346 share-safe: no no no | 358 share-safe: no no no |
347 sparserevlog: no yes yes | 359 sparserevlog: no yes yes |
348 persistent-nodemap: no no no (no-rust !) | 360 persistent-nodemap: no no no (no-rust !) |
355 compression: zlib zlib zstd (zstd !) | 367 compression: zlib zlib zstd (zstd !) |
356 compression-level: default default default | 368 compression-level: default default default |
357 $ hg debugformat --verbose --config format.usegeneraldelta=no | 369 $ hg debugformat --verbose --config format.usegeneraldelta=no |
358 format-variant repo config default | 370 format-variant repo config default |
359 fncache: no yes yes | 371 fncache: no yes yes |
372 dirstate-v2: no no no | |
360 dotencode: no yes yes | 373 dotencode: no yes yes |
361 generaldelta: no no yes | 374 generaldelta: no no yes |
362 share-safe: no no no | 375 share-safe: no no no |
363 sparserevlog: no no yes | 376 sparserevlog: no no yes |
364 persistent-nodemap: no no no (no-rust !) | 377 persistent-nodemap: no no no (no-rust !) |
371 compression: zlib zlib zstd (zstd !) | 384 compression: zlib zlib zstd (zstd !) |
372 compression-level: default default default | 385 compression-level: default default default |
373 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug | 386 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug |
374 format-variant repo config default | 387 format-variant repo config default |
375 [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] | |
376 [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] |
377 [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] |
378 [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] |
379 [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] |
380 [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 !) |
1353 - manifest | 1367 - manifest |
1354 | 1368 |
1355 $ hg debugformat -v | 1369 $ hg debugformat -v |
1356 format-variant repo config default | 1370 format-variant repo config default |
1357 fncache: yes yes yes | 1371 fncache: yes yes yes |
1372 dirstate-v2: no no no | |
1358 dotencode: yes yes yes | 1373 dotencode: yes yes yes |
1359 generaldelta: yes yes yes | 1374 generaldelta: yes yes yes |
1360 share-safe: no no no | 1375 share-safe: no no no |
1361 sparserevlog: yes yes yes | 1376 sparserevlog: yes yes yes |
1362 persistent-nodemap: no no no (no-rust !) | 1377 persistent-nodemap: no no no (no-rust !) |
1394 - manifest | 1409 - manifest |
1395 | 1410 |
1396 $ hg debugformat -v | 1411 $ hg debugformat -v |
1397 format-variant repo config default | 1412 format-variant repo config default |
1398 fncache: yes yes yes | 1413 fncache: yes yes yes |
1414 dirstate-v2: no no no | |
1399 dotencode: yes yes yes | 1415 dotencode: yes yes yes |
1400 generaldelta: yes yes yes | 1416 generaldelta: yes yes yes |
1401 share-safe: no no no | 1417 share-safe: no no no |
1402 sparserevlog: yes yes yes | 1418 sparserevlog: yes yes yes |
1403 persistent-nodemap: no no no (no-rust !) | 1419 persistent-nodemap: no no no (no-rust !) |
1438 - manifest | 1454 - manifest |
1439 | 1455 |
1440 $ hg debugformat -v | 1456 $ hg debugformat -v |
1441 format-variant repo config default | 1457 format-variant repo config default |
1442 fncache: yes yes yes | 1458 fncache: yes yes yes |
1459 dirstate-v2: no no no | |
1443 dotencode: yes yes yes | 1460 dotencode: yes yes yes |
1444 generaldelta: yes yes yes | 1461 generaldelta: yes yes yes |
1445 share-safe: no no no | 1462 share-safe: no no no |
1446 sparserevlog: yes yes yes | 1463 sparserevlog: yes yes yes |
1447 persistent-nodemap: no no no (no-rust !) | 1464 persistent-nodemap: no no no (no-rust !) |
1488 - manifest | 1505 - manifest |
1489 | 1506 |
1490 $ hg debugformat -v | 1507 $ hg debugformat -v |
1491 format-variant repo config default | 1508 format-variant repo config default |
1492 fncache: yes yes yes | 1509 fncache: yes yes yes |
1510 dirstate-v2: no no no | |
1493 dotencode: yes yes yes | 1511 dotencode: yes yes yes |
1494 generaldelta: yes yes yes | 1512 generaldelta: yes yes yes |
1495 share-safe: no no no | 1513 share-safe: no no no |
1496 sparserevlog: yes yes yes | 1514 sparserevlog: yes yes yes |
1497 persistent-nodemap: no no no (no-rust !) | 1515 persistent-nodemap: no no no (no-rust !) |
1535 - manifest | 1553 - manifest |
1536 | 1554 |
1537 $ hg debugformat -v | 1555 $ hg debugformat -v |
1538 format-variant repo config default | 1556 format-variant repo config default |
1539 fncache: yes yes yes | 1557 fncache: yes yes yes |
1558 dirstate-v2: no no no | |
1540 dotencode: yes yes yes | 1559 dotencode: yes yes yes |
1541 generaldelta: yes yes yes | 1560 generaldelta: yes yes yes |
1542 share-safe: no no no | 1561 share-safe: no no no |
1543 sparserevlog: yes yes yes | 1562 sparserevlog: yes yes yes |
1544 persistent-nodemap: no no no (no-rust !) | 1563 persistent-nodemap: no no no (no-rust !) |
1583 - manifest | 1602 - manifest |
1584 | 1603 |
1585 $ hg debugformat -v | 1604 $ hg debugformat -v |
1586 format-variant repo config default | 1605 format-variant repo config default |
1587 fncache: yes yes yes | 1606 fncache: yes yes yes |
1607 dirstate-v2: no no no | |
1588 dotencode: yes yes yes | 1608 dotencode: yes yes yes |
1589 generaldelta: yes yes yes | 1609 generaldelta: yes yes yes |
1590 share-safe: no no no | 1610 share-safe: no no no |
1591 sparserevlog: yes yes yes | 1611 sparserevlog: yes yes yes |
1592 persistent-nodemap: no no no (no-rust !) | 1612 persistent-nodemap: no no no (no-rust !) |
1611 | 1631 |
1612 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 |
1613 | 1633 |
1614 $ hg debugupgraderepo --run | 1634 $ hg debugupgraderepo --run |
1615 nothing to do | 1635 nothing to do |
1636 | |
1637 #if rust | |
1638 | |
1639 Upgrade to dirstate-v2 | |
1640 | |
1641 $ hg debugformat -v --config format.exp-dirstate-v2=1 | |
1642 format-variant repo config default | |
1643 fncache: yes yes yes | |
1644 dirstate-v2: no yes no | |
1645 dotencode: yes yes yes | |
1646 generaldelta: yes yes yes | |
1647 share-safe: no no no | |
1648 sparserevlog: yes yes yes | |
1649 persistent-nodemap: yes yes no | |
1650 copies-sdc: no no no | |
1651 revlog-v2: yes yes no | |
1652 changelog-v2: no no no | |
1653 plain-cl-delta: yes yes yes | |
1654 compression: zstd zstd zstd | |
1655 compression-level: default default default | |
1656 $ hg debugupgraderepo --config format.exp-dirstate-v2=1 --run | |
1657 upgrade will perform the following actions: | |
1658 | |
1659 requirements | |
1660 preserved: dotencode, exp-revlogv2.2, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, sparserevlog, store | |
1661 added: exp-dirstate-v2 | |
1662 | |
1663 dirstate-v2 | |
1664 "hg status" will be faster | |
1665 | |
1666 processed revlogs: | |
1667 - all-filelogs | |
1668 - changelog | |
1669 - manifest | |
1670 | |
1671 beginning upgrade... | |
1672 repository locked and read-only | |
1673 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob) | |
1674 (it is safe to interrupt this process any time before data migration completes) | |
1675 upgrading to dirstate-v2 from v1 | |
1676 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob) | |
1677 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob) | |
1678 $ ls .hg/upgradebackup.*/dirstate | |
1679 .hg/upgradebackup.*/dirstate (glob) | |
1680 $ hg debugformat -v | |
1681 format-variant repo config default | |
1682 fncache: yes yes yes | |
1683 dirstate-v2: yes no no | |
1684 dotencode: yes yes yes | |
1685 generaldelta: yes yes yes | |
1686 share-safe: no no no | |
1687 sparserevlog: yes yes yes | |
1688 persistent-nodemap: yes yes no | |
1689 copies-sdc: no no no | |
1690 revlog-v2: yes yes no | |
1691 changelog-v2: no no no | |
1692 plain-cl-delta: yes yes yes | |
1693 compression: zstd zstd zstd | |
1694 compression-level: default default default | |
1695 $ hg status | |
1696 $ dd status=none bs=12 count=1 if=.hg/dirstate | |
1697 dirstate-v2 | |
1698 | |
1699 Downgrade from dirstate-v2 | |
1700 | |
1701 $ hg debugupgraderepo --run | |
1702 upgrade will perform the following actions: | |
1703 | |
1704 requirements | |
1705 preserved: dotencode, exp-revlogv2.2, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, sparserevlog, store | |
1706 removed: exp-dirstate-v2 | |
1707 | |
1708 processed revlogs: | |
1709 - all-filelogs | |
1710 - changelog | |
1711 - manifest | |
1712 | |
1713 beginning upgrade... | |
1714 repository locked and read-only | |
1715 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob) | |
1716 (it is safe to interrupt this process any time before data migration completes) | |
1717 downgrading from dirstate-v2 to v1 | |
1718 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob) | |
1719 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob) | |
1720 $ hg debugformat -v | |
1721 format-variant repo config default | |
1722 fncache: yes yes yes | |
1723 dirstate-v2: no no no | |
1724 dotencode: yes yes yes | |
1725 generaldelta: yes yes yes | |
1726 share-safe: no no no | |
1727 sparserevlog: yes yes yes | |
1728 persistent-nodemap: yes yes no | |
1729 copies-sdc: no no no | |
1730 revlog-v2: yes yes no | |
1731 changelog-v2: no no no | |
1732 plain-cl-delta: yes yes yes | |
1733 compression: zstd zstd zstd | |
1734 compression-level: default default default | |
1735 $ hg status | |
1736 | |
1737 #endif |