narrow: support debugupgraderepo
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Tue, 12 Apr 2022 19:40:37 +0100
changeset 49069 a31e9840178e
parent 49065 5d205e476057
child 49070 137a93125902
narrow: support debugupgraderepo Differential Revision: https://phab.mercurial-scm.org/D12542
mercurial/upgrade_utils/actions.py
tests/test-narrow.t
--- a/mercurial/upgrade_utils/actions.py	Tue Apr 05 12:06:32 2022 -0700
+++ b/mercurial/upgrade_utils/actions.py	Tue Apr 12 19:40:37 2022 +0100
@@ -37,6 +37,7 @@
 def preservedrequirements(repo):
     preserved = {
         requirements.SHARED_REQUIREMENT,
+        requirements.NARROW_REQUIREMENT,
     }
     return preserved & repo.requirements
 
@@ -1004,7 +1005,7 @@
 def supporteddestrequirements(repo):
     """Obtain requirements that upgrade supports in the destination.
 
-    If the result of the upgrade would create requirements not in this set,
+    If the result of the upgrade would have requirements not in this set,
     the upgrade is disallowed.
 
     Extensions should monkeypatch this to add their custom requirements.
@@ -1024,6 +1025,7 @@
         requirements.SHARESAFE_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,
         requirements.STORE_REQUIREMENT,
+        requirements.NARROW_REQUIREMENT,
     }
     for name in compression.compengines:
         engine = compression.compengines[name]
--- a/tests/test-narrow.t	Tue Apr 05 12:06:32 2022 -0700
+++ b/tests/test-narrow.t	Tue Apr 12 19:40:37 2022 +0100
@@ -71,6 +71,17 @@
   updating to branch default
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+The "narrow" repo requirement is ignored by [debugupgraderepo]
+
+#if tree
+  $ (cd should-work; hg debugupgraderepo)
+  abort: cannot upgrade repository; unsupported source requirement: treemanifest
+  [255]
+#else
+  $ (cd should-work; hg debugupgraderepo | grep 'no format upgrades found in existing repository')
+  (no format upgrades found in existing repository)
+#endif
+
 Test repo with local changes
   $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6
   requesting all changes