Mercurial > repos > other > linux
changeset 161:912d1c33382f
Handle missing files in Mercurial state check
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 12 Nov 2023 09:04:12 +0000 |
parents | 961186621cc8 |
children | bb0e1239a611 |
files | bashrc |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/bashrc Sat Nov 11 20:29:16 2023 +0000 +++ b/bashrc Sun Nov 12 09:04:12 2023 +0000 @@ -72,12 +72,12 @@ HG_MODIFIED=$([ "$(rhg status -mard | head -c1)" ] && echo " *") HG_INCOMING_PATH="${HG_ROOT}"/.hg/prompt/cache/incoming HG_OUTGOING_PATH="${HG_ROOT}"/.hg/prompt/cache/outgoing - if [[ $(($(date +%s) - $(date -r "${HG_INCOMING_PATH}" +%s 2>/dev/null) )) -gt $HG_CACHE_TIMEOUT ]]; then + if [[ ! -f "${HG_INCOMING_PATH}" || $(($(date +%s) - $(date -r "${HG_INCOMING_PATH}" +%s 2>/dev/null || echo 0) )) -gt $HG_CACHE_TIMEOUT ]]; then hg incoming --quiet --config ui.interactive=False > "$HG_INCOMING_PATH" hg outgoing --quiet --config ui.interactive=False > "$HG_OUTGOING_PATH" fi - HG_IN=$(wc -l < "$HG_INCOMING_PATH") - HG_OUT=$(wc -l < "$HG_OUTGOING_PATH") + HG_IN=$([ -f "${HG_INCOMING_PATH}" ] && wc -l < "$HG_INCOMING_PATH" 2>/dev/null || echo 0) + HG_OUT=$([ -f "${HG_OUTGOING_PATH}" ] && wc -l < "$HG_OUTGOING_PATH" 2>/dev/null || echo 0) if [[ $HG_IN = "0" && $HG_OUT = "0" ]]; then HG_INOUT=" u=" else