# HG changeset patch # User Augie Fackler # Date 1562608861 14400 # Node ID ea6558db10114c144ee2d6613c2329a71e904cda # Parent eec65b706caf164fe8ca173c70fde842e8b77d38 extdata: avoid crashing inside subprocess when we get a revset parse error Differential Revision: https://phab.mercurial-scm.org/D6616 diff -r eec65b706caf -r ea6558db1011 mercurial/scmutil.py --- a/mercurial/scmutil.py Mon Jul 08 13:57:44 2019 -0400 +++ b/mercurial/scmutil.py Mon Jul 08 14:01:01 2019 -0400 @@ -1541,7 +1541,12 @@ pass # we ignore data for nodes that don't exist locally finally: if proc: - proc.communicate() + try: + proc.communicate() + except ValueError: + # This happens if we started iterating src and then + # get a parse error on a line. It should be safe to ignore. + pass if src: src.close() if proc and proc.returncode != 0: diff -r eec65b706caf -r ea6558db1011 tests/test-extdata.t --- a/tests/test-extdata.t Mon Jul 08 13:57:44 2019 -0400 +++ b/tests/test-extdata.t Mon Jul 08 14:01:01 2019 -0400 @@ -66,9 +66,14 @@ > 9de260b1e88e > EOF -BUG: this should print the revset parse error - $ hg log -qr "extdata(badparse)" 2>&1 | grep ValueError - ValueError: Mixing iteration and read methods would lose data +It might be nice if this error message mentioned where the bad string +came from (eg line X of extdata source S), but the important thing is +that we don't crash before we can print the parse error. + $ hg log -qr "extdata(badparse)" + hg: parse error at 0: not a prefix: + + (+---------------------------------------+ + ^ here) + [255] test template support: