Skip to content

Instantly share code, notes, and snippets.

@barberj
Created December 6, 2012 14:29
Show Gist options
  • Save barberj/4224818 to your computer and use it in GitHub Desktop.
Save barberj/4224818 to your computer and use it in GitHub Desktop.
.forgitrc file providing Pictage Specific prune hook
#!/usr/bin/python
def prune_hook(branch):
import requests
import re
match = re.match('sq-([0-9]+).*', branch)
if not match:
print('Unable to find jira ticket for branch {}'.format(branch))
return False
ticket_num = match.groups()[0]
rsp = requests.get('https://jira.pictage.com/browse/SQ-{}'.format(ticket_num), verify=False)
if rsp.status_code != 200:
print('{} response from jira while requesting status for SQ-{}'.format(rsp.status_code, ticket_num))
return False
if 'Closed - The issue is considered finished' in rsp.text:
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment