1 [short] skip
2 [!exec:hg] skip
3
4 env GO111MODULE=on
5 env GOPROXY=direct
6 env GOSUMDB=off
7 env GOMODCACHE=$WORK/modcache
8
9 # go mod download with the pseudo-version should invoke hg but not have a TagSum or Ref or RepoSum.
10 go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
11 stderr 'hg( .*)* pull'
12 cp stdout hellopseudo.json
13 ! stdout '"(Query|TagPrefix|TagSum|Ref|RepoSum)"'
14 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
15 stdout '"VCS": "hg"'
16 stdout '"URL": ".*/hg/hello"'
17 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
18 ! stdout '"RepoSum"'
19 go clean -modcache
20
21
22 # go mod download vcstest/hello should invoke hg, print origin info
23 go mod download -x -json vcs-test.golang.org/hg/hello.hg@latest
24 stderr 'hg( .*)* pull'
25 cp stdout hello.json
26 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
27 stdout '"VCS": "hg"'
28 stdout '"URL": ".*/hg/hello"'
29 stdout '"Query": "latest"'
30 ! stdout '"TagPrefix"'
31 ! stdout '"TagSum"'
32 stdout '"Ref": "tip"'
33 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
34 stdout '"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.
39 go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
40 ! stderr 'hg( .*)* pull'
41 cp stdout hellopseudo2.json
42 cmpenv hellopseudo.json hellopseudo2.json
43
44 # reuse go mod download vcstest/hello pseudoversion result
45 go clean -modcache
46 go mod download -reuse=hellopseudo.json -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
47 ! stderr 'hg( .*)* pull'
48 stdout '"Reuse": true'
49 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
50 stdout '"VCS": "hg"'
51 stdout '"URL": ".*/hg/hello"'
52 ! stdout '"(Query|TagPrefix|TagSum|Ref)"'
53 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
54 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
55
56 # reuse go mod download vcstest/hello result
57 go clean -modcache
58 go mod download -reuse=hello.json -x -json vcs-test.golang.org/hg/hello.hg@latest
59 ! stderr 'hg( .*)* pull'
60 stdout '"Reuse": true'
61 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
62 stdout '"VCS": "hg"'
63 stdout '"URL": ".*/hg/hello"'
64 ! stdout '"TagPrefix"'
65 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
66 stdout '"Ref": "tip"'
67 stdout '"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
71 go clean -modcache
72 go mod download -x -json vcs-test.golang.org/hg/hello.hg@latest
73 stderr 'hg( .*)* pull'
74 go clean -modcache
View as plain text