[short] skip
[!exec:hg] skip

env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off
env GOMODCACHE=$WORK/modcache

# go mod download vcstest/hello/sub/v9 should also fail, print origin info
# hg uses RepoSum instead of TagSum to describe failure condition.
! go mod download -x -json vcs-test.golang.org/hg/hello.hg/sub/v9@latest
cp stdout hellosubv9.json
stdout '"Version": "latest"'
stdout '"Error":.*no matching versions'
! stdout '"TagPrefix"'
stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'

# reuse go mod download vcstest/hello/sub/v9 error result
go clean -modcache
! go mod download -reuse=hellosubv9.json -x -json vcs-test.golang.org/hg/hello.hg/sub/v9@latest
! stderr 'hg( .*)* pull'
stdout '"Reuse": true'
stdout '"Error":.*no matching versions'
! stdout '"TagPrefix"'
stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
stdout '"Ref": "tip"'
stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
! stdout '"(Dir|Info|GoMod|Zip)"'