Mercurial > hg
changeset 21645:aed14bb165f3
bundle2: introduce a ``caps20to10`` function
This function factors the creation of appropriate entries to use in
``bundlecaps`` argument of ``getbundle``. This cleans up code calling
``getbundle`` and helps its usage in more part of the code.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 22 May 2014 13:31:33 -0700 |
parents | 17755dd8c509 |
children | ce25f465e572 |
files | mercurial/exchange.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Sat May 24 16:20:09 2014 -0700 +++ b/mercurial/exchange.py Thu May 22 13:31:33 2014 -0700 @@ -532,9 +532,7 @@ """pull data using bundle2 For now, the only supported data are changegroup.""" - kwargs = {'bundlecaps': set(['HG2X'])} - capsblob = bundle2.encodecaps(pullop.repo.bundle2caps) - kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob)) + kwargs = {'bundlecaps': caps20to10(pullop.repo)} # pulling changegroup pullop.todosteps.remove('changegroup') @@ -636,6 +634,13 @@ pullop.repo.invalidatevolatilesets() return tr +def caps20to10(repo): + """return a set with appropriate options to use bundle20 during getbundle""" + caps = set(['HG2X']) + capsblob = bundle2.encodecaps(repo.bundle2caps) + caps.add('bundle2=' + urllib.quote(capsblob)) + return caps + def getbundle(repo, source, heads=None, common=None, bundlecaps=None, **kwargs): """return a full bundle (with potentially multiple kind of parts)