comparison mercurial/changegroup.py @ 27928:c0f11347b107 stable

changegroup: don't support versions 01 and 02 with treemanifests Since it would be terribly expensive to convert between flat manifests and treemanifests, we have decided to simply not support changegroup version 01 and 02 with treemanifests. Therefore, let's stop announcing that we support these versions on treemanifest repos. Note that this means that older clients that try to clone from a treemanifest repo will fail. What happens is that the server, after this patch, finds that there are no common versions and raises "ValueError: no common changegroup version". This results in "abort: HTTP Error 500: Internal Server Error" on the client. Before this patch, it was no better: The server would instead find that there were directory manifest nodes to put in the changegroup 01 or 02 and raise an AssertionError on changegroup.py#668 (assert not tmfnodes), which would also appear as a 500 to the client.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 19 Jan 2016 14:27:18 -0800
parents da5f23362517
children 3b2ac2115464
comparison
equal deleted inserted replaced
27927:0de4dfc9af0c 27928:c0f11347b107
945 # cg3 adds support for exchanging revlog flags and treemanifests 945 # cg3 adds support for exchanging revlog flags and treemanifests
946 '03': (cg3packer, cg3unpacker), 946 '03': (cg3packer, cg3unpacker),
947 } 947 }
948 948
949 def supportedversions(repo): 949 def supportedversions(repo):
950 versions = _packermap.keys() 950 versions = set(_packermap.keys())
951 cg3 = ('treemanifest' in repo.requirements or 951 if ('treemanifest' in repo.requirements or
952 repo.ui.configbool('experimental', 'changegroup3') or 952 repo.ui.configbool('experimental', 'treemanifest')):
953 repo.ui.configbool('experimental', 'treemanifest')) 953 # Versions 01 and 02 support only flat manifests and it's just too
954 if not cg3: 954 # expensive to convert between the flat manifest and tree manifest on
955 versions.remove('03') 955 # the fly. Since tree manifests are hashed differently, all of history
956 # would have to be converted. Instead, we simply don't even pretend to
957 # support versions 01 and 02.
958 versions.discard('01')
959 versions.discard('02')
960 elif not repo.ui.configbool('experimental', 'changegroup3'):
961 versions.discard('03')
956 return versions 962 return versions
957 963
958 def getbundler(version, repo, bundlecaps=None): 964 def getbundler(version, repo, bundlecaps=None):
959 assert version in supportedversions(repo) 965 assert version in supportedversions(repo)
960 return _packermap[version][0](repo, bundlecaps) 966 return _packermap[version][0](repo, bundlecaps)