summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2016-06-25 14:23:30 +0200
committerJonas Gorski <jonas.gorski@gmail.com>2016-07-09 13:41:28 +0200
commit15b88df87f28faf4b37c8490c8e3af3fe1e4c0cb (patch)
treed4d177485d4f8e28810b740a91d305b9032d7705 /scripts
parent1001b5d77c5dd7adc7bb2fcce8778364b88e5ea0 (diff)
downloadmtk-20170518-15b88df87f28faf4b37c8490c8e3af3fe1e4c0cb.zip
mtk-20170518-15b88df87f28faf4b37c8490c8e3af3fe1e4c0cb.tar.gz
mtk-20170518-15b88df87f28faf4b37c8490c8e3af3fe1e4c0cb.tar.bz2
scripts/getver.sh: improve revision output
Change the revision output to r<upstream-revision>+<local commits> so it is easier to get the base revision (and see if there are local commits). Example: $ ./scripts/getver.sh r794+3 $ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/getver.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/getver.sh b/scripts/getver.sh
index a60b91e..4c8fab0 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -23,9 +23,14 @@ try_git() {
REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))"
;;
*)
-
+ UPSTREAM_BASE="$(git merge-base $GET_REV origin/master)"
+ UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE --count)"
REV="$(git rev-list reboot..$GET_REV --count)"
- REV="${REV:+r$REV}"
+ if [ -n "$REV" -a -n "$UPSTREAM_REV" -a "$REV" -gt "$UPSTREAM_REV" ]; then
+ REV="r${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
+ else
+ REV="${REV:+r$REV}"
+ fi
;;
esac