comparison mercurial/bundle2.py @ 22344:9829b7948100

bundle2: add a `obsmarkersversion` function to extract supported version Right next to the function that encodes the supported versions in capabilities we add a function that decodes the versions out of capabilities. This is going to be useful to know what formats can be used for exchange.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 26 Aug 2014 11:48:26 +0200
parents 76677a2c1cfd
children e2806b8613ca
comparison
equal deleted inserted replaced
22343:76677a2c1cfd 22344:9829b7948100
144 144
145 import util 145 import util
146 import struct 146 import struct
147 import urllib 147 import urllib
148 import string 148 import string
149 import obsolete
149 import pushkey 150 import pushkey
150 151
151 import changegroup, error 152 import changegroup, error
152 from i18n import _ 153 from i18n import _
153 154
798 if not raw and raw != '': 799 if not raw and raw != '':
799 return {} 800 return {}
800 capsblob = urllib.unquote(remote.capable('bundle2-exp')) 801 capsblob = urllib.unquote(remote.capable('bundle2-exp'))
801 return decodecaps(capsblob) 802 return decodecaps(capsblob)
802 803
804 def obsmarkersversion(caps):
805 """extract the list of supported obsmarkers versions from a bundle2caps dict
806 """
807 obscaps = caps.get('b2x:obsmarkers', ())
808 return [int(c[1:]) for c in obscaps if c.startswith('V')]
809
803 @parthandler('b2x:changegroup') 810 @parthandler('b2x:changegroup')
804 def handlechangegroup(op, inpart): 811 def handlechangegroup(op, inpart):
805 """apply a changegroup part on the repo 812 """apply a changegroup part on the repo
806 813
807 This is a very early implementation that will massive rework before being 814 This is a very early implementation that will massive rework before being