corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 #!/bin/sh
2  
3 # Script to open a browser to current branch
4 # Repo formats:
5 # ssh git@github.com:richo/gh_pr.git
6 # http https://richoH@github.com/richo/gh_pr.git
7 # git git://github.com/richo/gh_pr.git
8  
9 username=`git config --get github.user`
10  
11 get_repo() {
12 git remote -v | grep ${@:-$username} | while read remote; do
13 if repo=`echo $remote | grep -E -o "git@github.com:[^ ]*"`; then
14 echo $repo | sed -e "s/^git@github\.com://" -e "s/\.git$//"
15 exit 1
16 fi
17 if repo=`echo $remote | grep -E -o "https?://([^@]*@)?github.com/[^ ]*\.git"`; then
18 echo $repo | sed -e "s|^https?://||" -e "s/^.*github\.com\///" -e "s/\.git$//"
19 exit 1
20 fi
21 if repo=`echo $remote | grep -E -o "git://github.com/[^ ]*\.git"`; then
22 echo $repo | sed -e "s|^git://github.com/||" -e "s/\.git$//"
23 exit 1
24 fi
25 done
26  
27 if [ $? -eq 0 ]; then
28 echo "Couldn't find a valid remote" >&2
29 exit 1
30 fi
31 }
32  
33 echo ${#x[@]}
34  
35 if repo=`get_repo $@`; then
36 branch=`git symbolic-ref HEAD 2>/dev/null`
37 echo "http://github.com/$repo/pull/new/${branch##refs/heads/}"
38 else
39 exit 1
40 fi