comparison mercurial/localrepo.py @ 21071:19b9f23a8c6f

bundle2: return a bundle20 object from exchanges.unbundle When a bundle2 is pushed we return a bundle instead of an integer. We use to return a binary stream. We now return a `bundle20` bundler to make the life of wireprotocol implementation simpler.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 15 Apr 2014 16:49:30 -0400
parents 408877d491fb
children 53433d8f1faa
comparison
equal deleted inserted replaced
21070:408877d491fb 21071:19b9f23a8c6f
122 """apply a bundle on a repo 122 """apply a bundle on a repo
123 123
124 This function handles the repo locking itself.""" 124 This function handles the repo locking itself."""
125 try: 125 try:
126 cg = exchange.readbundle(self.ui, cg, None) 126 cg = exchange.readbundle(self.ui, cg, None)
127 return exchange.unbundle(self._repo, cg, heads, 'push', url) 127 ret = exchange.unbundle(self._repo, cg, heads, 'push', url)
128 if util.safehasattr(ret, 'getchunks'):
129 # This is a bundle20 object, turn it into an unbundler.
130 # This little dance should be dropped eventually when the API
131 # is finally improved.
132 stream = util.chunkbuffer(ret.getchunks())
133 ret = bundle2.unbundle20(self.ui, stream)
134 return ret
128 except exchange.PushRaced, exc: 135 except exchange.PushRaced, exc:
129 raise error.ResponseError(_('push failed:'), exc.message) 136 raise error.ResponseError(_('push failed:'), exc.message)
130 137
131 def lock(self): 138 def lock(self):
132 return self._repo.lock() 139 return self._repo.lock()