mercurial/localrepo.py
changeset 21071 19b9f23a8c6f
parent 21070 408877d491fb
child 21106 53433d8f1faa
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()