diff mercurial/exchange.py @ 35788:b116a66bcc44

bundle2: move version of stream clone into part name I don't like having version numbers as part parameters. It means that parts can theoretically vary wildly in their generation and processing semantics. I think that a named part should have consistent behavior over time. In other words, if you need to introduce new functionality or behavior, that should be expressed by inventing a new bundle2 part, not adding functionality to an existing part. This commit applies this advice to the just-introduced stream clone via bundle2 feature. The "version" part parameter is removed. The name of the bundle2 part is now "stream2" instead of "stream" with "version=v2". Differential Revision: https://phab.mercurial-scm.org/D1927
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 22 Jan 2018 12:19:49 -0800
parents a84dbc87dae9
children 9adae6a20e1f
line wrap: on
line diff
--- a/mercurial/exchange.py	Mon Jan 22 12:12:29 2018 -0800
+++ b/mercurial/exchange.py	Mon Jan 22 12:19:49 2018 -0800
@@ -1767,9 +1767,9 @@
 
     return info, bundler.getchunks()
 
-@getbundle2partsgenerator('stream')
-def _getbundlestream(bundler, repo, source, bundlecaps=None,
-                     b2caps=None, heads=None, common=None, **kwargs):
+@getbundle2partsgenerator('stream2')
+def _getbundlestream2(bundler, repo, source, bundlecaps=None,
+                      b2caps=None, heads=None, common=None, **kwargs):
     if not kwargs.get('stream', False):
         return
 
@@ -1780,11 +1780,10 @@
 
     filecount, bytecount, it = streamclone.generatev2(repo)
     requirements = ' '.join(sorted(repo.requirements))
-    part = bundler.newpart('stream', data=it)
+    part = bundler.newpart('stream2', data=it)
     part.addparam('bytecount', '%d' % bytecount, mandatory=True)
     part.addparam('filecount', '%d' % filecount, mandatory=True)
     part.addparam('requirements', requirements, mandatory=True)
-    part.addparam('version', 'v2', mandatory=True)
 
 @getbundle2partsgenerator('changegroup')
 def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,