# HG changeset patch # User Yuya Nishihara # Date 1506856910 -3600 # Node ID 153e4e05e9b32a0b2802b7b941a9233d5e13fa9b # Parent 0a0a72c043ac4a75f4ee018c2a78c382bd5ba633 extdata: show debug message if external command exits with non-zero status This isn't fatal because it's quite common for grep to exit with 1. Thanks to Foozy for spotting this. diff -r 0a0a72c043ac -r 153e4e05e9b3 mercurial/scmutil.py --- a/mercurial/scmutil.py Sat Sep 30 08:57:50 2017 +0100 +++ b/mercurial/scmutil.py Sun Oct 01 12:21:50 2017 +0100 @@ -1065,6 +1065,10 @@ finally: if proc: proc.communicate() + if proc.returncode != 0: + # not an error so 'cmd | grep' can be empty + repo.ui.debug("extdata command '%s' %s\n" + % (cmd, util.explainexit(proc.returncode)[0])) if src: src.close() diff -r 0a0a72c043ac -r 153e4e05e9b3 tests/test-extdata.t --- a/tests/test-extdata.t Sat Sep 30 08:57:50 2017 +0100 +++ b/tests/test-extdata.t Sun Oct 01 12:21:50 2017 +0100 @@ -12,6 +12,7 @@ > filedata = file:extdata.txt > notes = notes.txt > shelldata = shell:cat extdata.txt | grep 2 + > emptygrep = shell:cat extdata.txt | grep empty > EOF $ cat <<'EOF' > extdata.txt > 2 another comment on 2 @@ -42,6 +43,12 @@ (symbol '3')) 3 +test non-zero exit of shell command + + $ hg log -qr "extdata(emptygrep)" + $ hg log -qr "extdata(emptygrep)" --debug + extdata command 'cat extdata.txt | grep empty' exited with status * (glob) + test bad extdata() revset source $ hg log -qr "extdata()"