Translated using Weblate (French)
[phpmyadmin.git] / scripts / revision-info
blobb039441a5383896e8d8f8b5644de32502ed202fe
1 #!/bin/sh
3 # Generates revision-info.php file which is used by demo server
6 set -e
8 remote_url=`git remote show -n origin | grep 'Fetch' | sed 's/.*URL: //'`
9 ref=$(git symbolic-ref -q HEAD || git name-rev --name-only HEAD 2>/dev/null)
10 ref=${ref#refs/heads/}
11 rev=`git describe --always`
12 fullrev=`git log -1 | head -n 1 | awk '{print $2}'`
13 if [ "$remote_url" = "git://github.com/phpmyadmin/phpmyadmin.git" ] \
14 || [ "$remote_url" = "https://github.com/phpmyadmin/phpmyadmin" ]; then
15 repobase="https://github.com/phpmyadmin/phpmyadmin/commit/"
16 repobranchbase="https://github.com/phpmyadmin/phpmyadmin/tree/"
17 reponame=''
18 elif echo "$remote_url" | grep -q "git://github.com/" ; then
19 repobase=`echo $remote_url | sed 's@git://github.com/\(.*\)/\(.*\).git@https://github.com/\1/\2/commit/@'`
20 repobranchbase=`echo $remote_url | sed 's@git://github.com/\(.*\)/\(.*\).git@https://github.com/\1/\2/tree/@'`
21 reponame=`echo $remote_url | sed 's@git://github.com/\(.*\)/\(.*\).git@\1@'`
22 else
23 repobase=`echo $remote_url | sed 's@git://repo.or.cz@http://repo.or.cz/w@'`/commitdiff/
24 repobranchbase=`echo $remote_url | sed 's@git://repo.or.cz@http://repo.or.cz/w@'`/shortlog/refs/heads/
25 reponame=''
27 cat > revision-info.php.tmp <<EOT
28 <?php
29 \$revision = '$rev';
30 \$fullrevision = '$fullrev';
31 \$repobase = '$repobase';
32 \$reponame = '$reponame';
33 \$repobranchbase = '$repobranchbase';
34 \$branch = '$ref';
36 EOT
37 mv revision-info.php.tmp revision-info.php