Use git log instead of git-log as the latter doesn't exist anymore in newer git versions
[platform/upstream/gst-common.git] / update-common
1 #!/bin/sh
2 #
3 # This script will update all the modules listed below so that
4 # common points to master in the common module.
5 #
6
7 # Set this variable to point to any directory containing existing
8 # git # checkouts, and git will pull objects from there, decreasing
9 # network usage.  You can also run this script from that directory.
10 reference=~/gst
11
12 set -e
13 set -x
14
15 modules="gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad \
16         gst-plugins-ugly gst-ffmpeg gst-openmax gst-python \
17         gnonlin gst-plugins-gl"
18
19 topdir=`pwd`
20 dir=`mktemp -d $topdir/common-update-XXXXXX`
21
22 for module in $modules
23 do
24   cd $dir
25   if test -e $reference/$module/.git ; then
26     git clone --reference $reference/$module/.git --shared ssh://git.freedesktop.org/git/gstreamer/$module
27   elif test -e $topdir/$module/.git ; then
28     git clone --reference $topdir/$module/.git --shared ssh://git.freedesktop.org/git/gstreamer/$module
29   else
30     git clone ssh://git.freedesktop.org/git/gstreamer/$module
31   fi
32   cd $dir/$module
33   git submodule init
34   git submodule update
35   cd $dir/$module/common
36   ref_from=`git log --pretty=format:%h -n 1 HEAD`
37   git checkout master
38   git pull origin
39   ref_to=`git log --pretty=format:%h -n 1 HEAD`
40   echo updating common from $ref_from to $ref_to
41   if [ "$ref_from" != "$ref_to" ] ; then
42     cd $dir/$module
43     git add common
44     git commit -m "Automatic update of common submodule
45
46 From $ref_from to $ref_to"
47   fi
48   cd $dir
49 done
50
51 exit 0
52
53 for module in $modules
54 do
55   cd $topdir/$module
56   git push origin
57 done
58
59 #rm -rf $dir
60