From e0d4e48bda820cbb0f81c86af2e522ade5b449d0 Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Sat, 15 Sep 2012 18:09:58 +0300 Subject: [PATCH 1/2] Added to github plugin function to send pull requests from current branch. added alias and added rule to ignore idea files. --- .gitignore | 1 + plugins/github/github.plugin.zsh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/.gitignore b/.gitignore index 51a5ee6c3..49a3688fa 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ custom/* *.swp !custom/example.zshcache cache/ +.idea \ No newline at end of file diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 197e86a48..7bae3e2c8 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -66,5 +66,33 @@ exist_gh() { # [DIRECTORY] git push -u origin master } +# If your branch named like [issue_number]_some_description +gh_issue() { + local ghissue + ghissue=`echo $(current_branch) | sed -e 's/\([0-9]*\).*/\1/'` + if [ $ghissue ]; then + echo "$ghissue" + fi +} + +pull_request() { + local organization + if [ $1 ]; then + organization=$1 + else + organization=$( git config --get remote.origin.url | sed "s/^[^:]*:\([^\/]*\)\/.*/\1/" ) + fi + + if [ $(gh_issue) ]; then + issue="-i $(gh_issue)" + else + issue="" + fi + + echo "hub pull-request $issue -b $organization:master -h $organization:$(current_branch)" + hub pull-request $issue -b $organization:master -h $organization:$(current_branch) +} + # End Functions ############################################################# +alias gpr="pull_request" From b83316cfe5944fa50eea37d395b35a421dabd1b7 Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Mon, 17 Sep 2012 22:58:04 +0300 Subject: [PATCH 2/2] Fixed bug in sending pr for github. --- plugins/github/github.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 7bae3e2c8..47fd04094 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -89,8 +89,8 @@ pull_request() { issue="" fi - echo "hub pull-request $issue -b $organization:master -h $organization:$(current_branch)" - hub pull-request $issue -b $organization:master -h $organization:$(current_branch) + echo "hub pull-request $(echo $issue) -b $organization:master -h $organization:$(current_branch)" + hub pull-request $(echo $issue) -b $organization:master -h $organization:$(current_branch) } # End Functions #############################################################