Mercurial > hg
changeset 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 | cf7014c5f087 |
files | mercurial/bundle2.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Thu Aug 21 18:18:38 2014 -0700 +++ b/mercurial/bundle2.py Tue Aug 26 11:48:26 2014 +0200 @@ -146,6 +146,7 @@ import struct import urllib import string +import obsolete import pushkey import changegroup, error @@ -800,6 +801,12 @@ capsblob = urllib.unquote(remote.capable('bundle2-exp')) return decodecaps(capsblob) +def obsmarkersversion(caps): + """extract the list of supported obsmarkers versions from a bundle2caps dict + """ + obscaps = caps.get('b2x:obsmarkers', ()) + return [int(c[1:]) for c in obscaps if c.startswith('V')] + @parthandler('b2x:changegroup') def handlechangegroup(op, inpart): """apply a changegroup part on the repo