[short] skip
[!exec:hg] skip

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

# go mod download hg/hello@hash needs to check RepoSum to find pseudoversion base,
# which does a refreshing hg pull.
go mod download -x -json vcs-test.golang.org/hg/hello.hg@e483a7d9f8c9
stderr 'hg( .*)* pull'
cp stdout hellohash.json
stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
stdout '"Query": "e483a7d9f8c9"'
stdout '"VCS": "hg"'
stdout '"URL": ".*/hg/hello"'
stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'

# reuse go mod download vcstest/hello@hash
go clean -modcache
go mod download -reuse=hellohash.json -x -json vcs-test.golang.org/hg/hello.hg@e483a7d9f8c9
! stderr 'hg( .*)* pull'
stdout '"Reuse": true'
stdout '"Query": "e483a7d9f8c9"'
stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
stdout '"VCS": "hg"'
stdout '"URL": ".*/hg/hello"'
! stdout '"(TagPrefix|Ref)"'
stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
! stdout '"(Dir|Info|GoMod|Zip)"'