D11223: obsolete: disable other evolution config options if createmarkers is off
av6 (Anton Shestakov)
phabricator at mercurial-scm.org
Wed Jul 28 12:32:49 UTC 2021
av6 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
We used to raise an abort in this case, but recent changes to local clone
command (377d8fc20e34 <https://phab.mercurial-scm.org/rHG377d8fc20e348853caab2915fa4478b76daf7bc2>) resulted in destrepo both caring about
experimental.evolution config options and not initializing extensions.
So imagine if you had evolve and allowdivergence enabled in your ~/.hgrc. Local
clone stopped working after 377d8fc20e34 <https://phab.mercurial-scm.org/rHG377d8fc20e348853caab2915fa4478b76daf7bc2> because evolve sets
experimental.evolution=all, but only on srcrepo, for destrepo the extension is
not initialized. It's possible to make local cloning work by initializing
extensions for destrepo in some cases, but in other cases (e.g. allowdivergence
in ~/.hgrc, evolve extension in original-repo/.hg/hgrc) it would still fail.
In a discussion with Pierre-Yves David it was decided to simply force other
evolution options to be false if createmarkers is not enabled.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11223
AFFECTED FILES
mercurial/obsolete.py
tests/test-clone.t
CHANGE DETAILS
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -580,6 +580,24 @@
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ rm -r ua
+Local clones don't get confused by unusual experimental.evolution options
+
+ $ hg clone \
+ > --config experimental.evolution=allowunstable,allowdivergence,exchange \
+ > a ua
+ updating to branch default
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ rm -r ua
+
+ $ hg clone \
+ > --config experimental.evolution.createmarkers=no \
+ > --config experimental.evolution.allowunstable=yes \
+ > --config experimental.evolution.allowdivergence=yes \
+ > --config experimental.evolution.exchange=yes \
+ > a ua
+ updating to branch default
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ rm -r ua
Test clone with special '@' bookmark:
$ cd a
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -144,20 +144,16 @@
"""Returns dicts showing state of obsolescence features."""
createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
- unstablevalue = _getoptionvalue(repo, allowunstableopt)
- divergencevalue = _getoptionvalue(repo, allowdivergenceopt)
- exchangevalue = _getoptionvalue(repo, exchangeopt)
-
- # createmarkers must be enabled if other options are enabled
- if (
- unstablevalue or divergencevalue or exchangevalue
- ) and not createmarkersvalue:
- raise error.Abort(
- _(
- b"'createmarkers' obsolete option must be enabled "
- b"if other obsolete options are enabled"
- )
- )
+ if createmarkersvalue:
+ unstablevalue = _getoptionvalue(repo, allowunstableopt)
+ divergencevalue = _getoptionvalue(repo, allowdivergenceopt)
+ exchangevalue = _getoptionvalue(repo, exchangeopt)
+ else:
+ # if we cannot create obsolescence markers, we shouldn't exchange them
+ # or perform operations that lead to instability or divergence
+ unstablevalue = False
+ divergencevalue = False
+ exchangevalue = False
return {
createmarkersopt: createmarkersvalue,
To: av6, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list