diff tests/test-upgrade-repo.t @ 48339:6e4999cb085e stable

dirstate-v2: fix upgrade on an empty repository This used to crash as the dirstate file does not exist in this case. Differential Revision: https://phab.mercurial-scm.org/D11866
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Dec 2021 10:08:04 +0100
parents 25c352b58b4e
children f7086f6173f8 1d0978cfe968
line wrap: on
line diff
--- a/tests/test-upgrade-repo.t	Mon Dec 06 10:52:40 2021 +0100
+++ b/tests/test-upgrade-repo.t	Mon Dec 06 10:08:04 2021 +0100
@@ -1701,3 +1701,66 @@
   $ hg debugformat -v | grep dirstate-v2
   dirstate-v2:         no     no      no
   $ hg status
+
+  $ cd ..
+
+dirstate-v2: upgrade and downgrade from and empty repository:
+-------------------------------------------------------------
+
+  $ hg init --config format.exp-rc-dirstate-v2=no dirstate-v2-empty
+  $ cd dirstate-v2-empty
+  $ hg debugformat | grep dirstate-v2
+  dirstate-v2:         no
+
+upgrade
+
+  $ hg debugupgraderepo --run --config format.exp-rc-dirstate-v2=yes
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: * (glob)
+     added: dirstate-v2
+  
+  dirstate-v2
+     "hg status" will be faster
+  
+  processed revlogs:
+    - all-filelogs
+    - changelog
+    - manifest
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  upgrading to dirstate-v2 from v1
+  replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
+  removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  $ hg debugformat | grep dirstate-v2
+  dirstate-v2:        yes
+
+downgrade
+
+  $ hg debugupgraderepo --run --config format.exp-rc-dirstate-v2=no
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: * (glob)
+     removed: dirstate-v2
+  
+  processed revlogs:
+    - all-filelogs
+    - changelog
+    - manifest
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  downgrading from dirstate-v2 to v1
+  replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
+  removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
+  $ hg debugformat | grep dirstate-v2
+  dirstate-v2:         no
+
+  $ cd ..