public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Martin Jambor <mjambor@suse.cz>, Jakub Jelinek <jakub@redhat.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [RFC] Port git gcc-descr to Python
Date: Wed, 19 Jan 2022 14:17:54 +0100	[thread overview]
Message-ID: <5f1250ca-297a-dd82-0912-18259512d349@suse.cz> (raw)
In-Reply-To: <ri6sftjriv7.fsf@suse.cz>

On 1/19/22 13:49, Martin Jambor wrote:
> Hi,
> 
> On Wed, Jan 19 2022, Martin Liška wrote:
>> On 10/18/21 11:01, Martin Liška wrote:
>>> On 10/12/21 10:59, Martin Liška wrote:
>>>> Hello.
>>>>
>>>> There's a complete patch that implements both git gcc-descr and gcc-undesrc
>>>> and sets corresponding git aliases to use them.
>>>>
>>>> Ready to be installed?
>>>> Thanks,
>>>> Martin
>>>
>>> All right, so Jakub told me at IRC that we doesn't support porting to Python.
>>> However, he promised supporting the changes I made in the original shell script.
>>
>> @Jakub: May I remind this, please?
> 
> putting the following line in ..git/config seems to do the trick?
> 
> 	gcc-descr = "!f() { if test ${1:-no} = --short; then c=${2:-master}; r=$(git describe --all --match 'basepoints/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'); elif test ${1:-no} = --full; then c=${2:-master}; r=$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p'); else c=${1:-master}; r=$(git describe --all --abbrev=14 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p'); expr match ${r:-no} '^r[0-9]\\+$' >/dev/null && r=${r}-0-g$(git rev-parse ${2:-master}); fi; if test -n $r; then o=$(git config --get gcc-config.upstream); rr=$(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=releases/gcc-$rr; else m=master; fi; git merge-base --is-ancestor $c ${o:-origin}/$m && \\echo ${r}; fi; }; f"
> 
> Derived from the following before squashing all the new lines:
> 
>      if test ${1:-no} = --short; then
> 	c=${2:-master};
> 	r=$(git describe --all --match 'basepoints/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');
>      elif test ${1:-no} = --long; then
> 	c=${2:-master};
> 	r=$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p');	
>      else
> 	c=${1:-master};
> 	r=$(git describe --all --abbrev=14 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p');
> 	expr match ${r:-no} '^r[0-9]\\+$' >/dev/null && r=${r}-0-g$(git rev-parse ${2:-master});
>      fi;
>      if test -n $r; then
> 	o=$(git config --get gcc-config.upstream);
> 	rr=$(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=releases/gcc-$rr;
> 	else
> 	    m=master;
> 	fi;
> 	git merge-base --is-ancestor $c ${o:-origin}/$m && \\echo ${r};
>      fi;

Anyway, can we please put the nicely formatted bash script to contrib/git-describe.sh (contrib/git-undescribe.sh), having that squashed
to one line is just crazy.

Martin, can you please do that?

> 
> 
> (And if you wanted to ask then no, I am not touching
> contrib/gcc-git-customization.sh, not even with a long pole, it scares
> me :-)

Sure, I can then adjust it if we end up with an outlined version where to code
sits in proper .sh files.

Martin

> 
> Martin
> 


  reply	other threads:[~2022-01-19 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 11:01 [PATCH] contrib: git gcc-descr defaulting to print hash Martin Liška
2021-10-08 11:12 ` Jakub Jelinek
2021-10-11 12:32   ` [RFC] Port git gcc-descr to Python Martin Liška
2021-10-12  8:59     ` Martin Liška
2021-10-14  9:06       ` Tobias Burnus
2021-10-14  9:19         ` Jakub Jelinek
2021-10-18  9:01       ` Martin Liška
2022-01-19 11:01         ` Martin Liška
2022-01-19 12:49           ` Martin Jambor
2022-01-19 13:17             ` Martin Liška [this message]
2022-01-19 16:54               ` Eric Gallager
2022-01-27 15:06             ` [PATCH] contrib: Put gcc-descr and gcc-undescr to file Martin Liška
2022-01-27 15:35               ` Jakub Jelinek
2022-01-27 17:44                 ` Martin Liška
2022-01-27 15:51               ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f1250ca-297a-dd82-0912-18259512d349@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=mjambor@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).