]> Cypherpunks repositories - gostls13.git/commit
cmd/go: fix the accuracy of Mercurial vcs.* stamped data
authorMatt Harbison <mharbison72@gmail.com>
Sat, 3 Aug 2024 00:06:30 +0000 (00:06 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 27 Sep 2024 19:20:16 +0000 (19:20 +0000)
commit62452bed480108623910feace4a5cea5448e6822
treee1aad89071ccfe4dc551c00f54572292038e563a
parent99bf122de86ffec5ebd85a688432619d717025fe
cmd/go: fix the accuracy of Mercurial vcs.* stamped data

There were a few Mercurial command line uses that could cause the wrong
data to be used:

* The log command needs '-r.' to specify the currently checked out commit
* HGPLAIN is needed to disable optional output on commands
* '-S' is needed to for the 'status' command to recurse into any subrepos

The most likely issue to be seen here was the use of '-l1' instead of
'-r.', which prints the most recent commit instead of the current checkout.
Since tagging in Mercurial creates a new commit, this basically means the
data was wrong for every tagged build.

This also adds an hgrc config file to the test, with config options to
keep the time and author values fixed.  It's what's used in the Mercurial
test harness to keep the commit hashes stable, and allows the tests here to
also match the time and the revision ID, to prevent regressing.

Fixes #63532

Change-Id: I5b9971ce87c83431ec77e4a002bdc33fcf393856
GitHub-Last-Rev: 62c9db0a28fee5881d0fe49f7bbb6e1653c7ff60
GitHub-Pull-Request: golang/go#63557
Reviewed-on: https://go-review.googlesource.com/c/go/+/535377
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/vcs/vcs.go
src/cmd/go/testdata/script/version_buildvcs_hg.txt