Mercurial > hg-stable
changeset 24794:21f2e8f48ae1
bundle2: add a 'salvageoutput' method on bundle20
This method returns a copy of all 'output' parts added to the bundler.
This is the second step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output parts from the aborted reply
into the exception bundle.
The function will be used in a later patch.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 16 Apr 2015 03:16:04 -0400 |
parents | 2ec894582ea2 |
children | f9aa4cb8f2dd |
files | mercurial/bundle2.py |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Thu Apr 16 03:15:28 2015 -0400 +++ b/mercurial/bundle2.py Thu Apr 16 03:16:04 2015 -0400 @@ -480,6 +480,18 @@ blocks.append(par) return ' '.join(blocks) + def salvageoutput(self): + """return a list with a copy of all output parts in the bundle + + This is meant to be used during error handling to make sure we preserve + server output""" + salvaged = [] + for part in self._parts: + if part.type.startswith('output'): + salvaged.append(part.copy()) + return salvaged + + class unpackermixin(object): """A mixin to extract bytes and struct data from a stream"""