hgext/evolve.py
changeset 1082 74bc8a0c2c02
parent 1081 dddb8a70437c
child 1083 46048124c44b
--- a/hgext/evolve.py	Wed Aug 27 17:25:18 2014 +0200
+++ b/hgext/evolve.py	Wed Aug 27 17:31:21 2014 +0200
@@ -2426,29 +2426,6 @@
         markers = pushop.outobsmarkers
         if not markers:
             obsexcmsg(repo.ui, "no marker to push\n")
-        elif remote.capable('_evoext_b2x_obsmarkers_0'):
-            obsdata = pushobsmarkerStringIO()
-            _encodemarkersstream(obsdata, markers)
-            obsdata.seek(0)
-            obsdata.ui = repo.ui
-            obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n"
-                               % (len(markers), len(obsdata.getvalue())),
-                      True)
-            bundler = bundle2.bundle20(pushop.ui, {})
-            capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
-            bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob))
-            cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata)
-            bundler.addpart(cgpart)
-            stream = util.chunkbuffer(bundler.getchunks())
-            try:
-                reply = pushop.remote.unbundle(stream, ['force'], 'push')
-            except bundle2.UnknownPartError, exc:
-                raise util.Abort('missing support for %s' % exc)
-            try:
-                op = bundle2.processbundle(pushop.repo, reply)
-            except bundle2.UnknownPartError, exc:
-                raise util.Abort('missing support for %s' % exc)
-            obsexcprg(repo.ui, None)
         elif remote.capable('_evoext_pushobsmarkers_0'):
             obsdata = pushobsmarkerStringIO()
             _encodemarkersstream(obsdata, markers)
@@ -2544,33 +2521,6 @@
     repo.hook('evolve_pushobsmarkers')
     return wireproto.pushres(0)
 
-@bundle2.parthandler('evolve:b2x:obsmarkerv1')
-def handleobsmarkerv1(op, inpart):
-    """add a stream of obsmarker to the repo"""
-    tr = op.gettransaction()
-    advparams = dict(inpart.advisoryparams)
-    length = advparams.get('totalbytes')
-    if length is None:
-        obsdata = inpart.read()
-    else:
-        length = int(length)
-        data = StringIO()
-        current = 0
-        obsexcprg(op.repo.ui, current, unit="bytes", total=length)
-        while current < length:
-            readsize = min(length-current, 4096)
-            data.write(inpart.read(readsize))
-            current += readsize
-            obsexcprg(op.repo.ui, current, unit="bytes", total=length)
-        obsexcprg(op.repo.ui, None)
-        obsdata = data.getvalue()
-    totalsize = len(obsdata)
-    old = len(op.repo.obsstore._all)
-    op.repo.obsstore.mergemarkers(tr, obsdata)
-    new = len(op.repo.obsstore._all) - old
-    op.records.add('evo_obsmarkers', {'new': new, 'bytes': totalsize})
-    tr.hookargs['evolve_new_obsmarkers'] = str(new)
-
 def _buildpullobsmerkersboundaries(pullop):
     """small funtion returning the argument for pull markers call
     may to contains 'heads' and 'common'. skip the key for None.
@@ -2621,9 +2571,8 @@
 def _pullobsolete(orig, pullop):
     if not obsolete._enabled:
         return None
-    b2xpull = pullop.remote.capable('_evoext_b2x_obsmarkers_0')
     wirepull = pullop.remote.capable('_evoext_pullobsmarkers_0')
-    if not (b2xpull or wirepull):
+    if not wirepull:
         return orig(pullop)
     if 'obsolete' not in pullop.remote.listkeys('namespaces'):
         return None # remote opted out of obsolescence marker exchange
@@ -2637,33 +2586,7 @@
     obsexcmsg(ui, "pull obsolescence markers\n", True)
     new = 0
 
-    if b2xpull:
-        kwargs = {'bundlecaps': set(['HG2X'])}
-        capsblob = bundle2.encodecaps(pullop.repo.bundle2caps)
-        kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob))
-        kwargs['heads'] = [nullid]
-        kwargs['common'] = [nullid]
-        kwargs['evo_obsmarker'] = '1'
-        kwargs['evo_obscommon'] = wireproto.encodelist(boundaries['common'])
-        kwargs['evo_obsheads'] = wireproto.encodelist(boundaries['heads'])
-        bundle = pullop.remote.getbundle('pull', **kwargs)
-        try:
-            op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
-        except bundle2.UnknownPartError, exc:
-            raise util.Abort('missing support for %s' % exc)
-        bytes = new = 0
-        for entry in op.records['evo_obsmarkers']:
-            bytes += entry.get('bytes', 0)
-            new += entry.get('new', 0)
-        if 5 < bytes:
-            obsexcmsg(ui, "merging obsolescence markers (%i bytes)\n"
-                      % bytes)
-            obsexcmsg(ui, "%i obsolescence markers added\n" % new, True)
-            tr = op.gettransaction()
-        else:
-            obsexcmsg(ui, "no unknown remote markers\n")
-        obsexcmsg(ui, "DONE\n")
-    elif wirepull:
+    if wirepull:
         obsdata = pullop.remote.evoext_pullobsmarkers_0(**boundaries)
         obsdata = obsdata.read()
         if len(obsdata) > 5:
@@ -2797,14 +2720,12 @@
         caps += ' _evoext_pushobsmarkers_0'
         caps += ' _evoext_pullobsmarkers_0'
         caps += ' _evoext_obshash_0'
-        caps += ' _evoext_b2x_obsmarkers_0'
     return caps
 
 
 @eh.extsetup
 def _installwireprotocol(ui):
     localrepo.moderncaps.add('_evoext_pullobsmarkers_0')
-    localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0')
     hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push'
     hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull'
     wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')