From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60261 invoked by alias); 16 Jan 2020 11:43:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 60251 invoked by uid 89); 16 Jan 2020 11:43:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=rr X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2020 11:43:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579174998; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hXpdHGjb91jOR9zjcW2JJcpdMwkEtOQYjEaz3qVDhi4=; b=PMmf0GhChtbgoGw1MOywYt8wmTwvAfodHqIyk2tLWvHTgcj0w65ryCWgLrc6Mz8E9tAgw4 V7J0rLb4488L1ck2owFEObezJaMdTI8EPiZDn365NJ4ry6T/UMpr/2clytF3j7sHmcV/1V KJ5NG1HN/XjWBxjcOfRQX5B7tFeCgms= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-HCaLsQpqPpeWq7LQjfCT7Q-1; Thu, 16 Jan 2020 06:43:15 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3CCA518B5F79; Thu, 16 Jan 2020 11:43:14 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-74.brq.redhat.com [10.40.204.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8ADF8889F; Thu, 16 Jan 2020 11:43:13 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 00GBhCXe003968; Thu, 16 Jan 2020 12:43:12 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 00GBhBML003967; Thu, 16 Jan 2020 12:43:11 +0100 Date: Thu, 16 Jan 2020 12:50:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Cc: Martin =?utf-8?B?TGnFoWth?= Subject: [committed] contrib: Verify the id to be printed is ancestor of the corresponding remote release branch (or master), otherwise print nothing. Message-ID: <20200116114311.GB10088@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00952.txt.bz2 Hi! The monotonically increasing revision ids need to be globally unique, so th= ey should only identify commits that were committed to the upstream repo to its maste= r or releases/gcc-N branches. The alias could print something even for private = branches or vendor branches etc., but if such an identifier is then used publicly, i= t will refer to something else. Committed to trunk. Martin also suggested for git gcc-descr --full to also include date (commit date) in the string, so instead of r10-5998-g2588197b6c2175d7ef9f05a8636f58dfeab12b1d print r10-5998-20200116-g2588197b6c2175d7ef9f05a8636f58dfeab12b1d What do others think? The r10-5998 part in there is still needed to be the unique monotonically increasing identifier, the rest is something that can be derived from it, but e.g. in bugzilla the date could provide extra helpful information (which can be seen if one follows the link obviously). In addition to adjusting gcc-git-customization.sh, git-hooks we'd need to update the redirects and ask Frederic to update bugzilla URLization too. 2020-01-16 Jakub Jelinek * gcc-git-customization.sh: Verify the id to be printed is ancestor of the corresponding remote release branch (or master), otherwise print nothing. --- contrib/gcc-git-customization.sh.jj 2020-01-15 14:28:26.996758773 +0100 +++ contrib/gcc-git-customization.sh 2020-01-16 12:27:46.734690164 +0100 @@ -22,7 +22,7 @@ git config alias.svn-rev '!f() { rev=3D$1; =20 # Add git commands to convert git commit to monotonically increasing revis= ion number # and vice versa -git config alias.gcc-descr \!"f() { if test \${1:-no} =3D --full; then r= =3D\$(git describe --all --abbrev=3D40 --match 'basepoints/gcc-[0-9]*' \${2= :-master} | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p'); expr match \${r= :-no} '^r[0-9]\\+\$' >/dev/null && r=3D\${r}-0-g\$(git rev-parse \${2:-mast= er}); test -n \$r && echo \${r}; else git describe --all --match 'basepoint= s/gcc-[0-9]*' \${1:-master} | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-\\([0= -9]\\+\\)-\\([0-9]\\+\\)-g[0-9a-f]*\$,r\\2-\\3,p;s,^\\(tags/\\)\\?basepoint= s/gcc-\\([0-9]\\+\\)\$,r\\2-0,p'; fi; }; f" +git config alias.gcc-descr \!"f() { if test \${1:-no} =3D --full; then c= =3D\${2:-master}; r=3D\$(git describe --all --abbrev=3D40 --match 'basepoin= ts/gcc-[0-9]*' \$c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p'); expr m= atch \${r:-no} '^r[0-9]\\+\$' >/dev/null && r=3D\${r}-0-g\$(git rev-parse \= ${2:-master}); else c=3D\${1:-master}; r=3D\$(git describe --all --match 'b= asepoints/gcc-[0-9]*' \$c | 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'); fi; if test -n \$r; then o=3D\$(git config= --get gcc-config.upstream); rr=3D\$(echo \$r | sed -n 's,^r\\([0-9]\\+\\)-= [0-9]\\+\\(-g[0-9a-f]\\+\\)\\?\$,\\1,p'); if git rev-parse --verify --quiet= \${o:-origin}/releases/gcc-\$rr >/dev/null; then m=3Dreleases/gcc-\$rr; el= se m=3Dmaster; fi; git merge-base --is-ancestor \$c \${o:-origin}/\$m && \e= cho \${r}; fi; }; f" git config alias.gcc-undescr \!"f() { o=3D\$(git config --get gcc-config.u= pstream); r=3D\$(echo \$1 | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\$,\\1,p'); = n=3D\$(echo \$1 | sed -n 's,^r[0-9]\\+-\\([0-9]\\+\\)\$,\\1,p'); test -z \$= r && echo Invalid id \$1 && exit 1; h=3D\$(git rev-parse --verify --quiet \= ${o:-origin}/releases/gcc-\$r); test -z \$h && h=3D\$(git rev-parse --verif= y --quiet \${o:-origin}/master); p=3D\$(git describe --all --match 'basepoi= nts/gcc-'\$r \$h | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-[0-9]\\+-\\([0-9= ]\\+\\)-g[0-9a-f]*\$,\\2,p;s,^\\(tags/\\)\\?basepoints/gcc-[0-9]\\+\$,0,p')= ; git rev-parse --verify \$h~\$(expr \$p - \$n); }; f" =20 # Make diff on MD files use "(define" as a function marker. =20 Jakub