Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7307ba65d5457097c772079129dbf9581bbf900c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
#*******************************************************************************
# Copyright (c) 2016 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#     David Williams - initial API and implementation
#*******************************************************************************

GITCOMMIT=$( git rev-parse HEAD )
#GITDATE=$( git log -1 --format="%H%n%aD" --date=short )

# we go to a lot of trouble here, just to get
# short form, in prettiest way, using git commands
# as much a possible, instead of heuristic parsing.
git symbolic-ref --quiet HEAD >/dev/null
if (( $? == 0 ))
then
    GITBRANCH=$( git rev-parse --abbrev-ref HEAD )
else
    GITBRANCH='[Not on a branch]'
fi

GITTAG=$( git describe --abbrev=0 --exact-match --contains --tags $GITCOMMIT )
#echo "GITTAG: $GITTAG"
SHORT_TAG=${GITTAG##*/}
#echo "SHORT_TAG: $SHORT_TAG"

#echo "pwd: ${PWD}"
REPONAME=${PWD##*/}

case "$REPONAME" in
    eclipse.platform*)
        REPOROOT="platform";;
    eclipse.jdt*)
        REPOROOT="jdt";;
    eclipse.pde*)
        REPOROOT="pde";;
    rt.equinox*)
        REPOROOT="equinox";;
    *)
        echo "WARNING: unrecognized reponame pattern for $REPONAME";;
esac
#echo "REPOROOT: $REPOROOT"
#echo "reponame: ${REPONAME}"
#echo "git_dir: $GIT_DIR"
# git ls-remote http://www.kernel.org/pub/scm/git/git.git master pu rc
# git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git
REMOTETAG=$( git ls-remote --tags git://git.eclipse.org/gitroot/${REPOROOT}/${REPONAME}.git $SHORT_TAG )
if [[ -z "${REMOTETAG}" ]]
then
    REMOTETAG='[No tag in remote (canonical) repository]'
else
    REMOTETAG=${REMOTETAG##*/}
fi
#echo "REMOTETAG: $REMOTETAG"
printf "  %s \t%s \t%s \t%s \t%s \n" "$REPONAME $GITCOMMIT $GITBRANCH $SHORT_TAG $REMOTETAG"

Back to the top