diff options
Diffstat (limited to 'src/cmd/go/testdata/vcstest/hg')
-rw-r--r-- | src/cmd/go/testdata/vcstest/hg/custom-hg-hello.txt | 17 | ||||
-rw-r--r-- | src/cmd/go/testdata/vcstest/hg/hello.txt | 17 | ||||
-rw-r--r-- | src/cmd/go/testdata/vcstest/hg/hgrepo1.txt | 153 | ||||
-rw-r--r-- | src/cmd/go/testdata/vcstest/hg/vgotest1.txt | 322 |
4 files changed, 509 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/vcstest/hg/custom-hg-hello.txt b/src/cmd/go/testdata/vcstest/hg/custom-hg-hello.txt new file mode 100644 index 0000000..572cbdf --- /dev/null +++ b/src/cmd/go/testdata/vcstest/hg/custom-hg-hello.txt @@ -0,0 +1,17 @@ +handle hg +hg init + +hg add hello.go +hg commit --user 'Russ Cox <rsc@golang.org>' --date '2017-10-10T19:39:36-04:00' --message 'hello' + +hg log -r ':' --template '{node|short} {desc|strip|firstline}\n' +cmp stdout .hg-log + +-- .hg-log -- +a8c8e7a40da9 hello +-- hello.go -- +package main // import "vcs-test.golang.org/go/custom-hg-hello" + +func main() { + println("hello") +} diff --git a/src/cmd/go/testdata/vcstest/hg/hello.txt b/src/cmd/go/testdata/vcstest/hg/hello.txt new file mode 100644 index 0000000..10f114e --- /dev/null +++ b/src/cmd/go/testdata/vcstest/hg/hello.txt @@ -0,0 +1,17 @@ +handle hg +hg init + +hg add hello.go +hg commit --user 'bwk' --date '2017-09-21T21:14:14-04:00' --message 'hello world' + +hg log -r ':' --template '{node|short} {desc|strip|firstline}\n' +cmp stdout .hg-log + +-- .hg-log -- +e483a7d9f8c9 hello world +-- hello.go -- +package main + +func main() { + println("hello, world") +} diff --git a/src/cmd/go/testdata/vcstest/hg/hgrepo1.txt b/src/cmd/go/testdata/vcstest/hg/hgrepo1.txt new file mode 100644 index 0000000..1e4b83a --- /dev/null +++ b/src/cmd/go/testdata/vcstest/hg/hgrepo1.txt @@ -0,0 +1,153 @@ +handle hg + +mkdir git +cd git + +env GIT_AUTHOR_NAME='Russ Cox' +env GIT_AUTHOR_EMAIL='rsc@golang.org' +env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME +env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL + +git init + +at 2018-04-17T15:43:22-04:00 +unquote '' +cp stdout README +git add README +git commit -a -m 'empty README' +git branch -m master +git tag v1.2.3 + +at 2018-04-17T15:45:48-04:00 +git branch v2 +git checkout v2 +echo 'v2' +cp stdout v2 +git add v2 +git commit -a -m 'v2' +git tag v2.3 +git tag v2.0.1 +git branch v2.3.4 +git tag branch-v2.3.4 + +at 2018-04-17T16:00:19-04:00 +echo 'intermediate' +cp stdout foo.txt +git add foo.txt +git commit -a -m 'intermediate' + +at 2018-04-17T16:00:32-04:00 +echo 'another' +cp stdout another.txt +git add another.txt +git commit -a -m 'another' +git tag v2.0.2 +git tag branch-v2 + +at 2018-04-17T16:16:52-04:00 +git checkout master +git branch v3 +git checkout v3 +mkdir v3/sub/dir +echo 'v3/sub/dir/file' +cp stdout v3/sub/dir/file.txt +git add v3 +git commit -a -m 'add v3/sub/dir/file.txt' +git tag branch-v3 + +at 2018-04-17T22:23:00-04:00 +git checkout master +git tag -a v1.2.4-annotated -m 'v1.2.4-annotated' + +cd .. + +hg init +hg convert --datesort ./git . +rm ./git + +hg update -C v2 +hg branch v2 +unquote '' +cp stdout dummy +hg add dummy +hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:15:24-04:00' -m 'dummy' + +# 'hg convert' blindly stamps a tag-update commit at the end of whatever branch +# happened to contain the last converted commit — in this case, v3. However, the +# original vcs-test.golang.org copy of this repo had this commit on the v3 +# branch as a descendent of 'add v3/sub/dir/file.txt', so that's where we put it +# here. That leaves the convert-repo 'update tags' commit only reachable as the +# head of the default branch. +hg update -r 4 + +hg branch v3 +unquote '' +cp stdout dummy +hg add dummy +hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:15:45-04:00' -m 'dummy' + +hg update v2.3.4 +hg branch v2.3.4 +unquote '' +cp stdout dummy +hg add dummy +hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:16:10-04:00' -m 'dummy' + +hg tag --user 'Russ Cox <rsc@golang.org>' --date '2018-06-27T12:16:30-04:00' -m 'Removed tag branch-v2, branch-v3, branch-v2.3.4' --remove branch-v2 branch-v3 branch-v2.3.4 + +# Adding commits to the above branches updates both the branch heads and the +# corresponding bookmarks. +# But apparently at some point it did not do so? The original copy of this repo +# had bookmarks pointing to the base of each branch instead of the tip. 🤔 +# Either way, force the bookmarks we care about to match the original copy of +# the repo. +hg book v2 -r 3 --force +hg book v2.3.4 -r 1 --force +hg book v3 -r 5 --force + +hg log -G --debug + +hg tags +cmp stdout .hg-tags + + # 'hg convert' leaves an 'update tags' commit on the default branch, and that + # commit always uses the current date (so is not reproducible). Fortunately, + # that commit lands on the 'default' branch and is not tagged as 'tip', so it + # seems to be mostly harmless. However, because it is nondeterministic we + # should avoid listing it here. + # + # Unfortunately, some of our builders are still running Debian 9 “Stretch”, + # which shipped with a version of 'hg' that does not support 'hg branch -r' + # to list branches for specific versions. Although Stretch is past its + # end-of-life date, we need to keep the builders happy until they can be + # turned down (https://go.dev/issue/56414). +hg branches +? cmp stdout .hg-branches +stdout 'v2\s+6:9a4f43d231ec' +stdout 'v2.3.4\s+9:18518c07eb8e' +stdout 'v3\s+7:a2cad8a2b1bb' +stdout 'default\s+5:' + +# Likewise, bookmark v3 ends up on the nondeterministic commit. +hg bookmarks +? cmp stdout .hg-bookmarks +stdout 'master\s+0:41964ddce118' +stdout 'v2\s+3:8f49ee7a6ddc' +stdout 'v2.3.4\s+1:88fde824ec8b' +stdout 'v3\s+5:.*' + +-- .hg-branches -- +v2.3.4 9:18518c07eb8e +v3 7:a2cad8a2b1bb +v2 6:9a4f43d231ec +-- .hg-tags -- +tip 9:18518c07eb8e +v2.0.2 3:8f49ee7a6ddc +v2.3 1:88fde824ec8b +v2.0.1 1:88fde824ec8b +v1.2.4-annotated 0:41964ddce118 +v1.2.3 0:41964ddce118 +-- .hg-bookmarks -- + master 0:41964ddce118 + v2 3:8f49ee7a6ddc + v2.3.4 1:88fde824ec8b diff --git a/src/cmd/go/testdata/vcstest/hg/vgotest1.txt b/src/cmd/go/testdata/vcstest/hg/vgotest1.txt new file mode 100644 index 0000000..e53c5e0 --- /dev/null +++ b/src/cmd/go/testdata/vcstest/hg/vgotest1.txt @@ -0,0 +1,322 @@ +handle hg + +cd git + +env GIT_AUTHOR_NAME='Russ Cox' +env GIT_AUTHOR_EMAIL='rsc@golang.org' +env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME +env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL + +git init + +# 0 +at 2018-02-19T17:21:09-05:00 +git add LICENSE README.md +git commit -m 'initial commit' +git branch -m master + +# 1 +git branch mybranch +git checkout mybranch + +at 2018-02-19T18:10:06-05:00 +mkdir pkg +echo 'package p // pkg/p.go' +cp stdout pkg/p.go +git add pkg/p.go +git commit -m 'add pkg/p.go' +git tag v0.0.0 +git tag v1.0.0 +git tag v2.0.0 +git tag mytag + +git branch v1 +git branch v2 +git checkout v2 + +# 2 +at 2018-02-19T18:14:23-05:00 +mkdir v2 +echo 'module "github.com/rsc/vgotest1/v2" // root go.mod' +cp stdout go.mod +git add go.mod +git commit -m 'go.mod v2' +git tag v2.0.1 + +# 3 +at 2018-02-19T18:15:11-05:00 +mkdir submod/pkg +echo 'package p // submod/pkg/p.go' +cp stdout submod/pkg/p.go +git add submod/pkg/p.go +git commit -m 'submod/pkg/p.go' +git tag v2.0.2 + +# 4 +at 2018-02-19T18:16:04-05:00 +echo 'module "github.com/rsc/vgotest" // v2/go.mod' +cp stdout v2/go.mod +git add v2/go.mod +git commit -m 'v2/go.mod: bad go.mod (no version)' +git tag v2.0.3 + +# 5 +at 2018-02-19T19:03:38-05:00 +env GIT_AUTHOR_DATE=2018-02-19T18:16:38-05:00 +echo 'module "github.com/rsc/vgotest1/v2" // v2/go.mod' +cp stdout v2/go.mod +git add v2/go.mod +git commit -m 'v2/go.mod: fix' +git tag v2.0.4 + +# 6 +at 2018-02-19T19:03:59-05:00 +env GIT_AUTHOR_DATE=2018-02-19T18:17:02-05:00 +echo 'module "github.com/rsc/vgotest1" // root go.mod' +cp stdout go.mod +git add go.mod +git commit -m 'go.mod: drop v2' +git tag v2.0.5 + +git checkout v1 + +# 7 +at 2018-02-19T18:10:28-05:00 +echo 'module "github.com/rsc/vgotest1" // root go.mod' +cp stdout go.mod +git add go.mod +git commit -m 'go.mod' +git tag v0.0.1 +git tag v1.0.1 + +# 8 +at 2018-02-19T18:11:28-05:00 +mkdir submod/pkg +echo 'package pkg // submod/pkg/p.go' +cp stdout submod/pkg/p.go +git add submod +git commit -m 'submod/pkg/p.go' +git tag v1.0.2 + +# 9 +at 2018-02-19T18:12:07-05:00 +echo 'module "github.com/vgotest1/submod" // submod/go.mod' +cp stdout submod/go.mod +git add submod/go.mod +git commit -m 'submod/go.mod' +git tag v1.0.3 +git tag submod/v1.0.4 + +# 10 +at 2018-02-19T18:12:59-05:00 +git apply ../0001-submod-go.mod-add-require-vgotest1-v1.1.0.patch +git commit -a -m 'submod/go.mod: add require vgotest1 v1.1.0' +git tag submod/v1.0.5 + +# 11 +at 2018-02-19T18:13:36-05:00 +git apply ../0002-go.mod-add-require-submod-v1.0.5.patch +git commit -a -m 'go.mod: add require submod v1.0.5' +git tag v1.1.0 + +git checkout master + +# 12 +at 2018-02-19T17:23:01-05:00 +mkdir pkg +echo 'package pkg' +cp stdout pkg/p.go +git add pkg/p.go +git commit -m 'pkg: add' + +# 13 +at 2018-02-19T17:30:23-05:00 +env GIT_AUTHOR_DATE=2018-02-19T17:24:48-05:00 +echo 'module "github.com/vgotest1/v2"' +cp stdout go.mod +git add go.mod +git commit -m 'add go.mod' + +# 14 +at 2018-02-19T17:30:45-05:00 +echo 'module "github.com/vgotest1"' +cp stdout go.mod +git add go.mod +git commit -m 'bad mod path' + +# 15 +at 2018-02-19T17:31:34-05:00 +mkdir v2 +echo 'module "github.com/vgotest1/v2"' +cp stdout v2/go.mod +git add v2/go.mod +git commit -m 'add v2/go.mod' + +# 16 +at 2018-02-19T17:32:37-05:00 +echo 'module "github.com/vgotest1/v2"' +cp stdout go.mod +git add go.mod +git commit -m 'say v2 in root go.mod' + +# 17 +at 2018-02-19T17:51:24-05:00 + # README.md at this commit lacked a trailing newline, so 'git apply' can't + # seem to apply it correctly as a patch. Instead, we use 'unquote' to write + # the exact contents. +unquote 'This is a test repo for versioned go.\nThere''s nothing useful here.\n\n v0.0.0 - has pkg/p.go\n v0.0.1 - has go.mod\n \n v1.0.0 - has pkg/p.go\n v1.0.1 - has go.mod\n v1.0.2 - has submod/pkg/p.go\n v1.0.3 - has submod/go.mod\n submod/v1.0.4 - same\n submod/v1.0.5 - add requirement on v1.1.0\n v1.1.0 - add requirement on submod/v1.0.5\n \n v2.0.0 - has pkg/p.go\n v2.0.1 - has go.mod with v2 module path\n v2.0.2 - has go.mod with v1 (no version) module path\n v2.0.3 - has v2/go.mod with v2 module path\n v2.0.5 - has go.mod AND v2/go.mod with v2 module path\n ' +cp stdout README.md +mkdir v2/pkg +echo 'package q' +cp stdout v2/pkg/q.go +git add README.md v2/pkg/q.go +git commit -m 'add q' +git tag v2.0.6 + +cd .. + +hg init +hg convert ./git . +rm ./git + +# Note: commit #18 is an 'update tags' commit automatically generated by 'hg +# convert'. We have no control over its timestamp, so it and its descendent +# commit #19 both end up with unpredictable commit hashes. +# +# Fortunately, these commits don't seem to matter for the purpose of reproducing +# the final branches and heads from the original copy of this repo. + +# 19 +hg update -C -r 18 +hg tag --user 'Russ Cox <rsc@golang.org>' --date '2018-07-18T21:24:45-04:00' -m 'Removed tag v2.0.0' --remove v2.0.0 + +# 20 +hg branch default +hg update -C -r 1 +echo 'v2' +cp stdout v2 +hg add v2 +hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-07-18T21:25:08-04:00' -m 'v2.0.0' + +# 21 +hg tag --user 'Russ Cox <rsc@golang.org>' --date '2018-07-18T21:25:13-04:00' -r f0ababb31f75 -m 'Added tag v2.0.0 for changeset f0ababb31f75' v2.0.0 + +# 22 +hg tag --user 'Russ Cox <rsc@golang.org>' --date '2018-07-18T21:26:02-04:00' -m 'Removed tag v2.0.0' --remove v2.0.0 + +# 23 +hg update -C -r 1 +echo 'v2' +cp stdout v2 +hg add v2 +hg commit --user 'Russ Cox <rsc@golang.org>' --date '2018-07-19T01:21:27+00:00' -m 'v2' + +# 24 +hg tag --user 'Russ Cox <rsc@golang.org>' --date '2018-07-18T21:26:33-04:00' -m 'Added tag v2.0.0 for changeset 814fce58e83a' -r 814fce58e83a v2.0.0 + +hg book --delete v1 +hg book --delete v2 +hg book --force -r 16 master + +hg log -G --debug + +hg tags +cmp stdout .hg-tags +hg branches +cmp stdout .hg-branches +hg bookmarks +cmp stdout .hg-bookmarks + +-- .hg-tags -- +tip 24:645b06ca536d +v2.0.0 23:814fce58e83a +v2.0.6 17:3d4b89a2d059 +v1.1.0 11:92c7eb888b4f +submod/v1.0.5 10:f3f560a6065c +v1.0.3 9:4e58084d459a +submod/v1.0.4 9:4e58084d459a +v1.0.2 8:3ccdce3897f9 +v1.0.1 7:7890ea771ced +v0.0.1 7:7890ea771ced +v2.0.5 6:879ea98f7743 +v2.0.4 5:bf6388016230 +v2.0.3 4:a9ad6d1d14eb +v2.0.2 3:de3663002f0f +v2.0.1 2:f1fc0f22021b +v1.0.0 1:e125018e286a +v0.0.0 1:e125018e286a +mytag 1:e125018e286a +-- .hg-branches -- +default 24:645b06ca536d +-- .hg-bookmarks -- + master 16:577bde103b24 + mybranch 1:e125018e286a +-- git/LICENSE -- +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-- git/README.md -- +This is a test repo for versioned go. +There's nothing useful here. +-- 0001-submod-go.mod-add-require-vgotest1-v1.1.0.patch -- +From 70fd92eaa4dacf82548d0c6099f5b853ae2c1fc8 Mon Sep 17 00:00:00 2001 +From: Russ Cox <rsc@golang.org> +Date: Mon, 19 Feb 2018 18:12:59 -0500 +Subject: [PATCH] submod/go.mod: add require vgotest1 v1.1.0 + +--- + submod/go.mod | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/submod/go.mod b/submod/go.mod +index 7b18d93..c88de0f 100644 +--- a/submod/go.mod ++++ b/submod/go.mod +@@ -1 +1,2 @@ + module "github.com/vgotest1/submod" // submod/go.mod ++require "github.com/vgotest1" v1.1.0 +-- +2.36.1.838.g23b219f8e3 +-- 0002-go.mod-add-require-submod-v1.0.5.patch -- +From b769f2de407a4db81af9c5de0a06016d60d2ea09 Mon Sep 17 00:00:00 2001 +From: Russ Cox <rsc@golang.org> +Date: Mon, 19 Feb 2018 18:13:36 -0500 +Subject: [PATCH] go.mod: add require submod v1.0.5 + +--- + go.mod | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/go.mod b/go.mod +index ac7a6d7..6118671 100644 +--- a/go.mod ++++ b/go.mod +@@ -1 +1,2 @@ + module "github.com/rsc/vgotest1" // root go.mod ++require "github.com/rsc/vgotest1/submod" v1.0.5 +-- +2.36.1.838.g23b219f8e3 |