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

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.

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
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

976 views 3 9
Read article

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