Allow do-rebase to pull the patches from different repositories

Currently the script always pull the patches from rhboot Github repo, but
for testing and developing purposes may be useful to use a different one.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-05-14 17:43:52 +02:00 committed by Peter Jones
parent 44d0f31d1f
commit 10cf1ae6a4

View file

@ -17,7 +17,7 @@ usage()
exec 1>&2 exec 1>&2
retcode=$1 retcode=$1
fi fi
echo usage: do-rebase \$releasever echo usage: do-rebase \$releasever \$gitrepo
exit $retcode exit $retcode
} }
@ -26,6 +26,7 @@ if ! git status | grep -q 'nothing to commit, working .* clean' ; then
exit 1 exit 1
fi fi
gitrepo="git@github.com:rhboot/grub2.git"
releasever="" releasever=""
amend="" amend=""
@ -43,6 +44,13 @@ while [ $# -gt 0 ]; do
shift shift
releasever=$1 releasever=$1
;; ;;
--repo=*)
gitrepo=${1##--repo=}
;;
--repo)
shift
gitrepo=$1
;;
--amend) --amend)
amend="--amend" amend="--amend"
;; ;;
@ -88,6 +96,11 @@ if [ -z "$releasever" ]; then
usage 1 usage 1
fi fi
if [ -n "${1:-}" ]; then
gitrepo=$1
shift
fi
if [ $# -ge 1 ]; then if [ $# -ge 1 ]; then
echo "Unknown argument \"$1\"" 1>&2 echo "Unknown argument \"$1\"" 1>&2
usage 1 usage 1
@ -96,14 +109,14 @@ fi
if [ ! -d $PWD/.rhboot.git ]; then if [ ! -d $PWD/.rhboot.git ]; then
othergit init othergit init
if ! othergit remote add \ if ! othergit remote add \
rhboot git@github.com:rhboot/grub2.git \ rhboot $gitrepo \
>/dev/null 2>&1 ; then >/dev/null 2>&1 ; then
echo "Could not add remote: rhboot" 1>&2 echo "Could not add remote: rhboot" 1>&2
exit 1 exit 1
fi fi
elif othergit remote show -n rhboot | grep -q "URL: github$" ; then elif othergit remote show -n rhboot | grep -q "URL: github$" ; then
if ! othergit remote add \ if ! othergit remote add \
rhboot git@github.com:rhboot/grub2.git \ rhboot $gitrepo \
>/dev/null 2>&1 ; then >/dev/null 2>&1 ; then
echo "Could not add remote: rhboot" 1>&2 echo "Could not add remote: rhboot" 1>&2
exit 1 exit 1