Restricting Subversion commits if the Jira Issue key is Not in the commit message

I am using SVN for revision control and atlassian JIRA as the issue tracker for my LAMP website. I want to restrict SVN commit if any of my team member commits without mentioning the Jira Issue key for the same. I am using JIRA standalone and have installed it on my server. Google search gave me Subversion Jira Plugin ( but it can only help me out in tracking the commits that had a JIRA key, not in restricting them.

Please let me know, if I should post any more specifics about the issue.


2 answers

This widget could not be displayed.

Hi Snehal

You will have to write pre-commit hook in SVN to check if the comment has the JIRA key. You can additionally verify if the JIRA key is valid and is not closed. Here is extract from my pre-commit hook.

#Check first line contains JiraId
        firstline =lines[0].lstrip()
        if  firstline.find(":")==-1:
        prefix= firstline.split(":")[0]
        if prefix.strip()=="":

        jiraIDpattern = re.compile(r"(\A[A-Z]{2,}-\d+)")
        for rawID in IDs:
            if not result:
                sys.stderr.write("\n '"+ID+"' is not a valid JIRA issue ID")

        if invalidMessage:

		#Check JIRA is up
            soap = SOAPpy.WSDL.Proxy(jiraWSDL)
            auth = soap.login(jirauser, jirapasswd)
        except Exception, err:
            # If JIRA is down then except commit message as is.
            sendMail(firstline + " " + author )

        #Check JIRA issues exist
        for rawID in IDs:
                issue = soap.getIssue(auth, issueid)
            except SOAPpy.faultType,e :
                #issue does not exist
                soapError = issueid+": "+ str(e)
                sys.stderr.write("\n"+ issueid + " does not exist in JIRA")
                #Check JIRA status is not closed
                if int(issue.status) == 6:
                    sys.stderr.write("\nYou cannot commit against "+issueid+ " as it is in a resolved state (CLOSED) ! ")
        if invalidJIRAissue:

Here user is required to put the commit message in format "JIRA-1234 : <message goes here>"


Hi Vijay, thanks for the suggestion and the code! Sounds good and probably better than using a not really supported 3rd-party-plugin.

Let me note that you are relying on the SOAP API in your code, which will be removed in JIRA 7.

This widget could not be displayed.

Use the Commit Policy Plugin.

Learn more about the Subversion-specific parts and use this recipe. If you want to limit which issues you allow to commit against, then also use these recipes.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

46 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you