obsolete: add exchange option
This adds an option that enables obsolete marker exchange.
--- a/mercurial/bundle2.py Tue Oct 14 13:25:13 2014 -0700
+++ b/mercurial/bundle2.py Tue Oct 14 13:26:01 2014 -0700
@@ -788,7 +788,7 @@
Exists to allow extensions (like evolution) to mutate the capabilities.
"""
caps = capabilities.copy()
- if obsolete._enabled:
+ if obsolete.isenabled(repo, obsolete.exchangeopt):
supportedformat = tuple('V%i' % v for v in obsolete.formats)
caps['b2x:obsmarkers'] = supportedformat
return caps
--- a/mercurial/exchange.py Tue Oct 14 13:25:13 2014 -0700
+++ b/mercurial/exchange.py Tue Oct 14 13:26:01 2014 -0700
@@ -309,7 +309,7 @@
@pushdiscovery('obsmarker')
def _pushdiscoveryobsmarkers(pushop):
- if (obsolete._enabled
+ if (obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
and pushop.repo.obsstore
and 'obsolete' in pushop.remote.listkeys('namespaces')):
repo = pushop.repo
@@ -929,7 +929,7 @@
else:
if pullop.heads is None and list(pullop.common) == [nullid]:
pullop.repo.ui.status(_("requesting all changes\n"))
- if obsolete._enabled:
+ if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
remoteversions = bundle2.obsmarkersversion(remotecaps)
if obsolete.commonversion(remoteversions) is not None:
kwargs['obsmarkers'] = True
@@ -1062,7 +1062,7 @@
return
pullop.stepsdone.add('obsmarkers')
tr = None
- if obsolete._enabled:
+ if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
pullop.repo.ui.debug('fetching remote obsolete markers\n')
remoteobs = pullop.remote.listkeys('obsolete')
if 'dump0' in remoteobs:
--- a/mercurial/obsolete.py Tue Oct 14 13:25:13 2014 -0700
+++ b/mercurial/obsolete.py Tue Oct 14 13:26:01 2014 -0700
@@ -84,6 +84,7 @@
# Options for obsolescence
createmarkersopt = 'createmarkers'
allowunstableopt = 'allowunstable'
+exchangeopt = 'exchange'
### obsolescence marker flag
--- a/mercurial/pushkey.py Tue Oct 14 13:25:13 2014 -0700
+++ b/mercurial/pushkey.py Tue Oct 14 13:26:01 2014 -0700
@@ -11,7 +11,7 @@
n = {}
for k in _namespaces:
n[k] = ""
- if not obsolete._enabled:
+ if not obsolete.isenabled(repo, obsolete.exchangeopt):
n.pop('obsolete')
return n