Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ossi@ugly:~/bin > cat gerrit_retarget_changes
- #! /bin/sh
- # this is for gerrit 2.7
- if [ $# -lt 3 ]; then
- echo "Usage: $0 old_branch new_branch change..." >&2
- exit 3
- fi
- oldbranch=$1
- shift
- newbranch=$1
- shift
- qry="change_key in ('$1'"
- shift
- while test -n "$1"; do
- qry="$qry, '$1'"
- shift
- done
- qry="$qry)"
- fails=$(
- ssh codereview.qt-project.org gerrit gsql <<EOF | sed -n 's,^ \([a-z0-9]\{40\,\}\)$,\1,ip'
- select change_key from changes where dest_branch_name = 'refs/heads/$newbranch' and $qry;
- EOF
- )
- if test -n "$fails"; then
- echo "These changes already exist on $newbranch:" $fails
- exit 1
- fi
- ssh codereview.qt-project.org gerrit gsql <<EOF
- update changes set dest_branch_name = 'refs/heads/$newbranch' where dest_branch_name = 'refs/heads/$oldbranch' and $qry;
- EOF
- echo
- ssh codereview.qt-project.org gerrit flush-caches --cache changes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement