Show More
@@ -333,6 +333,29 b' def processbundle(repo, unbundler, trans' | |||||
333 | raise |
|
333 | raise | |
334 | return op |
|
334 | return op | |
335 |
|
335 | |||
|
336 | def decodecaps(blob): | |||
|
337 | """decode a bundle2 caps bytes blob into a dictionnary | |||
|
338 | ||||
|
339 | The blob is a list of capabilities (one per line) | |||
|
340 | Capabilities may have values using a line of the form:: | |||
|
341 | ||||
|
342 | capability=value1,value2,value3 | |||
|
343 | ||||
|
344 | The values are always a list.""" | |||
|
345 | caps = {} | |||
|
346 | for line in blob.splitlines(): | |||
|
347 | if not line: | |||
|
348 | continue | |||
|
349 | if '=' not in line: | |||
|
350 | key, vals = line, () | |||
|
351 | else: | |||
|
352 | key, vals = line.split('=', 1) | |||
|
353 | vals = vals.split(',') | |||
|
354 | key = urllib.unquote(key) | |||
|
355 | vals = [urllib.unquote(v) for v in vals] | |||
|
356 | caps[key] = vals | |||
|
357 | return caps | |||
|
358 | ||||
336 | class bundle20(object): |
|
359 | class bundle20(object): | |
337 | """represent an outgoing bundle2 container |
|
360 | """represent an outgoing bundle2 container | |
338 |
|
361 | |||
@@ -697,24 +720,8 b' def handleoutput(op, inpart):' | |||||
697 | def handlereplycaps(op, inpart): |
|
720 | def handlereplycaps(op, inpart): | |
698 | """Notify that a reply bundle should be created |
|
721 | """Notify that a reply bundle should be created | |
699 |
|
722 | |||
700 |
The pa |
|
723 | The payload contains the capabilities information for the reply""" | |
701 | Capabilities may have values using a line of form:: |
|
724 | caps = decodecaps(inpart.read()) | |
702 |
|
||||
703 | capability=value1,value2,value3 |
|
|||
704 |
|
||||
705 | The value are alway a list.""" |
|
|||
706 | caps = {} |
|
|||
707 | for line in inpart.read().splitlines(): |
|
|||
708 | if not line: |
|
|||
709 | continue |
|
|||
710 | if '=' not in line: |
|
|||
711 | key, vals = line, () |
|
|||
712 | else: |
|
|||
713 | key, vals = line.split('=', 1) |
|
|||
714 | vals = vals.split(',') |
|
|||
715 | key = urllib.unquote(key) |
|
|||
716 | vals = [urllib.unquote(v) for v in vals] |
|
|||
717 | caps[key] = vals |
|
|||
718 | if op.reply is None: |
|
725 | if op.reply is None: | |
719 | op.reply = bundle20(op.ui, caps) |
|
726 | op.reply = bundle20(op.ui, caps) | |
720 |
|
727 |
General Comments 0
You need to be logged in to leave comments.
Login now