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;


(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 :-)

Martin

Reply via email to