D2679: [PoC] obsolete: config option to enable local only obsolescence mode
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Mar 5 00:43:00 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Our path to enable obsolescence/evolve in core is to enable
creation of markers locally (no exchange) with user-facing behavior
that mimics existing behavior as closely as possible. Think of it
as evolve light.
We introduce a config option to control this behavior.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2679
AFFECTED FILES
mercurial/configitems.py
mercurial/obsolete.py
CHANGE DETAILS
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -98,6 +98,7 @@
createmarkersopt = 'createmarkers'
allowunstableopt = 'allowunstable'
exchangeopt = 'exchange'
+localonlymodeopt = 'localonly'
def _getoptionvalue(repo, option):
"""Returns True if the given repository has the given obsolete option
@@ -139,6 +140,15 @@
createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
unstablevalue = _getoptionvalue(repo, allowunstableopt)
exchangevalue = _getoptionvalue(repo, exchangeopt)
+ localonlyvalue = repo.ui.configbool('ui', 'localobsolescence')
+
+ # Evolution options take precedence over local only mode.
+ if createmarkersvalue or unstablevalue or exchangevalue:
+ localonlyvalue = False
+
+ # We /could/ have local only mode imply createmarkers, but this would
+ # have significant implications in core. For now, wait until core
+ # consumers are aware of local only mode before implying this option.
# createmarkers must be enabled if other options are enabled
if ((unstablevalue or exchangevalue) and not createmarkersvalue):
@@ -149,6 +159,7 @@
createmarkersopt: createmarkersvalue,
allowunstableopt: unstablevalue,
exchangeopt: exchangevalue,
+ localonlymodeopt: localonlyvalue,
}
def isenabled(repo, option):
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1038,6 +1038,9 @@
coreconfigitem('ui', 'interface.chunkselector',
default=None,
)
+coreconfigitem('ui', 'localobsolescence',
+ default=True,
+)
coreconfigitem('ui', 'logblockedtimes',
default=False,
)
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list