1 [short] skip
2 [!exec:hg] skip
3
4 env GO111MODULE=on
5 env GOPROXY=direct
6 env GOSUMDB=off
7
8 # go mod download with the pseudo-version should invoke hg but not have a TagSum or Ref or RepoSum.
9 go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
10 stderr 'hg( .*)* pull'
11 cp stdout hellopseudo.json
12 ! stdout '"(Query|TagPrefix|TagSum|Ref|RepoSum)"'
13 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
14 stdout '"VCS": "hg"'
15 stdout '"URL": ".*/hg/hello"'
16 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
17 ! stdout '"RepoSum"'
18 go clean -modcache
19
20 # go mod download vcstest/hello should invoke hg, print origin info
21 go mod download -x -json vcs-test.golang.org/hg/hello.hg@latest
22 stderr 'hg( .*)* pull'
23 cp stdout hello.json
24 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
25 stdout '"VCS": "hg"'
26 stdout '"URL": ".*/hg/hello"'
27 stdout '"Query": "latest"'
28 ! stdout '"TagPrefix"'
29 ! stdout '"TagSum"'
30 stdout '"Ref": "tip"'
31 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
32 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
33
34 # pseudo-version again should not invoke hg pull (it has the version from the @latest query)
35 # but still be careful not to include a TagSum or a Ref, especially not Ref set to HEAD,
36 # which is easy to do when reusing the cached version from the @latest query.
37 go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
38 ! stderr 'hg( .*)* pull'
39 cp stdout hellopseudo2.json
40 cmpenv hellopseudo.json hellopseudo2.json
41
42 # go mod download hg/hello@hash needs to check RepoSum to find pseudoversion base,
43 # which does a refreshing hg pull.
44 go mod download -x -json vcs-test.golang.org/hg/hello.hg@e483a7d9f8c9
45 stderr 'hg( .*)* pull'
46 cp stdout hellohash.json
47 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
48 stdout '"Query": "e483a7d9f8c9"'
49 stdout '"VCS": "hg"'
50 stdout '"URL": ".*/hg/hello"'
51 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
52 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
53
54 # go mod download vcstest/hello/v9 should fail, still print origin info
55 # hg uses RepoSum instead of TagSum to describe failure condition.
56 ! go mod download -x -json vcs-test.golang.org/hg/hello.hg/v9@latest
57 cp stdout hellov9.json
58 stdout '"Version": "latest"'
59 stdout '"Error":.*no matching versions'
60 ! stdout '"TagPrefix"'
61 ! stdout '"TagSum"'
62 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
63 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
64
65 # go mod download vcstest/hello/sub/v9 should also fail, print origin info
66 # hg uses RepoSum instead of TagSum to describe failure condition.
67 ! go mod download -x -json vcs-test.golang.org/hg/hello.hg/sub/v9@latest
68 cp stdout hellosubv9.json
69 stdout '"Version": "latest"'
70 stdout '"Error":.*no matching versions'
71 ! stdout '"TagPrefix"'
72 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
73 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
74
75 # go mod download vcstest/hello@nonexist should fail, still print origin info
76 ! go mod download -x -json vcs-test.golang.org/hg/hello.hg@nonexist
77 cp stdout hellononexist.json
78 stdout '"Version": "nonexist"'
79 stdout '"Error":.*unknown revision nonexist'
80 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
81 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
82
83 # go mod download vcstest/hello@1234567890123456789012345678901234567890 should fail, still print origin info
84 # (40 hex digits is assumed to be a full hash and is a slightly different code path from @nonexist)
85 ! go mod download -x -json vcs-test.golang.org/hg/hello.hg@1234567890123456789012345678901234567890
86 cp stdout hellononhash.json
87 stdout '"Version": "1234567890123456789012345678901234567890"'
88 stdout '"Error":.*unknown revision 1234567890123456789012345678901234567890'
89 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
90 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
91
92 # go mod download vcstest/hello@v0.0.0-20220101120101-123456789abc should fail, still print origin info
93 # (non-existent pseudoversion)
94 ! go mod download -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20220101120101-123456789abc
95 cp stdout hellononpseudo.json
96 stdout '"Version": "v0.0.0-20220101120101-123456789abc"'
97 stdout '"Error":.*unknown revision 123456789abc'
98 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
99 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
100
101 # go mod download vcstest/tagtests should invoke hg, print origin info
102 # Need RepoSum to lock in tagged "latest".
103 go mod download -x -json vcs-test.golang.org/hg/tagtests.hg@latest
104 stderr 'hg( .*)* pull'
105 cp stdout tagtests.json
106 stdout '"Version": "v0.2.2"'
107 stdout '"Query": "latest"'
108 stdout '"VCS": "hg"'
109 stdout '"URL": ".*/hg/tagtests"'
110 ! stdout '"TagPrefix"'
111 ! stdout '"TagSum"'
112 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
113 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
114
115 # go mod download vcstest/tagtests@v0.2.2 should print origin info, no TagSum or RepoSum needed.
116 go mod download -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
117 cp stdout tagtestsv022.json
118 stdout '"Version": "v0.2.2"'
119 ! stdout '"Query":'
120 stdout '"VCS": "hg"'
121 stdout '"URL": ".*/hg/tagtests"'
122 ! stdout '"TagPrefix"'
123 ! stdout '"TagSum"'
124 ! stdout '"RepoSum"'
125 stdout '"Ref": "v0.2.2"'
126 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
127
128 # go mod download vcstest/tagtests@default needs a RepoSum again
129 go mod download -x -json vcs-test.golang.org/hg/tagtests.hg@default
130 cp stdout tagtestsdefault.json
131 stdout '"Version": "v0.2.3-0.20190509225625-8d0b18b816df"'
132 stdout '"Query": "default"'
133 stdout '"VCS": "hg"'
134 stdout '"URL": ".*/hg/tagtests"'
135 ! stdout '"TagPrefix"'
136 ! stdout '"TagSum"'
137 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
138 stdout '"Hash": "8d0b18b816df5e9c564761b405b1d7949c24ee6b"'
139
140 # go mod download vcstest/prefixtagtests should invoke hg, print origin info
141 go mod download -x -json vcs-test.golang.org/hg/prefixtagtests.hg/sub@latest
142 stderr 'hg( .*)* pull'
143 cp stdout prefixtagtests.json
144 stdout '"Version": "v0.0.10"'
145 stdout '"Query": "latest"'
146 stdout '"VCS": "hg"'
147 stdout '"URL": ".*/hg/prefixtagtests"'
148 stdout '"Subdir": "sub"'
149 stdout '"Ref": "sub/v0.0.10"'
150 ! stdout '"TagPrefix"'
151 ! stdout '"TagSum"'
152 stdout '"RepoSum": "r1:YWOcei109p5Kohsr5xnSYlaQXmpT3iWZHZhRbfMoTkc="'
153 stdout '"Hash": "1cc0dfcc254cb8901799e7f7ae182c04019b7a88"'
154
155 # go mod download of a bunch of these should fail (some are invalid) but write good JSON for later
156 ! go mod download -json vcs-test.golang.org/hg/hello.hg@latest vcs-test.golang.org/hg/hello.hg/v9@latest vcs-test.golang.org/hg/hello.hg/sub/v9@latest vcs-test.golang.org/hg/tagtests.hg@latest vcs-test.golang.org/hg/tagtests.hg@v0.2.2 vcs-test.golang.org/hg/tagtests.hg@default
157 cp stdout all.json
158
159 # clean the module cache, make sure that makes go mod download re-run hg pull, clean again
160 go clean -modcache
161 go mod download -x -json vcs-test.golang.org/hg/hello.hg@latest
162 stderr 'hg( .*)* pull'
163 go clean -modcache
164
165 # reuse go mod download vcstest/hello result
166 go clean -modcache
167 go mod download -reuse=hello.json -x -json vcs-test.golang.org/hg/hello.hg@latest
168 ! stderr 'hg( .*)* pull'
169 stdout '"Reuse": true'
170 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
171 stdout '"VCS": "hg"'
172 stdout '"URL": ".*/hg/hello"'
173 ! stdout '"TagPrefix"'
174 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
175 stdout '"Ref": "tip"'
176 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
177 ! stdout '"(Dir|Info|GoMod|Zip)"'
178
179 # reuse go mod download vcstest/hello pseudoversion result
180 go clean -modcache
181 go mod download -reuse=hellopseudo.json -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20170922011414-e483a7d9f8c9
182 ! stderr 'hg( .*)* pull'
183 stdout '"Reuse": true'
184 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
185 stdout '"VCS": "hg"'
186 stdout '"URL": ".*/hg/hello"'
187 ! stdout '"(Query|TagPrefix|TagSum|Ref)"'
188 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
189 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
190
191 # reuse go mod download vcstest/hello@hash
192 go clean -modcache
193 go mod download -reuse=hellohash.json -x -json vcs-test.golang.org/hg/hello.hg@e483a7d9f8c9
194 ! stderr 'hg( .*)* pull'
195 stdout '"Reuse": true'
196 stdout '"Query": "e483a7d9f8c9"'
197 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
198 stdout '"VCS": "hg"'
199 stdout '"URL": ".*/hg/hello"'
200 ! stdout '"(TagPrefix|Ref)"'
201 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
202 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
203 ! stdout '"(Dir|Info|GoMod|Zip)"'
204
205 # reuse go mod download vcstest/hello/v9 error result
206 go clean -modcache
207 ! go mod download -reuse=hellov9.json -x -json vcs-test.golang.org/hg/hello.hg/v9@latest
208 ! stderr 'hg( .*)* pull'
209 stdout '"Reuse": true'
210 stdout '"Error":.*no matching versions'
211 ! stdout '"TagPrefix"'
212 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
213 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
214 ! stdout '"(Dir|Info|GoMod|Zip)"'
215
216 # reuse go mod download vcstest/hello/sub/v9 error result
217 go clean -modcache
218 ! go mod download -reuse=hellosubv9.json -x -json vcs-test.golang.org/hg/hello.hg/sub/v9@latest
219 ! stderr 'hg( .*)* pull'
220 stdout '"Reuse": true'
221 stdout '"Error":.*no matching versions'
222 ! stdout '"TagPrefix"'
223 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
224 stdout '"Ref": "tip"'
225 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
226 ! stdout '"(Dir|Info|GoMod|Zip)"'
227
228 # reuse go mod download vcstest/hello@nonexist
229 go clean -modcache
230 ! go mod download -reuse=hellononexist.json -x -json vcs-test.golang.org/hg/hello.hg@nonexist
231 ! stderr 'hg( .*)* pull'
232 stdout '"Reuse": true'
233 stdout '"Version": "nonexist"'
234 stdout '"Error":.*unknown revision nonexist'
235 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
236 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
237 ! stdout '"(Dir|Info|GoMod|Zip)"'
238
239 # reuse go mod download vcstest/hello@1234567890123456789012345678901234567890
240 go clean -modcache
241 ! go mod download -reuse=hellononhash.json -x -json vcs-test.golang.org/hg/hello.hg@1234567890123456789012345678901234567890
242 ! stderr 'hg( .*)* pull'
243 stdout '"Reuse": true'
244 stdout '"Version": "1234567890123456789012345678901234567890"'
245 stdout '"Error":.*unknown revision 1234567890123456789012345678901234567890'
246 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
247 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
248 ! stdout '"(Dir|Info|GoMod|Zip)"'
249
250 # reuse go mod download vcstest/hello@v0.0.0-20220101120101-123456789abc
251 go clean -modcache
252 ! go mod download -reuse=hellononpseudo.json -x -json vcs-test.golang.org/hg/hello.hg@v0.0.0-20220101120101-123456789abc
253 ! stderr 'hg( .*)* pull'
254 stdout '"Reuse": true'
255 stdout '"Version": "v0.0.0-20220101120101-123456789abc"'
256 stdout '"Error":.*unknown revision 123456789abc'
257 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
258 ! stdout '"(TagPrefix|TagSum|Ref|Hash)"'
259 ! stdout '"(Dir|Info|GoMod|Zip)"'
260
261 # reuse go mod download vcstest/tagtests result
262 go clean -modcache
263 go mod download -reuse=tagtests.json -x -json vcs-test.golang.org/hg/tagtests.hg@latest
264 ! stderr 'hg( .*)* pull'
265 stdout '"Reuse": true'
266 stdout '"Version": "v0.2.2"'
267 stdout '"Query": "latest"'
268 stdout '"VCS": "hg"'
269 stdout '"URL": ".*/hg/tagtests"'
270 ! stdout '"TagPrefix"'
271 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
272 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
273 ! stdout '"(Dir|Info|GoMod|Zip)"'
274
275 # reuse go mod download vcstest/tagtests@v0.2.2 result
276 go clean -modcache
277 go mod download -reuse=tagtestsv022.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
278 ! stderr 'hg( .*)* pull'
279 stdout '"Reuse": true'
280 stdout '"Version": "v0.2.2"'
281 ! stdout '"Query":'
282 stdout '"VCS": "hg"'
283 stdout '"URL": ".*/hg/tagtests"'
284 ! stdout '"TagPrefix"'
285 ! stdout '"TagSum"'
286 stdout '"Ref": "v0.2.2"'
287 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
288 ! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
289
290 # reuse go mod download vcstest/tagtests@default result
291 go clean -modcache
292 go mod download -reuse=tagtestsdefault.json -x -json vcs-test.golang.org/hg/tagtests.hg@default
293 ! stderr 'hg( .*)* pull'
294 stdout '"Reuse": true'
295 stdout '"Version": "v0.2.3-0.20190509225625-8d0b18b816df"'
296 stdout '"Query": "default"'
297 stdout '"VCS": "hg"'
298 stdout '"URL": ".*/hg/tagtests"'
299 ! stdout '"TagPrefix"'
300 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
301 stdout '"Ref": "default"'
302 stdout '"Hash": "8d0b18b816df5e9c564761b405b1d7949c24ee6b"'
303 ! stdout '"(Dir|Info|GoMod|Zip)"'
304
305 # reuse go mod download vcstest/tagtests@default result again with all.json
306 go clean -modcache
307 go mod download -reuse=all.json -x -json vcs-test.golang.org/hg/tagtests.hg@default
308 ! stderr 'hg( .*)* pull'
309 stdout '"Reuse": true'
310 stdout '"Version": "v0.2.3-0.20190509225625-8d0b18b816df"'
311 stdout '"Query": "default"'
312 stdout '"VCS": "hg"'
313 stdout '"URL": ".*/hg/tagtests"'
314 ! stdout '"TagPrefix"'
315 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
316 stdout '"Ref": "default"'
317 stdout '"Hash": "8d0b18b816df5e9c564761b405b1d7949c24ee6b"'
318 ! stdout '"(Dir|Info|GoMod|Zip)"'
319
320 # go mod download vcstest/prefixtagtests result with json
321 go clean -modcache
322 go mod download -reuse=prefixtagtests.json -x -json vcs-test.golang.org/hg/prefixtagtests.hg/sub@latest
323 ! stderr 'hg( .*)* pull'
324 stdout '"Version": "v0.0.10"'
325 stdout '"Query": "latest"'
326 stdout '"VCS": "hg"'
327 stdout '"URL": ".*/hg/prefixtagtests"'
328 stdout '"Subdir": "sub"'
329 stdout '"RepoSum": "r1:YWOcei109p5Kohsr5xnSYlaQXmpT3iWZHZhRbfMoTkc="'
330 stdout '"Ref": "sub/v0.0.10"'
331 stdout '"Hash": "1cc0dfcc254cb8901799e7f7ae182c04019b7a88"'
332 ! stdout '"(Dir|Info|GoMod|Zip)"'
333
334 # reuse the bulk results with all.json
335 go clean -modcache
336 ! go mod download -reuse=all.json -json vcs-test.golang.org/hg/hello.hg@latest vcs-test.golang.org/hg/hello.hg/v9@latest vcs-test.golang.org/hg/hello.hg/sub/v9@latest vcs-test.golang.org/hg/tagtests.hg@latest vcs-test.golang.org/hg/tagtests.hg@v0.2.2 vcs-test.golang.org/hg/tagtests.hg@default
337 ! stderr 'hg( .*)* pull'
338 stdout '"Reuse": true'
339 ! stdout '"(Dir|Info|GoMod|Zip)"'
340
341 # reuse attempt with stale hash should reinvoke hg, not report reuse
342 go clean -modcache
343 cp tagtestsv022.json tagtestsv022badhash.json
344 replace '1e5315' '1e5315XXX' tagtestsv022badhash.json
345 go mod download -reuse=tagtestsv022badhash.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
346 stderr 'hg( .*)* pull'
347 ! stdout '"Reuse": true'
348 stdout '"Version": "v0.2.2"'
349 ! stdout '"Query"'
350 stdout '"VCS": "hg"'
351 stdout '"URL": ".*/hg/tagtests"'
352 ! stdout '"(TagPrefix|TagSum|RepoSum)"'
353 stdout '"Ref": "v0.2.2"'
354 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
355 stdout '"Dir"'
356 stdout '"Info"'
357 stdout '"GoMod"'
358 stdout '"Zip"'
359
360 # reuse with stale repo URL
361 go clean -modcache
362 cp tagtestsv022.json tagtestsv022badurl.json
363 replace 'hg/tagtests\"' 'hg/tagtestsXXX\"' tagtestsv022badurl.json
364 go mod download -reuse=tagtestsv022badurl.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
365 ! stdout '"Reuse": true'
366 stdout '"URL": ".*/hg/tagtests"'
367 stdout '"Dir"'
368 stdout '"Info"'
369 stdout '"GoMod"'
370 stdout '"Zip"'
371
372 # reuse with stale VCS
373 go clean -modcache
374 cp tagtestsv022.json tagtestsv022badvcs.json
375 replace '\"hg\"' '\"hgXXX\"' tagtestsv022badvcs.json
376 go mod download -reuse=tagtestsv022badvcs.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
377 ! stdout '"Reuse": true'
378 stdout '"URL": ".*/hg/tagtests"'
379 ! stdout '"RepoSum"'
380
381 # reuse with stale Dir
382 go clean -modcache
383 cp tagtestsv022.json tagtestsv022baddir.json
384 replace '\"VCS\":' '\"Subdir\":\"subdir\", \"VCS\":' tagtestsv022baddir.json
385 go mod download -reuse=tagtestsv022baddir.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
386 ! stdout '"Reuse": true'
387 stdout '"URL": ".*/hg/tagtests"'
388 ! stdout '"RepoSum"'
389
390 # reuse with stale RepoSum
391 go clean -modcache
392 cp tagtests.json tagtestsbadreposum.json
393 replace '8dnv90' '8dnv90XXX' tagtestsbadreposum.json
394 go mod download -reuse=tagtestsbadreposum.json -x -json vcs-test.golang.org/hg/tagtests.hg@latest
395 ! stdout '"Reuse": true'
396 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
397
398 # go list on repo with no tags
399 go clean -modcache
400 go list -x -json -m -retracted -versions vcs-test.golang.org/hg/hello.hg@latest
401 stderr 'hg( .*)* pull'
402 cp stdout hellolist.json
403 ! stdout '"Versions"'
404 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
405 stdout '"VCS": "hg"'
406 stdout '"URL": ".*/hg/hello"'
407 stdout '"Query": "latest"'
408 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
409 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
410
411 # reuse go list on repo with no tags
412 go clean -modcache
413 go list -x -reuse=hellolist.json -json -m -retracted -versions vcs-test.golang.org/hg/hello.hg@latest
414 ! stderr 'hg( .*)* pull'
415 stdout '"Reuse": true'
416 ! stdout '"Versions"'
417 stdout '"Version": "v0.0.0-20170922011414-e483a7d9f8c9"'
418 stdout '"VCS": "hg"'
419 stdout '"URL": ".*/hg/hello"'
420 stdout '"Query": "latest"'
421 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
422 stdout '"Hash": "e483a7d9f8c9b4bc57430bdd8f81f0a65e4011c0"'
423
424 # reuse with stale list
425 go clean -modcache
426 cp hellolist.json hellolistbad.json
427 replace 'blLvkhBri' 'ZZZ' hellolistbad.json
428 go clean -modcache
429 go list -x -reuse=hellolistbad.json -json -m -retracted -versions vcs-test.golang.org/hg/hello.hg@latest
430 stderr 'hg( .*)* pull'
431 ! stdout '"Reuse": true'
432 stdout '"RepoSum": "r1:blLvkhBriVMV[+]6Il4Ub43wlyWXIe1NpobTelF0peaG0="'
433
434 # go list on repo with tags
435 go clean -modcache
436 go list -x -json -m -retracted -versions vcs-test.golang.org/hg/tagtests.hg@latest
437 cp stdout taglist.json
438 stderr 'hg( .*)* pull'
439 stdout '"Versions":'
440 stdout '"v0.2.1"'
441 stdout '"v0.2.2"'
442 stdout '"Version": "v0.2.2"'
443 stdout '"VCS": "hg"'
444 stdout '"URL": ".*/hg/tagtests"'
445 stdout '"Ref": "v0.2.2"'
446 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
447 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
448
449 # reuse go list on repo with tags
450 go clean -modcache
451 go list -reuse=taglist.json -x -json -m -retracted -versions vcs-test.golang.org/hg/tagtests.hg@latest
452 ! stderr 'hg( .*)* pull'
453 stdout '"Reuse": true'
454 stdout '"Versions":'
455 stdout '"v0.2.1"'
456 stdout '"v0.2.2"'
457 stdout '"Version": "v0.2.2"'
458 stdout '"VCS": "hg"'
459 stdout '"URL": ".*/hg/tagtests"'
460 stdout '"Ref": "v0.2.2"'
461 stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
462 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
463
464 # reuse with stale list
465 go clean -modcache
466 cp taglist.json taglistbad.json
467 replace '8dnv906' 'ZZZ' taglistbad.json
468 go list -reuse=taglistbad.json -x -json -m -retracted -versions vcs-test.golang.org/hg/tagtests.hg@latest
469 stderr 'hg( .*)* pull'
470 ! stdout '"Reuse": true'
471 stdout '"RepoSum": "r1:8dnv906Aq1vb9YpNl9pslfva0VfG9enKb6O6NWs0xF0="'
472
View as plain text