public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3370] gcc_update: use human readable name for revision string in gcc/REVISION
@ 2021-09-06 12:59 Sergey Belyshev
  0 siblings, 0 replies; only message in thread
From: Sergey Belyshev @ 2021-09-06 12:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:78b34cd8a803aa89e64949e99ce2e6b4f64d6b54

commit r12-3370-g78b34cd8a803aa89e64949e99ce2e6b4f64d6b54
Author: Serge Belyshev <belyshev@depni.sinp.msu.ru>
Date:   Thu Jul 15 20:19:18 2021 +0300

    gcc_update: use human readable name for revision string in gcc/REVISION
    
    contrib/Changelog:
    
            * gcc_update: Derive human readable name for HEAD using git describe
            like "git gcc-descr" with short commit hash.  Drop "revision" from
            gcc/REVISION.

Diff:
---
 contrib/gcc_update | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/contrib/gcc_update b/contrib/gcc_update
index 80fac9fc995..ce472545e25 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -332,7 +332,22 @@ case $vcs_type in
             exit 1
 	fi
 
-	revision=`$GCC_GIT log -n1 --pretty=tformat:%p:%t:%H`
+	# Open-coded version of "git gcc-descr" from contrib/gcc-git-customization.sh
+	revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
+	r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
+	   | sed -n 's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;
+	if test -n $r; then
+		o=`$GCC_GIT config --get gcc-config.upstream`;
+		rr=`echo $r | sed -n 's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'`;
+		if $GCC_GIT rev-parse --verify --quiet ${o:-origin}/releases/gcc-$rr >/dev/null; then
+			m=releases/gcc-$rr;
+		else
+			m=master;
+		fi;
+		if $GCC_GIT merge-base --is-ancestor HEAD ${o:-origin}/$m; then
+			revision=${r}-g${revision};
+		fi
+	fi
 	branch=`$GCC_GIT name-rev --name-only HEAD || :`
 	;;    
 
@@ -414,6 +429,6 @@ rm -f LAST_UPDATED gcc/REVISION
     date
     echo "`TZ=UTC date` (revision $revision)"
 } > LAST_UPDATED
-echo "[$branch revision $revision]" > gcc/REVISION
+echo "[$branch $revision]" > gcc/REVISION
 
 touch_files_reexec


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-06 12:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 12:59 [gcc r12-3370] gcc_update: use human readable name for revision string in gcc/REVISION Sergey Belyshev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).