diff options
Diffstat (limited to 'scripts/check_upstream')
| -rwxr-xr-x | scripts/check_upstream | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/check_upstream b/scripts/check_upstream new file mode 100755 index 0000000..9f20037 --- /dev/null +++ b/scripts/check_upstream | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #! /bin/bash | ||
| 2 | |||
| 3 | # This script is for repo forked from others | ||
| 4 | # check $1(repo) if upstream branch origin/master is | ||
| 5 | # ahead of local branch $2(default to dev) | ||
| 6 | |||
| 7 | |||
| 8 | if [ ! -d $1 ]; then | ||
| 9 | return 0 | ||
| 10 | fi | ||
| 11 | |||
| 12 | head='dev' | ||
| 13 | if [ $# -eq 2 ] | ||
| 14 | then | ||
| 15 | head=$2 | ||
| 16 | fi | ||
| 17 | |||
| 18 | cd $1 | ||
| 19 | git fetch origin && \ | ||
| 20 | git rev-list $head | grep $(git rev-parse origin/master) > /dev/null | ||
| 21 | |||
| 22 | if [ $? -ne 0 ] | ||
| 23 | then | ||
| 24 | echo "New commit at" $1 | ||
| 25 | fi | ||
| 26 | |||
| 27 | echo $(date) check $1 >> $SETTING_DIR/log | ||