mercurial/bundle2.py
branchstable
changeset 24878 e530cde6d115
parent 24851 df0ce98c882f
child 25181 d26703eb3dc5
equal deleted inserted replaced
24877:cc497780eaf9 24878:e530cde6d115
   266     * a way to retrieve a transaction to add changes to the repo,
   266     * a way to retrieve a transaction to add changes to the repo,
   267     * a way to record the result of processing each part,
   267     * a way to record the result of processing each part,
   268     * a way to construct a bundle response when applicable.
   268     * a way to construct a bundle response when applicable.
   269     """
   269     """
   270 
   270 
   271     def __init__(self, repo, transactiongetter):
   271     def __init__(self, repo, transactiongetter, captureoutput=True):
   272         self.repo = repo
   272         self.repo = repo
   273         self.ui = repo.ui
   273         self.ui = repo.ui
   274         self.records = unbundlerecords()
   274         self.records = unbundlerecords()
   275         self.gettransaction = transactiongetter
   275         self.gettransaction = transactiongetter
   276         self.reply = None
   276         self.reply = None
       
   277         self.captureoutput = captureoutput
   277 
   278 
   278 class TransactionUnavailable(RuntimeError):
   279 class TransactionUnavailable(RuntimeError):
   279     pass
   280     pass
   280 
   281 
   281 def _notransaction():
   282 def _notransaction():
   357         # handler is called outside the above try block so that we don't
   358         # handler is called outside the above try block so that we don't
   358         # risk catching KeyErrors from anything other than the
   359         # risk catching KeyErrors from anything other than the
   359         # parthandlermapping lookup (any KeyError raised by handler()
   360         # parthandlermapping lookup (any KeyError raised by handler()
   360         # itself represents a defect of a different variety).
   361         # itself represents a defect of a different variety).
   361         output = None
   362         output = None
   362         if op.reply is not None:
   363         if op.captureoutput and op.reply is not None:
   363             op.ui.pushbuffer(error=True, subproc=True)
   364             op.ui.pushbuffer(error=True, subproc=True)
   364             output = ''
   365             output = ''
   365         try:
   366         try:
   366             handler(op, part)
   367             handler(op, part)
   367         finally:
   368         finally:
   838     """
   839     """
   839 
   840 
   840     def __init__(self, ui):
   841     def __init__(self, ui):
   841         self.ui = ui
   842         self.ui = ui
   842         self.reply = None
   843         self.reply = None
       
   844         self.captureoutput = False
   843 
   845 
   844     @property
   846     @property
   845     def repo(self):
   847     def repo(self):
   846         raise RuntimeError('no repo access from stream interruption')
   848         raise RuntimeError('no repo access from stream interruption')
   847 
   849