...

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

Documentation: cmd/go/testdata/script

     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 vcstest/tagtests@v0.2.2 should print origin info, no TagSum or RepoSum needed.
    10go mod download -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
    11cp stdout tagtestsv022.json
    12stdout '"Version": "v0.2.2"'
    13! stdout '"Query":'
    14stdout '"VCS": "hg"'
    15stdout '"URL": ".*/hg/tagtests"'
    16! stdout '"TagPrefix"'
    17! stdout '"TagSum"'
    18! stdout '"RepoSum"'
    19stdout '"Ref": "v0.2.2"'
    20stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
    21
    22# reuse go mod download vcstest/tagtests@v0.2.2 result
    23go clean -modcache
    24go mod download -reuse=tagtestsv022.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
    25! stderr 'hg( .*)* pull'
    26stdout '"Reuse": true'
    27stdout '"Version": "v0.2.2"'
    28! stdout '"Query":'
    29stdout '"VCS": "hg"'
    30stdout '"URL": ".*/hg/tagtests"'
    31! stdout '"TagPrefix"'
    32! stdout '"TagSum"'
    33stdout '"Ref": "v0.2.2"'
    34stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
    35! stdout '"(Dir|Info|GoMod|Zip|RepoSum)"'
    36
    37# reuse attempt with stale hash should reinvoke hg, not report reuse
    38go clean -modcache
    39cp tagtestsv022.json tagtestsv022badhash.json
    40replace '1e5315' '1e5315XXX' tagtestsv022badhash.json
    41go mod download -reuse=tagtestsv022badhash.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
    42stderr 'hg( .*)* pull'
    43! stdout '"Reuse": true'
    44stdout '"Version": "v0.2.2"'
    45! stdout '"Query"'
    46stdout '"VCS": "hg"'
    47stdout '"URL": ".*/hg/tagtests"'
    48! stdout '"(TagPrefix|TagSum|RepoSum)"'
    49stdout '"Ref": "v0.2.2"'
    50stdout '"Hash": "1e531550e864b16f25013cfbbf2d8e7cf07a0374"'
    51stdout '"Dir"'
    52stdout '"Info"'
    53stdout '"GoMod"'
    54stdout '"Zip"'
    55
    56# reuse with stale repo URL
    57go clean -modcache
    58cp tagtestsv022.json tagtestsv022badurl.json
    59replace 'hg/tagtests\"' 'hg/tagtestsXXX\"' tagtestsv022badurl.json
    60go mod download -reuse=tagtestsv022badurl.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
    61! stdout '"Reuse": true'
    62stdout '"URL": ".*/hg/tagtests"'
    63stdout '"Dir"'
    64stdout '"Info"'
    65stdout '"GoMod"'
    66stdout '"Zip"'
    67
    68# reuse with stale VCS
    69go clean -modcache
    70cp tagtestsv022.json tagtestsv022badvcs.json
    71replace '\"hg\"' '\"hgXXX\"' tagtestsv022badvcs.json
    72go mod download -reuse=tagtestsv022badvcs.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
    73! stdout '"Reuse": true'
    74stdout '"URL": ".*/hg/tagtests"'
    75! stdout '"RepoSum"'
    76
    77# reuse with stale Dir
    78go clean -modcache
    79cp tagtestsv022.json tagtestsv022baddir.json
    80replace '\"VCS\":' '\"Subdir\":\"subdir\", \"VCS\":' tagtestsv022baddir.json
    81go mod download -reuse=tagtestsv022baddir.json -x -json vcs-test.golang.org/hg/tagtests.hg@v0.2.2
    82! stdout '"Reuse": true'
    83stdout '"URL": ".*/hg/tagtests"'
    84! stdout '"RepoSum"'

View as plain text