Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial check-in of the script

  • Loading branch information...
commit 658aa714178c78cab59f162d238ba319f80f77a2 0 parents
@dalewking authored
Showing with 38 additions and 0 deletions.
  1. +23 −0 prepare-commit-msg
  2. +15 −0 xsl
23 prepare-commit-msg
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+token='enter pivotal tracker token'
+project=enter project number
+
+# Build new message in a tempfile
+tempfile=`mktemp pivotal-git-hook`
+
+# Copy the non-comment lines from the previous message
+# This is to support git commit --amend
+grep -v "^#" "$1" >> "$tempfile"
+
+# Get list of open stories from the current iteration
+# and turn them into comments
+curl -s -H "X-TrackerToken: ${token}" -X GET \
+ http://www.pivotaltracker.com/services/v3/projects/${project}/iterations/current \
+ | xsltproc `dirname ${0}`/xsl - >> "$tempfile"
+
+# Copy the comment lines from previous commit message
+grep "^#" "$1" >> "$tempfile"
+
+# Make our temp file the real thing
+mv "$tempfile" "$1"
15 xsl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text"/>
+<xsl:template match="/"># Here are unfinished stories from the current iteration.
+# Uncomment the line to associate with that story
+# If not finished, delete 'Fixes'
+#<xsl:for-each select="//story[current_state != 'delivered' and current_state != 'accepted']">
+#[Fixes #<xsl:value-of select="./id"/>] <xsl:value-of select="./name"/>
+
+</xsl:for-each>
+#
+</xsl:template>
+
+</xsl:stylesheet>
Please sign in to comment.
Something went wrong with that request. Please try again.