[PATCH 2 of 8 stream clone bundles V2] exchange: support for streaming clone bundles

Gregory Szorc gregory.szorc at gmail.com
Sat Oct 17 13:44:58 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1444939245 25200
#      Thu Oct 15 13:00:45 2015 -0700
# Node ID f9e88c88be962eed8b2e5661865cbd6966653d1a
# Parent  c2930ef1a6b6b7f69957cbf64a6ffee80ecea873
exchange: support for streaming clone bundles

Now that we have a mechanism to produce and consume streaming clone
bundles, we need to teach the human-facing bundle specification parser
and the internal bundle file header reading code to be aware of this new
format. This patch does so.

For the human-facing bundle specification, we choose the name "packed"
to describe "streaming clone bundles" because the bundle is essentially
a "pack" of raw revlog files that are "packed" together. There should
probably be a bikeshed over the name, especially since it is human
facing.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -24,8 +24,9 @@ import url as urlmod
 
 # Maps bundle version human names to changegroup versions.
 _bundlespeccgversions = {'v1': '01',
                          'v2': '02',
+                         'packed1': 's1',
                          'bundle2': '02', #legacy
                         }
 
 def parsebundlespec(repo, spec, strict=True, externalnames=False):
@@ -86,9 +87,12 @@ def parsebundlespec(repo, spec, strict=T
             version = 'v1'
             if 'generaldelta' in repo.requirements:
                 version = 'v2'
         elif spec in _bundlespeccgversions:
-            compression = 'bzip2'
+            if spec == 'packed1':
+                compression = 'none'
+            else:
+                compression = 'bzip2'
             version = spec
         else:
             raise error.UnsupportedBundleSpecification(
                     _('%s is not a recognized bundle specification') % spec)
@@ -120,8 +124,10 @@ def readbundle(ui, fh, fname, vfs=None):
             alg = changegroup.readexactly(fh, 2)
         return changegroup.cg1unpacker(fh, alg)
     elif version.startswith('2'):
         return bundle2.getunbundler(ui, fh, magicstring=magic + version)
+    elif version == 'S1':
+        return streamclone.streamcloneapplier(fh)
     else:
         raise error.Abort(_('%s: unknown bundle version %s') % (fname, version))
 
 def buildobsmarkerspart(bundler, markers):


More information about the Mercurial-devel mailing list