changeset 49124:a31e9840178e

narrow: support debugupgraderepo Differential Revision: https://phab.mercurial-scm.org/D12542
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Tue, 12 Apr 2022 19:40:37 +0100
parents 5d205e476057
children 137a93125902
files mercurial/upgrade_utils/actions.py tests/test-narrow.t
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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