Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 21068:c15b66a6bbb4
bundle2: return a stream from exchange.getbundle
For friendliness with the wire protocol implementation, the `exchange.getbundle` now
returns a binary stream when asked for a bundle2. We detect a bundle2 request and
upgrade the binary stream to an unbundler object.
In the future the unbundler may gain feature to look like a binary stream, but
we are not quite there yet.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 15 Apr 2014 11:27:55 -0400 |
parents | 7974aa88868e |
children | 408877d491fb |
comparison
equal
deleted
inserted
replaced
21067:7974aa88868e | 21068:c15b66a6bbb4 |
---|---|
657 # very crude first implementation, | 657 # very crude first implementation, |
658 # the bundle API will change and the generation will be done lazily. | 658 # the bundle API will change and the generation will be done lazily. |
659 bundler = bundle2.bundle20(repo.ui) | 659 bundler = bundle2.bundle20(repo.ui) |
660 part = bundle2.bundlepart('changegroup', data=cg.getchunks()) | 660 part = bundle2.bundlepart('changegroup', data=cg.getchunks()) |
661 bundler.addpart(part) | 661 bundler.addpart(part) |
662 return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks())) | 662 return util.chunkbuffer(bundler.getchunks()) |
663 | 663 |
664 class PushRaced(RuntimeError): | 664 class PushRaced(RuntimeError): |
665 """An exception raised during unbundling that indicate a push race""" | 665 """An exception raised during unbundling that indicate a push race""" |
666 | 666 |
667 def check_heads(repo, their_heads, context): | 667 def check_heads(repo, their_heads, context): |