mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Just kidding, still need plugins
I guess things don't work in the custom folder. Oh well.
This commit is contained in:
parent
2113abb119
commit
a6a0a0855e
3 changed files with 129 additions and 3 deletions
|
|
@ -1,3 +0,0 @@
|
||||||
#
|
|
||||||
# OUT OF DATE
|
|
||||||
#
|
|
||||||
21
plugins/dock/dock.plugin.zsh
Normal file
21
plugins/dock/dock.plugin.zsh
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
function dock_usage () {
|
||||||
|
echo
|
||||||
|
echo " usage: dock <command>"
|
||||||
|
echo
|
||||||
|
echo "JUST A TEST, THERE ARE NO COMMANDS"
|
||||||
|
}
|
||||||
|
|
||||||
|
function dock () {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
dock_usage;
|
||||||
|
# else
|
||||||
|
# [ "$1" = "patch" ] && gerrit_patch "$2"
|
||||||
|
# [ "$1" = "push" ] && gerrit_push "$branch";
|
||||||
|
# [ "$1" = "review" ] && gerrit_review "$branch";
|
||||||
|
# [ "$1" = "reset" ] && gerrit_reset;
|
||||||
|
# [ "$1" = "draft" ] && gerrit_draft "$branch";
|
||||||
|
# [ "$1" = "pull" ] && gerrit_pull "$branch";
|
||||||
|
# [ "$1" = "clone" ] && gerrit_clone "$2";
|
||||||
|
# [ "$1" = "setup" ] && gerrit_setup;
|
||||||
|
fi
|
||||||
|
}
|
||||||
108
plugins/gerrit/gerrit.plugin.zsh
Normal file
108
plugins/gerrit/gerrit.plugin.zsh
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
function gerrit_usage {
|
||||||
|
echo
|
||||||
|
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 " patch Work with gerrit patchset";
|
||||||
|
echo " reset Reset hard to origin/master";
|
||||||
|
echo " review Submit changes for review";
|
||||||
|
echo " draft Submit changes for review as draft";
|
||||||
|
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_patch_usage () {
|
||||||
|
echo
|
||||||
|
echo " usage: gerrit patch <command>";
|
||||||
|
echo
|
||||||
|
echo " try these :";
|
||||||
|
echo
|
||||||
|
echo " commit Amend the patchset commit";
|
||||||
|
echo " review Submit patchset back to the gerrit for review";
|
||||||
|
echo " draft Submit patchset back to the gerrit for review as draft";
|
||||||
|
echo " rebase Rebase onto master into patchset";
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_push () {
|
||||||
|
git push origin HEAD:refs/heads/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_review () {
|
||||||
|
git push origin HEAD:refs/for/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_draft () {
|
||||||
|
git push origin HEAD:refs/drafts/$1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_reset {
|
||||||
|
git reset --hard origin/master;
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_pull () {
|
||||||
|
#git pull --rebase origin $1;
|
||||||
|
git fetch;
|
||||||
|
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";
|
||||||
|
[ "$1" = "draft" ] && gerrit_draft "master";
|
||||||
|
[ "$1" = "rebase" ] && gerrit_pull "master";
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_clone () {
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "$yellow Please supply the name of a repo to clone. $stop"
|
||||||
|
else
|
||||||
|
if [[ -n $(which gg-gerrit-clone) ]]; then
|
||||||
|
gg-gerrit-clone "$1"
|
||||||
|
else
|
||||||
|
git clone --recursive ssh://gerrit_host/$1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit_setup () {
|
||||||
|
if [ -d /web/tools/bin/install-hooks ]; then
|
||||||
|
# install hooks
|
||||||
|
/web/tools/bin/install-hooks;
|
||||||
|
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo "$green Gerrit hook installed. $stop";
|
||||||
|
else
|
||||||
|
echo "$red Couldn't install Gerrit hook. $stop";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gerrit () {
|
||||||
|
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null);
|
||||||
|
branch=${ref#refs/heads/};
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
gerrit_usage;
|
||||||
|
else
|
||||||
|
[ "$1" = "patch" ] && gerrit_patch "$2"
|
||||||
|
[ "$1" = "push" ] && gerrit_push "$branch";
|
||||||
|
[ "$1" = "review" ] && gerrit_review "$branch";
|
||||||
|
[ "$1" = "reset" ] && gerrit_reset;
|
||||||
|
[ "$1" = "draft" ] && gerrit_draft "$branch";
|
||||||
|
[ "$1" = "pull" ] && gerrit_pull "$branch";
|
||||||
|
[ "$1" = "clone" ] && gerrit_clone "$2";
|
||||||
|
[ "$1" = "setup" ] && gerrit_setup;
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue