# Put in post process deployment script

# shows the latest change and identifies the line that changes
# very simplistic assumptions, will need to handle more cases

import subprocess
import json

res = subprocess.check_output(["git", "show"])
#print res
lines = res.splitlines()
#print lines
line_changed = ""

#look for line with +\t which determines which lines was added
for line in lines:
	if (("+\t" in line) and ("FeatureId" in line)):
		line_changed = line
		#print "Line added : " + line

# strip out extra characters
parsed_line = line_changed.replace("+\t","",1)
#print parsed_line

# can now access every field
try:
	json_parsed = json.loads(parsed_line) 
	print json_parsed['FeatureId']
except:
	print "Error parsing JSON!"
# use JIRA API to update page