mercurial/localrepo.py
changeset 24799 d99d7e3f5cda
parent 24798 9fbf0a2a72a1
child 24821 57f1dbc99631
equal deleted inserted replaced
24798:9fbf0a2a72a1 24799:d99d7e3f5cda
   134                     # API is finally improved.
   134                     # API is finally improved.
   135                     stream = util.chunkbuffer(ret.getchunks())
   135                     stream = util.chunkbuffer(ret.getchunks())
   136                     ret = bundle2.getunbundler(self.ui, stream)
   136                     ret = bundle2.getunbundler(self.ui, stream)
   137                 return ret
   137                 return ret
   138             except Exception, exc:
   138             except Exception, exc:
       
   139                 # If the exception contains output salvaged from a bundle2
       
   140                 # reply, we need to make sure it is printed before continuing
       
   141                 # to fail. So we build a bundle2 with such output and consume
       
   142                 # it directly.
       
   143                 #
       
   144                 # This is not very elegant but allows a "simple" solution for
       
   145                 # issue4594
       
   146                 output = getattr(exc, '_bundle2salvagedoutput', ())
       
   147                 if output:
       
   148                     bundler = bundle2.bundle20(self._repo.ui)
       
   149                     for out in output:
       
   150                         bundler.addpart(out)
       
   151                     stream = util.chunkbuffer(bundler.getchunks())
       
   152                     b = bundle2.getunbundler(self.ui, stream)
       
   153                     bundle2.processbundle(self._repo, b)
   139                 raise
   154                 raise
   140         except error.PushRaced, exc:
   155         except error.PushRaced, exc:
   141             raise error.ResponseError(_('push failed:'), str(exc))
   156             raise error.ResponseError(_('push failed:'), str(exc))
   142 
   157 
   143     def lock(self):
   158     def lock(self):