Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.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 | c1b9eb15a51c |
comparison
equal
deleted
inserted
replaced
35787:a84dbc87dae9 | 35788:b116a66bcc44 |
---|---|
2128 # they came from the --pushvar flag. | 2128 # they came from the --pushvar flag. |
2129 key = "USERVAR_" + key | 2129 key = "USERVAR_" + key |
2130 hookargs[key] = value | 2130 hookargs[key] = value |
2131 op.addhookargs(hookargs) | 2131 op.addhookargs(hookargs) |
2132 | 2132 |
2133 @parthandler('stream', ('requirements', 'filecount', 'bytecount', 'version')) | 2133 @parthandler('stream2', ('requirements', 'filecount', 'bytecount')) |
2134 def handlestreambundle(op, part): | 2134 def handlestreamv2bundle(op, part): |
2135 | 2135 |
2136 version = part.params['version'] | |
2137 if version != 'v2': | |
2138 raise error.Abort(_('unknown stream bundle version %s') % version) | |
2139 requirements = part.params['requirements'].split() | 2136 requirements = part.params['requirements'].split() |
2140 filecount = int(part.params['filecount']) | 2137 filecount = int(part.params['filecount']) |
2141 bytecount = int(part.params['bytecount']) | 2138 bytecount = int(part.params['bytecount']) |
2142 | 2139 |
2143 repo = op.repo | 2140 repo = op.repo |