Commit c8fb372b authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

update-common: add --commit=REF option for local testing

Add option to clone repositories and checkout a specific common
commit for testing purposes.
parent 0e515fa0
...@@ -24,6 +24,7 @@ reference=~/gst ...@@ -24,6 +24,7 @@ reference=~/gst
PUSHURL=ssh://git.freedesktop.org/git/gstreamer PUSHURL=ssh://git.freedesktop.org/git/gstreamer
DRY_RUN= DRY_RUN=
KEEP=no KEEP=no
COMMON_COMMIT=
set -e set -e
set -x set -x
...@@ -46,6 +47,11 @@ do ...@@ -46,6 +47,11 @@ do
--keep) --keep)
KEEP="yes"; KEEP="yes";
;; ;;
--commit=*)
COMMON_COMMIT="${arg#*=}";
DRY_RUN="--dry-run";
KEEP="yes";
;;
--help) --help)
echo echo
echo "update-common supported command line options:" echo "update-common supported command line options:"
...@@ -54,6 +60,8 @@ do ...@@ -54,6 +60,8 @@ do
echo echo
echo " --keep Don't delete temporary git checkout used for update operation, keep it around" echo " --keep Don't delete temporary git checkout used for update operation, keep it around"
echo echo
echo " --commit=REF Update common to commit reference REF (for local testing, implies --dry-run --keep)"
echo
exit 0; exit 0;
;; ;;
*) *)
...@@ -128,6 +136,13 @@ do ...@@ -128,6 +136,13 @@ do
git checkout -b $BRANCH origin/$BRANCH git checkout -b $BRANCH origin/$BRANCH
fi fi
git pull origin git pull origin
if [ -n "$COMMON_COMMIT" ] ; then
echo "Forcing common to commit $COMMON_COMMIT";
git reset --hard $COMMON_COMMIT || {
echo "Failed to git reset to $COMMON_COMMIT";
exit 1;
}
fi
ref_to=`git log --pretty=format:%h -n 1 HEAD` ref_to=`git log --pretty=format:%h -n 1 HEAD`
echo updating common from $ref_from to $ref_to echo updating common from $ref_from to $ref_to
if [ "$ref_from" != "$ref_to" ] ; then if [ "$ref_from" != "$ref_to" ] ; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment