hi,
Nowadays I am seeing quite a few patches are straightforward backports from master. But if I follow the process it generally takes around 10 minutes to complete porting each patch. I was wondering if anyone else looked into automating this. Yesterday I had to backport http://review.gluster.org/15728 to 3.9, 3.8, 3.7. So I finally took some time to automate portions of the workflow. I want to exchange ideas you may be using to achieve the same.===================================================
⚡ cat ../backport.sh
#!/bin/bash
#launch it like this: BRANCHES="3.9 3.8 3.7" ./backport.sh <branch-name-prefix> <commit-hash-to-be-backported>
prefix=$1
shift
commit=$1
shift
function add_prefix_to_commit_headers {
#We have the habit of adding ' >' for the commit headers
for i in BUG Change-Id Signed-off-by Reviewed-on Smoke NetBSD-regression Reviewed-by CentOS-regression; do sed -i -e "s/^$i:/ >$i:/" commit-msg; done
}
function form_commit_msg {
#Get the commit message out of the commit
local commit=$1
git log --format=%B -n 1 $commit > commit-msg
}
function main {
cur_branch=$(git rev-parse --abbrev-ref HEAD)
form_commit_msg $commit
add_prefix_to_commit_headers;
rm -f branches;
for i in $BRANCHES; do cp commit-msg ${i}-commit-msg && git checkout -b ${prefix}-${i} origin/release-${i} > /dev/null && git cherry-pick $commit && git commit -s --amend -F ${i}-commit-msg && echo ${prefix}-${i} >> branches; done
git checkout $cur_branch
}
main
===================================================
# gerrit assign xhernandez@xxxxxxxxxx - this will add Xavi as reviewer for the patch that I just committed.
# gerrit comment "recheck smoke"
# gerrit comment "recheck centos"
# gerrit comment "recheck netbsd"
4) I am yet to look into bugzilla cli to come up with the command to move the bugs into POST, but may be Niels has it at his fingertips?
Main pain point has been cloning the bugs. If we have an automated way to clone the bug to different branches. The script at 2) can be modified to add all the steps.
If we can clone the bug and get the bz of the cloned bug, then we can add "BUG: <bz>" to the commit-message and launch rfc.sh which won't prompt for anything. We can auto answer coding-guidelines script by launching "yes | rfc.sh" if we really want to.
PS: The script is something I hacked together for one time use yesterday. Not something I guessed I would send a mail about today so it is not all that good looking. Just got the job done yesterday.
--
Pranith
_______________________________________________ Gluster-devel mailing list Gluster-devel@xxxxxxxxxxx http://www.gluster.org/mailman/listinfo/gluster-devel