SCRIPTS: backport: use short revs and resolve the initial commit
I find myself often getting trapped into calling "backport 2.0 HEAD" which doesn't work because "HEAD" is passed as the argument to cherry-pick in other repos. Let's resolve it first. And also let's shorten the commit IDs to make the error messages more readable and to ease copy-paste.
This commit is contained in:
parent
e4f80a076c
commit
499b298ce0
@ -22,8 +22,7 @@ quit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
short() {
|
short() {
|
||||||
# git rev-parse --short $1
|
git rev-parse --short "$1"
|
||||||
echo "${1::8}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# returns the latest commit ID in $REPLY. Returns 0 on success, non-zero on
|
# returns the latest commit ID in $REPLY. Returns 0 on success, non-zero on
|
||||||
@ -112,8 +111,9 @@ cd $(git rev-parse --show-toplevel)
|
|||||||
START="$PWD"
|
START="$PWD"
|
||||||
|
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
UPSTREAM="$1"
|
UPSTREAM="$(short $1)"
|
||||||
COMMIT="$1"
|
[ -n "$UPSTREAM" ] || die "branch $BRANCH: unknown commit ID $1, cannot backport."
|
||||||
|
COMMIT="$UPSTREAM"
|
||||||
BRANCH="-source-"
|
BRANCH="-source-"
|
||||||
while :; do
|
while :; do
|
||||||
if ! down; then
|
if ! down; then
|
||||||
@ -139,7 +139,7 @@ while [ -n "$1" ]; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
get_last_commit || die "$BRANCH: cannot retrieve last commit ID, stopping after backporting commit $COMMIT (upstream $UPSTREAM)"
|
get_last_commit || die "$BRANCH: cannot retrieve last commit ID, stopping after backporting commit $COMMIT (upstream $UPSTREAM)"
|
||||||
COMMIT="$REPLY"
|
COMMIT="$(short $REPLY)"
|
||||||
done
|
done
|
||||||
walk_up || die "Failed to go back to $PWD, stopping *after* backporting upstream $UPSTREAM"
|
walk_up || die "Failed to go back to $PWD, stopping *after* backporting upstream $UPSTREAM"
|
||||||
shift
|
shift
|
||||||
|
Loading…
x
Reference in New Issue
Block a user