[PATCH 3 of 3] changegroup: simplify logic around enabling changegroup 03

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Dec 20 15:40:30 EST 2016



On 12/20/2016 08:35 PM, Augie Fackler wrote:
> On Mon, Dec 19, 2016 at 07:41:23AM +0100, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
>> # Date 1482117918 -3600
>> #      Mon Dec 19 04:25:18 2016 +0100
>> # Node ID e62c766c60a19d89c4e0e50881701135c251fb6f
>> # Parent  fef4a4a522c7ea405d8a036213223dca79fc3f84
>> # EXP-Topic cleanup.changegroup
>> changegroup: simplify logic around enabling changegroup 03
>
> Queued, but there's a (now-obvious) bug (not a regression though) that
> I'll expect a quick followup for: if treemanifest is in the
> repo.requirements, 01 and 02 won't work, and so should be discarded.

Actually the current code seems to be right (see my reply to Remi LFS 
series for details). The current code prevent emission of '01' and '02', 
but allow receiving '01' and '02' assuming the emitter knows what it is 
doing.


>> There was multiple spot that took care of adding '03' as supported changegroup
>> version for different condition. We gather them all in one location for
>> simplicity.
>>
>> The 'supportedincomingversions' function is now doing nothing, but I kept it
>> around because it looks like a great hooking point for extension.
>>
>> (Note that we should probably just get changegroup3 out of experimental now, But
>> that would be a patch with a much wider scope).
>>
>> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
>> --- a/mercurial/changegroup.py
>> +++ b/mercurial/changegroup.py
>> @@ -877,16 +877,14 @@ class cg3packer(cg2packer):
>>  def allsupportedversions(repo):
>>      versions = set(_packermap.keys())
>>      if not (repo.ui.configbool('experimental', 'changegroup3') or
>> -            repo.ui.configbool('experimental', 'treemanifest')):
>> +            repo.ui.configbool('experimental', 'treemanifest') or
>> +            'treemanifest' in repo.requirements):
>>          versions.discard('03')
>>      return versions
>>
>>  # Changegroup versions that can be applied to the repo
>>  def supportedincomingversions(repo):
>> -    versions = allsupportedversions(repo)
>> -    if 'treemanifest' in repo.requirements:
>> -        versions.add('03')
>> -    return versions
>> +    return allsupportedversions(repo)
>>
>>  # Changegroup versions that can be created from the repo
>>  def supportedoutgoingversions(repo):
>> @@ -899,7 +897,6 @@ def supportedoutgoingversions(repo):
>>          # support versions 01 and 02.
>>          versions.discard('01')
>>          versions.discard('02')
>> -        versions.add('03')
>>      return versions
>>
>>  def safeversion(repo):
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list