[short] skip
[!exec:hg] skip

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

# go mod download vcstest/prefixtagtests should invoke hg, print origin info
go mod download -x -json vcs-test.golang.org/hg/prefixtagtests.hg/sub@latest
stderr 'hg( .*)* pull'
cp stdout prefixtagtests.json
stdout '"Version": "v0.0.10"'
stdout '"Query": "latest"'
stdout '"VCS": "hg"'
stdout '"URL": ".*/hg/prefixtagtests"'
stdout '"Subdir": "sub"'
stdout '"Ref": "sub/v0.0.10"'
! stdout '"TagPrefix"'
! stdout '"TagSum"'
stdout '"RepoSum": "r1:YWOcei109p5Kohsr5xnSYlaQXmpT3iWZHZhRbfMoTkc="'
stdout '"Hash": "1cc0dfcc254cb8901799e7f7ae182c04019b7a88"'

# go mod download vcstest/prefixtagtests result with json
go clean -modcache
go mod download -reuse=prefixtagtests.json -x -json vcs-test.golang.org/hg/prefixtagtests.hg/sub@latest
! stderr 'hg( .*)* pull'
stdout '"Version": "v0.0.10"'
stdout '"Query": "latest"'
stdout '"VCS": "hg"'
stdout '"URL": ".*/hg/prefixtagtests"'
stdout '"Subdir": "sub"'
stdout '"RepoSum": "r1:YWOcei109p5Kohsr5xnSYlaQXmpT3iWZHZhRbfMoTkc="'
stdout '"Ref": "sub/v0.0.10"'
stdout '"Hash": "1cc0dfcc254cb8901799e7f7ae182c04019b7a88"'
! stdout '"(Dir|Info|GoMod|Zip)"'