Patchwork [2,of,3] changegroup: pass 'repo' to allsupportedversions

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 19, 2016, 6:41 a.m.
Message ID <fef4a4a522c7ea405d8a.1482129682@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/17964/
State Accepted
Headers show

Comments

Pierre-Yves David - Dec. 19, 2016, 6:41 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1482118173 -3600
#      Mon Dec 19 04:29:33 2016 +0100
# Node ID fef4a4a522c7ea405d8a036213223dca79fc3f84
# Parent  a03103bb5979f59d82a5fb8a383cc057bd9ceab6
# EXP-Topic cleanup.changegroup
changegroup: pass 'repo' to allsupportedversions

In the next changesets, we will introduce more logic directly related to the
repository to decide what version have to be supported. So we now directly pass
the repo object instead of just ui.

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -874,23 +874,23 @@  class cg3packer(cg2packer):
              '03': (cg3packer, cg3unpacker),
 }
 
-def allsupportedversions(ui):
+def allsupportedversions(repo):
     versions = set(_packermap.keys())
-    if not (ui.configbool('experimental', 'changegroup3') or
-            ui.configbool('experimental', 'treemanifest')):
+    if not (repo.ui.configbool('experimental', 'changegroup3') or
+            repo.ui.configbool('experimental', 'treemanifest')):
         versions.discard('03')
     return versions
 
 # Changegroup versions that can be applied to the repo
 def supportedincomingversions(repo):
-    versions = allsupportedversions(repo.ui)
+    versions = allsupportedversions(repo)
     if 'treemanifest' in repo.requirements:
         versions.add('03')
     return versions
 
 # Changegroup versions that can be created from the repo
 def supportedoutgoingversions(repo):
-    versions = allsupportedversions(repo.ui)
+    versions = allsupportedversions(repo)
     if 'treemanifest' in repo.requirements:
         # Versions 01 and 02 support only flat manifests and it's just too
         # expensive to convert between the flat manifest and tree manifest on