...
Run Format

Text file src/cmd/go/testdata/script/reuse_hg.txt

Documentation: cmd/go/testdata/script

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

View as plain text