...
1[short] skip
2[!exec:hg] skip
3
4env GO111MODULE=on
5env GOPROXY=direct
6env GOSUMDB=off
7env GOMODCACHE=$WORK/modcache
8
9# go mod download with the pseudo-version should invoke hg but not have a TagSum or Ref or RepoSum.
10go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
11stderr 'hg( .*)* pull'
12cp stdout hellopseudo.json
13! stdout '"(Query|TagPrefix|TagSum|Ref|RepoSum)"'
14stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
15stdout '"VCS": "hg"'
16stdout '"URL": ".*/hg/hello"'
17stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
18! stdout '"RepoSum"'
19go clean -modcache
20
21
22# go mod download vcstest/hello should invoke hg, print origin info
23go mod download -x -json vcs-test.golang.org/hg/hello.hg@latest
24stderr 'hg( .*)* pull'
25cp stdout hello.json
26stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
27stdout '"VCS": "hg"'
28stdout '"URL": ".*/hg/hello"'
29stdout '"Query": "latest"'
30! stdout '"TagPrefix"'
31! stdout '"TagSum"'
32stdout '"Ref": "tip"'
33stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
34stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
35
36# pseudo-version again should not invoke hg pull (it has the version from the @latest query)
37# but still be careful not to include a TagSum or a Ref, especially not Ref set to HEAD,
38# which is easy to do when reusing the cached version from the @latest query.
39go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
40! stderr 'hg( .*)* pull'
41cp stdout hellopseudo2.json
42cmpenv hellopseudo.json hellopseudo2.json
43
44# reuse go mod download vcstest/hello pseudoversion result
45go clean -modcache
46go mod download -reuse=hellopseudo.json -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
47! stderr 'hg( .*)* pull'
48stdout '"Reuse": true'
49stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
50stdout '"VCS": "hg"'
51stdout '"URL": ".*/hg/hello"'
52! stdout '"(Query|TagPrefix|TagSum|Ref)"'
53stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
54! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
55
56# reuse go mod download vcstest/hello result
57go clean -modcache
58go mod download -reuse=hello.json -x -json vcs-test.golang.org/hg/hello.hg@latest
59! stderr 'hg( .*)* pull'
60stdout '"Reuse": true'
61stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
62stdout '"VCS": "hg"'
63stdout '"URL": ".*/hg/hello"'
64! stdout '"TagPrefix"'
65stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
66stdout '"Ref": "tip"'
67stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
68! stdout '"(Dir|Info|GoMod|Zip)"'
69
70# clean the module cache, make sure that makes go mod download re-run hg pull, clean again
71go clean -modcache
72go mod download -x -json vcs-test.golang.org/hg/hello.hg@latest
73stderr 'hg( .*)* pull'
74go clean -modcacheView as plain text