Skip to content
Snippets Groups Projects
Commit 53726a00 authored by Guido Trotter's avatar Guido Trotter
Browse files

devel/review: make the range argument optional


Rather than calling devel/review with from..to target we can just use
target, and assume target..HEAD as the range. This makes it a lot
easier, as now you just have to say something like "devel/review
devel-2.1" if you're already on the branch you want to commit, and want
to commit it to devel-2.1.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 25942a6c
No related branches found
No related tags found
No related merge requests found
......@@ -196,14 +196,31 @@ copy_commit() {
GIT_EDITOR="$me --commit-editor \"\$@\"" git commit -c "$rev" -s
}
main() {
local range="$1" target_branch="$2"
usage() {
echo "Usage: $me_plain [from..to] <target-branch>" >&2
echo " If not passed from..to defaults to target-branch..HEAD" >&2
exit 1
}
if [[ -z "$target_branch" || "$range" != *..* ]]
then
echo "Usage: $me_plain <from..to> <target-branch>" >&2
exit 1
fi
main() {
local range target_branch
case "$#" in
1)
target_branch="$1"
range="$target_branch..$(git rev-parse HEAD)"
;;
2)
range="$1"
target_branch="$2"
if [[ "$range" != *..* ]]; then
usage
fi
;;
*)
usage
;;
esac
git checkout "$target_branch"
local old_head=$(git rev-parse HEAD)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment