[PATCH] tests: do not use system hg if it does not have "files" command

Adam Simpkins simpkins at fb.com
Wed Jun 28 15:54:18 EDT 2017


On Jun 28, Jun Wu wrote:
> +
> +# Most test-check-* requiring testrepo use "hg files", which is not available
> +# in ancient versions of hg. So we double check if the syshg works and fallback
> +# to hg shipped in the repo.
> +syshg files -h >/dev/null 2>/dev/null
> +if [ $? -ne 0 ]; then
> +    function syshg {
> +        hg "$@"
> +    }
> +    function syshgenv {
> +        true
> +    }
> +fi

Looks good to me, but this will need to be updated to the
non-bash-specific function syntax (e.g., 'syshg () {'),
as Yuya pointed out on my earlier diff.

If you wanted to be pedantic you could also replace "true" with ":"
here; ":" is guaranteed to be a shell builtin; "true" may require
executing a separate process on some systems.  This probably doesn't
really matter though.

-- 
Adam Simpkins
simpkins at fb.com


More information about the Mercurial-devel mailing list