Skip to content

Instantly share code, notes, and snippets.

@Sanne
Last active September 26, 2015 10:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sanne/1086445 to your computer and use it in GitHub Desktop.
Save Sanne/1086445 to your computer and use it in GitHub Desktop.
Open JIRA from git branch
#!/bin/bash
# This script will look into the GIT commit log of the current directory, backwards since the branch
# from master, searching for references to JIRA issues of a set of known projects.
# It will then print URLs to all mentioned JIRA issues.
# Optionally (uncommnent one line) it could open all relevant issues in different tabs of a browser: this is useful
# in my workflow as I often want to comment and/or close the issues when merging work in upstream.
#
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
#
# Copyright (c) 2011 Sanne Grinovero
seeProjectIssues() {
BRANCHES=$(git log master.. --no-decorate | grep -o -E $PROJECTCODE-[0-9]+ | sort | uniq)
for ISSUE in $(echo $BRANCHES | tr ";" "\n")
do
echo " - $JIRA_SERVER/browse/$ISSUE"
#firefox -new-tab $JIRA_SERVER/browse/$ISSUE
done
}
JIRA_SERVER="https://hibernate.atlassian.net"
for PROJECTCODE in "HSEARCH" "HHH" "OGM" "BVAL" "BVTCK" "HCANN" "METAGEN" "JPA" "ANN" "EJB"
do
seeProjectIssues
done
JIRA_SERVER="https://issues.jboss.org"
for PROJECTCODE in "ISPN" "JGRP"
do
seeProjectIssues
done
JIRA_SERVER="https://issues.apache.org/jira"
for PROJECTCODE in "LUCENE" "SOLR"
do
seeProjectIssues
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment