aalekseyev created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12542

AFFECTED FILES
  mercurial/upgrade_utils/actions.py
  tests/test-narrow.t

CHANGE DETAILS

diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -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
diff --git a/mercurial/upgrade_utils/actions.py 
b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -33,10 +33,16 @@
     requirements.CHANGELOGV2_REQUIREMENT,
 }
 
-
 def preservedrequirements(repo):
     preserved = {
         requirements.SHARED_REQUIREMENT,
+        # Blindly skipping the narrow requirement may not be correct in 
general,
+        # for example if there are some upgrades that would replay the commits,
+        # instead of doing a per-revlog rewrite.
+        #
+        # This is not a big deal for us, because
+        # for rewrites like that we'll want to re-clone the repo, anyway.
+        requirements.NARROW_REQUIREMENT,
     }
     return preserved & repo.requirements
 
@@ -1004,7 +1010,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 +1030,7 @@
         requirements.SHARESAFE_REQUIREMENT,
         requirements.SPARSEREVLOG_REQUIREMENT,
         requirements.STORE_REQUIREMENT,
+        requirements.NARROW_REQUIREMENT,
     }
     for name in compression.compengines:
         engine = compression.compengines[name]



To: aalekseyev, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to