diff --git a/plugins/gerrit/gerrit.plugin.zsh b/plugins/gerrit/gerrit.plugin.zsh index 5e7b5dcaa..35dc29a96 100644 --- a/plugins/gerrit/gerrit.plugin.zsh +++ b/plugins/gerrit/gerrit.plugin.zsh @@ -5,6 +5,7 @@ function gerrit_usage { echo " try these :"; echo " push Push changes without going through a review. "; echo " pull Pull latest changes and rebase ... or something. "; + echo " patch Work with gerrit patchset"; echo " review Push changes and submit changes for review"; echo " setup-reviewers Set current repo to automatically have reviewers from your team"; echo " add-reviewer Add a reviewer to the repo"; @@ -13,6 +14,17 @@ function gerrit_usage { echo } +function gerrit_patch_usage () { + echo + echo " usage: gerrit patch "; + echo + echo " try these :"; + echo + echo " commit amend the patchset commit"; + echo " review push the patchset back to the gerrit review"; + echo +} + function gerrit_push () { git push origin HEAD:refs/heads/$1; } @@ -27,6 +39,15 @@ function gerrit_pull () { git rebase origin/$1 } +function gerrit_patch () { + if [ -z $1 ]; then + gerrit_patch_usage; + else + [ $1 = "commit" ] && git commit --amend; + [ $1 = "review" ] && gerrit_review "master"; + fi +} + function gerrit_clone () { if [ -z $1 ]; then echo "$yellow Please supply the name of a repo to clone. $stop" @@ -77,6 +98,7 @@ function gerrit () { if [ -z $1 ]; then gerrit_usage; else + [ $1 = "patch" ] && gerrit_patch $2 [ $1 = "push" ] && gerrit_push $branch; [ $1 = "review" ] && gerrit_review $branch; [ $1 = "pull" ] && gerrit_pull $branch;