Mercurial > hg
comparison mercurial/changegroup.py @ 30627:7ace5304fec5
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.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 19 Dec 2016 04:29:33 +0100 |
parents | 438532c99b54 |
children | a001cd7296a5 |
comparison
equal
deleted
inserted
replaced
30626:438532c99b54 | 30627:7ace5304fec5 |
---|---|
872 '02': (cg2packer, cg2unpacker), | 872 '02': (cg2packer, cg2unpacker), |
873 # cg3 adds support for exchanging revlog flags and treemanifests | 873 # cg3 adds support for exchanging revlog flags and treemanifests |
874 '03': (cg3packer, cg3unpacker), | 874 '03': (cg3packer, cg3unpacker), |
875 } | 875 } |
876 | 876 |
877 def allsupportedversions(ui): | 877 def allsupportedversions(repo): |
878 versions = set(_packermap.keys()) | 878 versions = set(_packermap.keys()) |
879 if not (ui.configbool('experimental', 'changegroup3') or | 879 if not (repo.ui.configbool('experimental', 'changegroup3') or |
880 ui.configbool('experimental', 'treemanifest')): | 880 repo.ui.configbool('experimental', 'treemanifest')): |
881 versions.discard('03') | 881 versions.discard('03') |
882 return versions | 882 return versions |
883 | 883 |
884 # Changegroup versions that can be applied to the repo | 884 # Changegroup versions that can be applied to the repo |
885 def supportedincomingversions(repo): | 885 def supportedincomingversions(repo): |
886 versions = allsupportedversions(repo.ui) | 886 versions = allsupportedversions(repo) |
887 if 'treemanifest' in repo.requirements: | 887 if 'treemanifest' in repo.requirements: |
888 versions.add('03') | 888 versions.add('03') |
889 return versions | 889 return versions |
890 | 890 |
891 # Changegroup versions that can be created from the repo | 891 # Changegroup versions that can be created from the repo |
892 def supportedoutgoingversions(repo): | 892 def supportedoutgoingversions(repo): |
893 versions = allsupportedversions(repo.ui) | 893 versions = allsupportedversions(repo) |
894 if 'treemanifest' in repo.requirements: | 894 if 'treemanifest' in repo.requirements: |
895 # Versions 01 and 02 support only flat manifests and it's just too | 895 # Versions 01 and 02 support only flat manifests and it's just too |
896 # expensive to convert between the flat manifest and tree manifest on | 896 # expensive to convert between the flat manifest and tree manifest on |
897 # the fly. Since tree manifests are hashed differently, all of history | 897 # the fly. Since tree manifests are hashed differently, all of history |
898 # would have to be converted. Instead, we simply don't even pretend to | 898 # would have to be converted. Instead, we simply don't even pretend to |