mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Merge branch 'master' of github.com:nathanstilwell/oh-my-zsh
This commit is contained in:
commit
3928076fd7
2 changed files with 24 additions and 146 deletions
|
|
@ -1,111 +1,3 @@
|
||||||
function gerrit_usage {
|
#
|
||||||
echo
|
# OUT OF DATE
|
||||||
echo " usage: gerrit <command>"
|
#
|
||||||
echo
|
|
||||||
echo " try these :";
|
|
||||||
echo " push Push changes without going through a review. ";
|
|
||||||
echo " pull Pull latest changes and rebase ... or something. ";
|
|
||||||
echo " review Push changes and submit changes for review";
|
|
||||||
echo " patchset Work with a checked out patch set";
|
|
||||||
echo " setup-reviewers Set current repo to automatically have reviewers from your team";
|
|
||||||
echo " add-reviewer Add a reviewer to the repo";
|
|
||||||
echo " clone Clone a repo from gerrit, requires repo name";
|
|
||||||
echo " setup Add gerrit commit hook to a repo";
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_push () {
|
|
||||||
git push origin HEAD:refs/heads/$1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_review () {
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
git push origin HEAD:refs/for/master;
|
|
||||||
else
|
|
||||||
git push origin HEAD:refs/for/$1;
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_pull () {
|
|
||||||
#git pull --rebase origin $1;
|
|
||||||
git fetch;
|
|
||||||
git rebase origin/$1
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_patchset_usage () {
|
|
||||||
echo
|
|
||||||
echo " usage: gerrit patchset <commnad>";
|
|
||||||
echo
|
|
||||||
echo "commands : ";
|
|
||||||
echo " commit Amend commit to add a patchset";
|
|
||||||
echo " review Push changes back to commit as patchset";
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_patchset () {
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
gerrit_patchset_usage;
|
|
||||||
else
|
|
||||||
[ $1 = "commit" ] && git commit --amend;
|
|
||||||
[ $1 = "review" ] && git push origin HEAD:refs/for/${2:-master};
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_clone () {
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
echo "$yellow Please supply the name of a repo to clone. $stop"
|
|
||||||
else
|
|
||||||
#git clone --recursive ssh://gerrit_host/$1 $2
|
|
||||||
gg-gerrit-clone $1 $2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_set_team_reviewers () {
|
|
||||||
git config remote.origin.receivepack 'git receive-pack --reviewer kmcgregor@giltcity.com --reviewer nyusaf@gilt.com';
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
echo "$green Reviewers Added. $stop";
|
|
||||||
else
|
|
||||||
echo "$red That failed for some reason. I'm not sure what to do now. $stop";
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_add_reviewer {
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
echo "$yellow Please specify reviewer. $stop";
|
|
||||||
else
|
|
||||||
echo "$red Please finish me. $stop";
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_setup () {
|
|
||||||
cd .git/hooks;
|
|
||||||
scp gerrit_host:hooks/commit-msg . > /dev/null;
|
|
||||||
cd - > /dev/null;
|
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
echo "$green Gerrit hook installed. $stop";
|
|
||||||
else
|
|
||||||
echo "$red Couldn't install Gerrit hook. $stop";
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit () {
|
|
||||||
|
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null);
|
|
||||||
isGitRepo=$?
|
|
||||||
branch=${ref#refs/heads/};
|
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
gerrit_usage;
|
|
||||||
else
|
|
||||||
[ $1 = "push" ] && gerrit_push $branch;
|
|
||||||
[ $1 = "review" ] && gerrit_review $branch;
|
|
||||||
[ $1 = "pull" ] && gerrit_pull $branch;
|
|
||||||
[ $1 = "patchset" ] && gerrit_patchset $2 $3;
|
|
||||||
[ $1 = "setup-reviewers" ] && gerrit_set_team_reviewers;
|
|
||||||
[ $1 = "add-reviewer" ] && gerrit_add_reviewer $2;
|
|
||||||
[ $1 = "clone" ] && gerrit_clone $2 $3;
|
|
||||||
[ $1 = "setup" ] && gerrit_setup;
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ function gerrit_usage {
|
||||||
echo " push Push changes without going through a review. ";
|
echo " push Push changes without going through a review. ";
|
||||||
echo " pull Pull latest changes and rebase ... or something. ";
|
echo " pull Pull latest changes and rebase ... or something. ";
|
||||||
echo " patch Work with gerrit patchset";
|
echo " patch Work with gerrit patchset";
|
||||||
|
echo " reset Reset hard to origin/master";
|
||||||
echo " review Submit changes for review";
|
echo " review Submit changes for review";
|
||||||
echo " draft Submit changes for review as draft";
|
echo " draft Submit changes for review as draft";
|
||||||
echo " setup-reviewers Set current repo to automatically have reviewers from your team";
|
echo " setup-reviewers Set current repo to automatically have reviewers from your team";
|
||||||
|
|
@ -40,6 +41,10 @@ function gerrit_draft () {
|
||||||
git push origin HEAD:refs/drafts/$1;
|
git push origin HEAD:refs/drafts/$1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gerrit_reset {
|
||||||
|
git reset --hard origin/master;
|
||||||
|
}
|
||||||
|
|
||||||
function gerrit_pull () {
|
function gerrit_pull () {
|
||||||
#git pull --rebase origin $1;
|
#git pull --rebase origin $1;
|
||||||
git fetch;
|
git fetch;
|
||||||
|
|
@ -47,45 +52,28 @@ function gerrit_pull () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function gerrit_patch () {
|
function gerrit_patch () {
|
||||||
if [ -z $1 ]; then
|
if [ -z "$1" ]; then
|
||||||
gerrit_patch_usage;
|
gerrit_patch_usage;
|
||||||
else
|
else
|
||||||
[ $1 = "commit" ] && git commit --amend;
|
[ "$1" = "commit" ] && git commit --amend;
|
||||||
[ $1 = "review" ] && gerrit_review "master";
|
[ "$1" = "review" ] && gerrit_review "master";
|
||||||
[ $1 = "draft" ] && gerrit_draft "master";
|
[ "$1" = "draft" ] && gerrit_draft "master";
|
||||||
[ $1 = "rebase" ] && gerrit_pull "master";
|
[ "$1" = "rebase" ] && gerrit_pull "master";
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function gerrit_clone () {
|
function gerrit_clone () {
|
||||||
if [ -z $1 ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "$yellow Please supply the name of a repo to clone. $stop"
|
echo "$yellow Please supply the name of a repo to clone. $stop"
|
||||||
else
|
else
|
||||||
if [[ -n $(which gg-gerrit-clone) ]]; then
|
if [[ -n $(which gg-gerrit-clone) ]]; then
|
||||||
gg-gerrit-clone $1
|
gg-gerrit-clone "$1"
|
||||||
else
|
else
|
||||||
git clone --recursive ssh://gerrit_host/$1
|
git clone --recursive ssh://gerrit_host/$1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function gerrit_set_team_reviewers () {
|
|
||||||
git config remote.origin.receivepack 'git receive-pack --reviewer kmcgregor@giltcity.com --reviewer nyusaf@gilt.com';
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
echo "$green Reviewers Added. $stop";
|
|
||||||
else
|
|
||||||
echo "$red That failed for some reason. I'm not sure what to do now. $stop";
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_add_reviewer {
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
echo "$yellow Please specify reviewer. $stop";
|
|
||||||
else
|
|
||||||
echo "$red Please finish me. $stop";
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function gerrit_setup () {
|
function gerrit_setup () {
|
||||||
if [ -d /web/tools/bin/install-hooks ]; then
|
if [ -d /web/tools/bin/install-hooks ]; then
|
||||||
# install hooks
|
# install hooks
|
||||||
|
|
@ -102,21 +90,19 @@ function gerrit_setup () {
|
||||||
function gerrit () {
|
function gerrit () {
|
||||||
|
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null);
|
ref=$(git symbolic-ref HEAD 2> /dev/null);
|
||||||
isGitRepo=$?
|
|
||||||
branch=${ref#refs/heads/};
|
branch=${ref#refs/heads/};
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
if [ -z "$1" ]; then
|
||||||
gerrit_usage;
|
gerrit_usage;
|
||||||
else
|
else
|
||||||
[ $1 = "patch" ] && gerrit_patch $2
|
[ "$1" = "patch" ] && gerrit_patch "$2"
|
||||||
[ $1 = "push" ] && gerrit_push $branch;
|
[ "$1" = "push" ] && gerrit_push "$branch";
|
||||||
[ $1 = "review" ] && gerrit_review $branch;
|
[ "$1" = "review" ] && gerrit_review "$branch";
|
||||||
[ $1 = "draft" ] && gerrit_draft $branch;
|
[ "$1" = "reset" ] && gerrit_reset;
|
||||||
[ $1 = "pull" ] && gerrit_pull $branch;
|
[ "$1" = "draft" ] && gerrit_draft "$branch";
|
||||||
[ $1 = "setup-reviewers" ] && gerrit_set_team_reviewers;
|
[ "$1" = "pull" ] && gerrit_pull "$branch";
|
||||||
[ $1 = "add-reviewer" ] && gerrit_add_reviewer $2;
|
[ "$1" = "clone" ] && gerrit_clone "$2";
|
||||||
[ $1 = "clone" ] && gerrit_clone $2;
|
[ "$1" = "setup" ] && gerrit_setup;
|
||||||
[ $1 = "setup" ] && gerrit_setup;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue