diff mercurial/exchange.py @ 21144:7a20fe8dc080

bundle2: use HG2X in the header The current implementation of bundle2 is still very experimental and the 3.0 freeze is yesterday. The current bundle2 format has never been field-tested, so we rename the header to HG2X. This leaves the HG20 header available for real usage as a stable format in Mercurial 3.1. We won't guarantee that future mercurial versions will keep supporting this `HG2X` format.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 17 Apr 2014 15:27:54 -0400
parents 5bb5d4ba14e5
children 0c5088be66af
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Apr 17 02:01:38 2014 -0400
+++ b/mercurial/exchange.py	Thu Apr 17 15:27:54 2014 -0400
@@ -32,7 +32,7 @@
         if alg is None:
             alg = changegroup.readexactly(fh, 2)
         return changegroup.unbundle10(fh, alg)
-    elif version == '20':
+    elif version == '2X':
         return bundle2.unbundle20(ui, fh, header=magic + version)
     else:
         raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))
@@ -545,7 +545,7 @@
     """pull data using bundle2
 
     For now, the only supported data are changegroup."""
-    kwargs = {'bundlecaps': set(['HG20'])}
+    kwargs = {'bundlecaps': set(['HG2X'])}
     capsblob = bundle2.encodecaps(pullop.repo.bundle2caps)
     kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob))
     # pulling changegroup
@@ -644,7 +644,7 @@
 def getbundle(repo, source, heads=None, common=None, bundlecaps=None):
     """return a full bundle (with potentially multiple kind of parts)
 
-    Could be a bundle HG10 or a bundle HG20 depending on bundlecaps
+    Could be a bundle HG10 or a bundle HG2X depending on bundlecaps
     passed. For now, the bundle can contain only changegroup, but this will
     changes when more part type will be available for bundle2.
 
@@ -658,7 +658,7 @@
     # build bundle here.
     cg = changegroup.getbundle(repo, source, heads=heads,
                                common=common, bundlecaps=bundlecaps)
-    if bundlecaps is None or 'HG20' not in bundlecaps:
+    if bundlecaps is None or 'HG2X' not in bundlecaps:
         return cg
     # very crude first implementation,
     # the bundle API will change and the generation will be done lazily.