git: 079273384c22 - stable/12 - Fix newvers.sh to no longer print an outdated SVN rev
Li-Wen Hsu
lwhsu at FreeBSD.org
Tue Jan 12 08:25:49 UTC 2021
The branch stable/12 has been updated by lwhsu:
URL: https://cgit.FreeBSD.org/src/commit/?id=079273384c22961b15d520c172645ba626af1db1
commit 079273384c22961b15d520c172645ba626af1db1
Author: Ulrich Spörlein <uqs at FreeBSD.org>
AuthorDate: 2020-12-23 21:29:34 +0000
Commit: Li-Wen Hsu <lwhsu at FreeBSD.org>
CommitDate: 2021-01-12 08:19:43 +0000
Fix newvers.sh to no longer print an outdated SVN rev
We have stopped using SVN, so the notes containing the old SVN revisions
are no longer populated, so fall back to purely counting the number of
commits (currently at about 255337).
Also turn the format more into what git-describe produces, with a name
first, then the number of commits and the hash last. Note that as we
don't tag anything on `main`, git describe will never produce something
useful there and finds the newest vendor tag that was merged in instead.
Sample output:
FreeBSD 13.0-CURRENT #6 main-c255126-gb81783dc98e6-dirty
FreeBSD 12.2-STABLE #0 stable/12-c243035-gd16dac42b641-dirty
MFC after: 3 weeks
Reviewed by: imp, glebius
Differential Revision: https://reviews.freebsd.org/D27751
(cherry picked from commit 8d405efd73d3991fe1647f91a2b7c9989dd5f18f)
---
sys/conf/newvers.sh | 31 ++++++-------------------------
1 file changed, 6 insertions(+), 25 deletions(-)
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 4b5651fdd4bf..48f778ed1223 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -210,40 +210,21 @@ if [ -n "$svnversion" ] ; then
fi
if [ -n "$git_cmd" ] ; then
- git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null`
- svn=`$git_cmd svn find-rev $git 2>/dev/null`
- if [ -n "$svn" ] ; then
- svn=" r${svn}"
- git="=${git}"
- else
- svn=`$git_cmd log --grep '^git-svn-id:' | \
- grep '^ git-svn-id:' | head -1 | \
- sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'`
- if [ -z "$svn" ] ; then
- svn=`$git_cmd log --format='format:%N' | \
- grep '^svn ' | head -1 | \
- sed -n 's/^.*revision=\([0-9][0-9]*\).*$/\1/p'`
- fi
- if [ -n "$svn" ] ; then
- svn=" r${svn}"
- git="+${git}"
- else
- git=" ${git}"
- fi
- fi
+ git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null)
git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null)
if [ -n "$git_cnt" ] ; then
- git="${git}-c${git_cnt}"
+ git="c${git_cnt}-g${git}"
fi
- git_b=`$git_cmd rev-parse --abbrev-ref HEAD`
- if [ -n "$git_b" ] ; then
- git="${git}(${git_b})"
+ git_b=$($git_cmd rev-parse --abbrev-ref HEAD)
+ if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then
+ git="${git_b}-${git}"
fi
if $git_cmd --work-tree=${VCSTOP} diff-index \
--name-only HEAD | read dummy; then
git="${git}-dirty"
modified=true
fi
+ git=" ${git}"
fi
if [ -n "$p4_cmd" ] ; then
More information about the dev-commits-src-all
mailing list