changeset 45487:78f0bb37f52d

upgrade: support running upgrade if repository has share-safe requirement This helps us in testing changing requirements of source repository and checking that the shared repository works. Differential Revision: https://phab.mercurial-scm.org/D8660
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 25 Jun 2020 13:16:55 +0530
parents ac7a3da0dbb6
children c4f14db3da1d
files mercurial/upgrade.py tests/test-share-safe.t
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade.py	Thu Sep 17 18:49:57 2020 -0700
+++ b/mercurial/upgrade.py	Thu Jun 25 13:16:55 2020 +0530
@@ -108,6 +108,7 @@
         requirements.SIDEDATA_REQUIREMENT,
         requirements.COPIESSDC_REQUIREMENT,
         requirements.NODEMAP_REQUIREMENT,
+        requirements.SHARESAFE_REQUIREMENT,
     }
     for name in compression.compengines:
         engine = compression.compengines[name]
--- a/tests/test-share-safe.t	Thu Sep 17 18:49:57 2020 -0700
+++ b/tests/test-share-safe.t	Thu Jun 25 13:16:55 2020 +0530
@@ -167,6 +167,38 @@
   $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py
   [1]
 
+Update the source repository format and check that shared repo works
+
+  $ cd ../source
+  $ echo "[format]" >> .hg/hgrc
+  $ echo "revlog-compression=zstd" >> .hg/hgrc
+
+  $ hg debugupgraderepo --run -q -R ../shared1
+  abort: cannot upgrade repository; unsupported source requirement: shared
+  [255]
+
+  $ hg debugupgraderepo --run -q
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store
+     added: revlog-compression-zstd
+  
+  $ hg log -r .
+  changeset:   1:5f6d8a4bf34a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added b
+  
+Shared one should work
+  $ cd ../shared1
+  $ hg log -r .
+  changeset:   2:155349b645be
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     added c
+  
 Unsharing works
 
   $ hg unshare