[PATCH 5 of 5 V2] obsolete: add exchange option

Durham Goode durham at fb.com
Wed Oct 15 15:03:25 CDT 2014


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1413318361 25200
#      Tue Oct 14 13:26:01 2014 -0700
# Node ID a008668f7406a282da6707ba1cfd9ee006f2a186
# Parent  8fcbb951b20a5d0612a57f4970f398991f21b774
obsolete: add exchange option

This adds an option that enables obsolete marker exchange.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -788,7 +788,7 @@ def getrepocaps(repo):
     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
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -309,7 +309,7 @@ def _pushdiscoveryphase(pushop):
 
 @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
@@ -899,7 +899,7 @@ def _pullbundle2(pullop):
     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
@@ -1030,7 +1030,7 @@ def _pullobsolete(pullop):
         return
     pullop.todosteps.remove('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:
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -83,6 +83,7 @@ from i18n import _
 # Enablable options for obsolesence
 createmarkersopt = 'createmarkers'
 allowunstableopt = 'allowunstable'
+exchangeopt = 'exchange'
 
 ### obsolescence marker flag
 
diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -11,7 +11,7 @@ def _nslist(repo):
     n = {}
     for k in _namespaces:
         n[k] = ""
-    if not obsolete._enabled:
+    if not obsolete.isenabled(repo, obsolete.exchangeopt):
         n.pop('obsolete')
     return n
 


More information about the Mercurial-devel mailing list