<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Oct 21, 2014, at 11:03 PM, Pierre-Yves David <<a href="mailto:pierre-yves.david@ens-lyon.org">pierre-yves.david@ens-lyon.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br><br>On 10/21/2014 10:41 PM, Augie Fackler wrote:<br><blockquote type="cite">On Tue, Oct 21, 2014 at 01:08:46PM -0700, Pierre-Yves David wrote:<br><blockquote type="cite"># HG changeset patch<br># User Pierre-Yves David <<a href="mailto:pierre-yves.david@fb.com">pierre-yves.david@fb.com</a>><br># Date 1413370340 25200<br>#      Wed Oct 15 03:52:20 2014 -0700<br># Branch stable<br># Node ID bd35fb4708eda7d548a34ef6ff504505cf0e85cb<br># Parent  1c1b98ea77615d601d8234f70728da9a21692c93<br>bundle2: transmit exception during part generation<br><br>If an exception is raised during a bundle2 part payload generation it is now<br>recorded in the bundle. If such exception occurs, we capture it, transmit an<br>abort exception through the bundle, cleanly close the current part payload and<br>raise it again. This allow to generate valid bundle even in case of exception so<br>that the consumer does not wait forever for a dead producer. This also allow to<br>raise the exception during unbundling at the exact point it happened during<br>bundling make debugging easier.<br><br>diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py<br>--- a/mercurial/bundle2.py<br>+++ b/mercurial/bundle2.py<br>@@ -143,10 +143,11 @@ process is aborted, the full bundle is s<br> channel usable. But none of the part read from an abort are processed. In the<br> future, dropping the stream may become an option for channel we do not care to<br> preserve.<br> """<br><br>+import sys<br> import util<br> import struct<br> import urllib<br> import string<br> import obsolete<br>@@ -671,13 +672,26 @@ class bundlepart(object):<br>         ## finalize header<br>         headerchunk = ''.join(header)<br>         yield _pack(_fpartheadersize, len(headerchunk))<br>         yield headerchunk<br>         ## payload<br>-        for chunk in self._payloadchunks():<br>-            yield _pack(_fpayloadsize, len(chunk))<br>-            yield chunk<br>+        try:<br>+            for chunk in self._payloadchunks():<br>+                yield _pack(_fpayloadsize, len(chunk))<br>+                yield chunk<br>+        except Exception:<br>+            # backup exception data for later<br>+            exc_info = sys.exc_info()<br>+            msg = 'unexpected error: %s' % exc<br></blockquote><br>exc isn't defined here - did you mean exc_info, or did you want to<br>catch the exception as exc?<br></blockquote><br>actually msg is not used. Drop the line.<br></div></blockquote><div><br></div><div>It appears to be on the next line - it looks like you meant to catch Exception as exc, so I've done that and will push soon.</div><br><blockquote type="cite"><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>--<span class="Apple-converted-space"> </span><br>Pierre-Yves David</div></blockquote></div><br></body></html>