Skip to content

Commit

Permalink
initial checkin for fancy script
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawrence Chin committed Oct 29, 2012
1 parent 9201a91 commit 7c881a3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*~
37 changes: 37 additions & 0 deletions jira-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash


#
# Helper function that I found in the internet
#
is_installed() {
PROGRAM=$1
PATHNAME=$( type $PROGRAM 2> /dev/null )
if [ -z "$PATHNAME" ]; then
echo "cannot locate $PROGRAM in path"
exit 1
fi
}

#
# Checks whether jira cli is installed.
#
is_installed jira.sh

#
# 'jira-setting' file must exists in $HOME/.hg
# look at README
#
source $HOME/.hg/jira-settings
SUBJECT="$HG_NODE"
COMMENTS=`hg log -r $HG_NODE`
JIRA_ISSUE=`hg log -r $HG_NODE | grep -i 'summary: ' | awk -F ' ' '{ c=1; while(c < 5) { if(match($c,"BUG:")){print $c;} c++;}}' | awk -F ':' '{print $2}' `
if [ -z "$JIRA_ISSUE" ]; then
echo "WARNING:No bug in comment '$JIRA_ISSUE'"
exit
else
echo "INFO:JIRA_ISSUE='$JIRA_ISSUE'"
fi
echo $COMMENTS | jira.sh --server $JIRA_HOST --action addComment --issue $JIRA_ISSUE --user $JIRA_USERNAME --password $JIRA_PASSWORD -v -f -

exit

0 comments on commit 7c881a3

Please sign in to comment.