diff options
author | Mark Pulford <mark@kyne.com.au> | 2022-01-22 16:03:28 +1030 |
---|---|---|
committer | Bryan Mills <bcmills@google.com> | 2022-01-26 17:25:25 +0000 |
commit | 55589e7531c7e576a26f5610241a278caf6e4a4e (patch) | |
tree | 8f315e534cc0752145febe828b08e25ab4372cf5 | |
parent | 0f4bd92c4d9a16efe05e397354dec87737338d2c (diff) | |
download | go-55589e7531c7e576a26f5610241a278caf6e4a4e.tar.gz go-55589e7531c7e576a26f5610241a278caf6e4a4e.zip |
cmd/go: fix retrieving Mercurial commit timestamp under Windows
Use "hgdate" since the strftime filter is unsupported by Mercurial under
Windows.
Fixes #49841
Change-Id: I300898e51e324147aaf1bfe12ed17dea4bdd183d
Reviewed-on: https://go-review.googlesource.com/c/go/+/380077
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Jeremy Faller <jeremy@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
-rw-r--r-- | src/cmd/go/internal/vcs/vcs.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/go/internal/vcs/vcs.go b/src/cmd/go/internal/vcs/vcs.go index 3406ee0551..fd521b2eb1 100644 --- a/src/cmd/go/internal/vcs/vcs.go +++ b/src/cmd/go/internal/vcs/vcs.go @@ -164,7 +164,7 @@ func hgRemoteRepo(vcsHg *Cmd, rootDir string) (remoteRepo string, err error) { func hgStatus(vcsHg *Cmd, rootDir string) (Status, error) { // Output changeset ID and seconds since epoch. - out, err := vcsHg.runOutputVerboseOnly(rootDir, `log -l1 -T {node}:{date(date,"%s")}`) + out, err := vcsHg.runOutputVerboseOnly(rootDir, `log -l1 -T {node}:{date|hgdate}`) if err != nil { return Status{}, err } @@ -173,6 +173,10 @@ func hgStatus(vcsHg *Cmd, rootDir string) (Status, error) { var rev string var commitTime time.Time if len(out) > 0 { + // Strip trailing timezone offset. + if i := bytes.IndexByte(out, ' '); i > 0 { + out = out[:i] + } rev, commitTime, err = parseRevTime(out) if err != nil { return Status{}, err |