diff --git a/hgext3rd/fastlog.py b/hgext3rd/fastlog.py --- a/hgext3rd/fastlog.py +++ b/hgext3rd/fastlog.py @@ -486,8 +486,17 @@ if self.stopped(): break self.queue.put((self.id, True, rev)) - - self.queue.put((self.id, True, None)) + # The end marker (self.id, True, None) indicates that the thread + # completed successfully. Don't send it if the thread is stopped. + # The thread can be stopped for one of two reasons: + # 1. The fastlog service failed - in this case, flagging a successful + # finish is harmful, because it will stop us continuing with local + # results, truncating output. + # 2. The caller is going to ignore all future results from us. In this + # case, it'll ignore the end marker anyway - it's discarding the + # entire queue. + if not self.stopped(): + self.queue.put((self.id, True, None)) if __name__ == '__main__': import doctest diff --git a/tests/test-fastlog.t b/tests/test-fastlog.t --- a/tests/test-fastlog.t +++ b/tests/test-fastlog.t @@ -250,3 +250,21 @@ 5946a2427fdfcb068a8aec1a59227d0d76062b43 728676e01661ccc3d7e39de054ca3a7288d7e7b6 +Test with failed network call + $ cat > $TESTTMP/bad_conduit.py <<'EOF' + > def call_conduit(*args, **kwargs): + > raise Exception('failed') + > def conduit_config(*args, **kwargs): + > return True + > EOF + + $ cat >> $HGRCPATH << EOF + > [extensions] + > fbconduit=$TESTTMP/bad_conduit.py + > EOF + + $ hg log parent -T '{rev} {desc}\n' 2>&1 | grep --invert-match 'failed' + 9 toys + 8 treats + 7 cookies + 6 major repo reorg