From 41be62e168fa7de2cf3357ad32f7105377bfd758 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Fri, 4 Nov 2022 09:50:09 +0100 Subject: [PATCH] cmd/go: fix svn vctest on Windows and make them timezone agnostic This CL updates svn vctest so they work on Windows. Side effect is that svn logs are no longer timezone dependant, as this updated the `svn log` command to format logs using XML, which contain UTC dates instead of local dates. Therefore it supersedes https://go-review.googlesource.com/c/go/+/447795. Fixes #56555 Fixes #56527 Change-Id: I5a654fd0a0f741e0a8a6ca7021ad699c07b974d6 Reviewed-on: https://go-review.googlesource.com/c/go/+/447935 Reviewed-by: Benny Siegert Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills Run-TryBot: Quim Muntal --- src/cmd/go/internal/vcweb/script.go | 1 + src/cmd/go/testdata/vcstest/svn/hello.txt | 28 +++++--- .../go/testdata/vcstest/svn/test1-svn-git.txt | 65 ++++++++++++------- .../go/testdata/vcstest/svn/test2-svn-git.txt | 45 ++++++++----- 4 files changed, 89 insertions(+), 50 deletions(-) diff --git a/src/cmd/go/internal/vcweb/script.go b/src/cmd/go/internal/vcweb/script.go index f58a0ac392..c35b46f735 100644 --- a/src/cmd/go/internal/vcweb/script.go +++ b/src/cmd/go/internal/vcweb/script.go @@ -128,6 +128,7 @@ func scriptEnviron(homeDir string) []string { tempEnvName(), "SYSTEMROOT", // must be preserved on Windows to find DLLs; golang.org/issue/25210 "WINDIR", // must be preserved on Windows to be able to run PowerShell command; golang.org/issue/30711 + "ComSpec", // must be preserved on Windows to be able to run Batch files; golang.org/issue/56555 "DYLD_LIBRARY_PATH", // must be preserved on macOS systems to find shared libraries "LD_LIBRARY_PATH", // must be preserved on Unix systems to find shared libraries "LIBRARY_PATH", // allow override of non-standard static library paths diff --git a/src/cmd/go/testdata/vcstest/svn/hello.txt b/src/cmd/go/testdata/vcstest/svn/hello.txt index b68ce95969..c6ebd8d967 100644 --- a/src/cmd/go/testdata/vcstest/svn/hello.txt +++ b/src/cmd/go/testdata/vcstest/svn/hello.txt @@ -1,14 +1,13 @@ handle svn -env TZ='America/New_York' - mkdir db/transactions mkdir db/txn-protorevs chmod 0755 hooks/pre-revprop-change env ROOT=$PWD cd .checkout -svn checkout file://$ROOT . +[GOOS:windows] svn checkout file:///$ROOT . +[!GOOS:windows] svn checkout file://$ROOT . svn add hello.go svn commit --file MSG @@ -16,7 +15,9 @@ svn propset svn:author 'rsc' --revprop -r1 svn propset svn:date '2017-09-22T01:12:45.861368Z' --revprop -r1 svn update -svn log +svn log --xml + +[GOOS:windows] replace '\n' '\r\n' .svn-log cmp stdout .svn-log -- .checkout/MSG -- @@ -29,13 +30,17 @@ func main() { println("hello, world") } -- .checkout/.svn-log -- ------------------------------------------------------------------------- -r1 | rsc | 2017-09-21 21:12:45 -0400 (Thu, 21 Sep 2017) | 3 lines - -hello world - + + + +rsc +2017-09-22T01:12:45.861368Z +hello world ------------------------------------------------------------------------- + + + -- conf/authz -- -- conf/passwd -- -- conf/svnserve.conf -- @@ -77,3 +82,6 @@ cpath: / 5 -- hooks/pre-revprop-change -- #!/bin/sh + +-- hooks/pre-revprop-change.bat -- +@exit diff --git a/src/cmd/go/testdata/vcstest/svn/test1-svn-git.txt b/src/cmd/go/testdata/vcstest/svn/test1-svn-git.txt index 06ceef1a41..2b94201890 100644 --- a/src/cmd/go/testdata/vcstest/svn/test1-svn-git.txt +++ b/src/cmd/go/testdata/vcstest/svn/test1-svn-git.txt @@ -13,7 +13,6 @@ 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 -env TZ='America/New_York' mkdir db/transactions mkdir db/txn-protorevs @@ -21,7 +20,8 @@ chmod 0755 hooks/pre-revprop-change env ROOT=$PWD cd .checkout -svn checkout file://$ROOT . +[GOOS:windows] svn checkout file:///$ROOT . +[!GOOS:windows] svn checkout file://$ROOT . cd git-README-only git init @@ -83,7 +83,9 @@ svn propset svn:author rsc --revprop -r5 svn propset svn:date 2017-10-04T15:08:26.291877Z --revprop -r5 svn update -svn log +svn log --xml + +[GOOS:windows] replace '\n' '\r\n' .svn-log cmp stdout .svn-log -- .checkout/git-README-only/pkg/pkg.go -- @@ -107,27 +109,39 @@ import _ "vcs-test.swtch.com/go/test1-svn-git/git-README-only/other" -- .checkout/tiny/tiny.go -- package tiny -- .checkout/.svn-log -- ------------------------------------------------------------------------- -r5 | rsc | 2017-10-04 11:08:26 -0400 (Wed, 04 Oct 2017) | 1 line - -move from vcs-test.swtch.com to vcs-test.golang.org ------------------------------------------------------------------------- -r4 | rsc | 2017-09-27 13:48:18 -0400 (Wed, 27 Sep 2017) | 1 line - -add tiny ------------------------------------------------------------------------- -r3 | rsc | 2017-09-22 12:56:16 -0400 (Fri, 22 Sep 2017) | 1 line - -add other ------------------------------------------------------------------------- -r2 | rsc | 2017-09-22 11:49:11 -0400 (Fri, 22 Sep 2017) | 1 line - -use git-README-only/pkg ------------------------------------------------------------------------- -r1 | rsc | 2017-09-22 11:41:54 -0400 (Fri, 22 Sep 2017) | 1 line - -add modified git-README-only ------------------------------------------------------------------------- + + + +rsc +2017-10-04T15:08:26.291877Z +move from vcs-test.swtch.com to vcs-test.golang.org + + +rsc +2017-09-27T17:48:18.350817Z +add tiny + + +rsc +2017-09-22T16:56:16.665173Z +add other + + +rsc +2017-09-22T15:49:11.130406Z +use git-README-only/pkg + + +rsc +2017-09-22T15:41:54.145716Z +add modified git-README-only + + -- conf/authz -- -- conf/passwd -- -- conf/svnserve.conf -- @@ -169,3 +183,6 @@ cpath: / 5 -- hooks/pre-revprop-change -- #!/bin/sh + +-- hooks/pre-revprop-change.bat -- +@exit diff --git a/src/cmd/go/testdata/vcstest/svn/test2-svn-git.txt b/src/cmd/go/testdata/vcstest/svn/test2-svn-git.txt index 71d84c45c2..bf827976c7 100644 --- a/src/cmd/go/testdata/vcstest/svn/test2-svn-git.txt +++ b/src/cmd/go/testdata/vcstest/svn/test2-svn-git.txt @@ -13,7 +13,6 @@ 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 -env TZ='America/New_York' mkdir db/transactions mkdir db/txn-protorevs @@ -21,7 +20,8 @@ chmod 0755 hooks/pre-revprop-change env ROOT=$PWD cd .checkout -svn checkout file://$ROOT . +[GOOS:windows] svn checkout file:///$ROOT . +[!GOOS:windows] svn checkout file://$ROOT . git init git config --add core.ignorecase true @@ -69,7 +69,9 @@ svn propset svn:author rsc --revprop -r3 svn propset svn:date 2017-10-04T15:09:35.963034Z --revprop -r3 svn update -svn log +svn log --xml + +[GOOS:windows] replace '\n' '\r\n' .svn-log cmp stdout .svn-log -- .checkout/.git-log -- @@ -85,19 +87,27 @@ README -- .checkout/p1/p1.go -- package p1 -- .checkout/.svn-log -- ------------------------------------------------------------------------- -r3 | rsc | 2017-10-04 11:09:35 -0400 (Wed, 04 Oct 2017) | 1 line - -move from vcs-test.swtch.com to vcs-test.golang.org ------------------------------------------------------------------------- -r2 | rsc | 2017-09-27 14:16:14 -0400 (Wed, 27 Sep 2017) | 1 line - -add p1 ------------------------------------------------------------------------- -r1 | rsc | 2017-09-27 14:00:52 -0400 (Wed, 27 Sep 2017) | 1 line - -git ------------------------------------------------------------------------- + + + +rsc +2017-10-04T15:09:35.963034Z +move from vcs-test.swtch.com to vcs-test.golang.org + + +rsc +2017-09-27T18:16:14.650893Z +add p1 + + +rsc +2017-09-27T18:00:52.201719Z +git + + -- conf/authz -- -- conf/passwd -- -- conf/svnserve.conf -- @@ -139,3 +149,6 @@ cpath: / 5 -- hooks/pre-revprop-change -- #!/bin/sh + +-- hooks/pre-revprop-change.bat -- +@exit -- 2.50.0