-
-
Save mythmon/5198536 to your computer and use it in GitHub Desktop.
Revisions
-
mythmon revised this gist
Mar 19, 2013 . 1 changed file with 30 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,25 +5,43 @@ # * prints out the log message # * opens the bugzilla page if it found a bug number # # Assumes that the canonical remote is named upstream. # Works on Linux function gh_remote_url() { name=$1 remote_line=$(git remote -v | grep push | grep $name) if [[ -z $remote_line ]]; then echo "Error: remote '$name' not found." exit 1 fi if [[ ! $(echo $remote_line | grep github) ]]; then echo "Error: $name is not on github!" exit 1 fi repo=$(echo $remote_line | sed 's/.*github.com[:\/]\([^ ]*\) .*/\1/' | sed 's/\.git//') echo "https://github.com/$repo" } REV=${1-HEAD} ROOT=$(gh_remote_url upstream) BUGZILLA='https://bugzilla.mozilla.org/show_bug.cgi?id=' HASH=$(git rev-parse $REV) MSG=$(git log --pretty=oneline --format=%s -1 $HASH) BUG=$(echo $MSG | grep -i 'bug [0-9]\+' | sed 's/.*bug \([0-9]\+\).*/\1/i') echo $ROOT/$HASH | xclip echo $MSG # Open the browser if we found a bug number. if [[ $BUG ]]; then xdg-open "${BUGZILLA}${BUG}#comment" > /dev/null fi -
rlr created this gist
Mar 19, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/sh # Usage: `git url` or `git url <commitish>` # # * copies the commit's github url to your clipboard # * prints out the log message # * opens the bugzilla page if it found a bug number # # Set up the github url with `git config github.url <url>`. # Only for the Mac. if [[ $1 ]]; then REV=$1 else REV='HEAD' fi ROOT=$(git config github.url) BUGZILLA='https://bugzilla.mozilla.org/show_bug.cgi?id=' HASH=$(git rev-parse --short $REV) MSG=$(git log --pretty=oneline --format=%s -1 $HASH) BUG=$(echo $MSG | ack -i 'bug (\d+)' --output='$1') echo $ROOT/$HASH | pbcopy echo $MSG # Open the browser if we found a bug number. if [[ $BUG ]]; then open $BUGZILLA$BUG fi