Merge "Implement "Compare with Revision" action."
[egit.git] / tag_egit.sh
bloba418d9d8adffdafd9e5c6c71a3bea79ff755e179
1 #!/bin/sh
3 # Updates MANIFEST.MF files for EGit plugins.
5 v=$1
6 if [ -z "$v" ]
7 then
8 echo >&2 "usage: $0 version"
9 exit 1
12 MF=$(git ls-files | grep META-INF/MANIFEST.MF)
13 FX=org.eclipse.egit-feature/feature.xml
14 SX=org.eclipse.egit-updatesite/site.xml
15 ALL="$MF $FX $SX"
17 replace() {
18 version=$1
20 perl -pi -e 's/^(Bundle-Version:).*/$1 '$version/ $MF
21 perl -pi -e '
22 if (/^.*version=/ && ++$f == 2) {
23 s/^(.*version)=".*"/$1="'$version'"/
24 }' $FX
25 perl -pi -e '
26 next if /^<\?xml/;
27 s/(egit_).*?(.jar)/${1}'$version'$2/;
28 s/(version)=".*?"/$1="'$version'"/;
29 ' $SX
32 replace $v
33 git commit -s -m "EGit $v" $ALL &&
34 c=$(git rev-parse HEAD) &&
36 replace $v.qualifier &&
37 git commit -s -m "Re-add version qualifier suffix to $v" $ALL &&
39 echo &&
40 tagcmd="git tag -s -m 'EGit $v' v$v $c" &&
41 if ! eval $tagcmd
42 then
43 echo >&2
44 echo >&2 "Tag with:"
45 echo >&2 " $tagcmd"
46 exit 1
47 fi || exit