JIRA Subversion Plugin link to jira issue is not accepted :(

Hi,
Plugin requires that in svn 'log message' commiter insert Jira Key e.g. TST-20.
But more obvious should be inserting link to jira issue e.g https://jira.company.pl/browse/TST-20 (it is faster to copy-paste from browser than typing key) but is not accepted by jira-svn plugin.

We think about adding post-commit hook to svn that modify "log message" but maybe there is better way to do it?

Regards
Michał

2 answers

1 accepted

No better ways. In fact having just the key is better as it shortens the commit message and also helps not to tie down the commit to a JIRA server.

I guess pre-commit is the only way.

We add post commit tha add key to log_message using link and we modify log_message using svnadmin.

find_jira_key(){
perl -e '
        $org_str = $ARGV[0];
        $out_str = $org_str;
        if ($org_str =~ m/(https\:\/\/<your http jira address>\:[0-9]*\/browse\/[A-Z]*\-[0-9]*)/) {
                $jira_str = $1;
                if( $jira_str =~ m/([A-Z]*\-\d+)/) {
                        $jira_key = $1;
                        if ( !($org_str =~ m/(?<!\/)$jira_key / ) ) {
                                $out_str = $org_str;
                                $out_str =~ s/$jira_str/$jira_key ($jira_str)/;
                        }
                }
        }
        print $out_str;
' "$@"
}
SVN_LOG=`svnlook -r $REV log $REPOS`
TEMP_FILE=`mktemp /tmp/svn_tmp_XXXXX`

find_jira_key(){
perl -e '
        $org_str = $ARGV[0];
        $out_str = $org_str;
        if ($org_str =~ m/(https\:\/\/jira\.datera\.pl\:[0-9]*\/browse\/[A-Z]*\-[0-9]*)/) {
                # Znalazl link do jiry
                $jira_str = $1;
                if( $jira_str =~ m/([A-Z]*\-\d+)/) {
                        # znalazl jira key
                        $jira_key = $1;
                        # Sprawdza czy przypadkiem juz nie ma klucza w log message
                        if ( !($org_str =~ m/(?<!\/)$jira_key / ) ) {
                                # nie znalazl juz samego klucza w stringu wstawiam
                                $out_str = $org_str;
                                $out_str =~ s/$jira_str/$jira_key ($jira_str)/;
                        }
                }
        }
        print $out_str;
' "$@"
}
SVN_LOG=`svnlook -r $REV log $REPOS`
TEMP_FILE=`mktemp /tmp/svn_tmp_XXXXX`

We added such script after commit/changing log_message

find_jira_key(){ perl -e ' $org_str = $ARGV[0]; $out_str = $org_str; if ($org_str =~ m/(https\:\/\/<your http jira address>\:[0-9]*\/browse\/[A-Z]*\-[0-9]*)/) { $jira_str = $1; if( $jira_str =~ m/([A-Z]*\-\d+)/) { $jira_key = $1; if ( !($org_str =~ m/(?<!\/)$jira_key / ) ) { $out_str = $org_str; $out_str =~ s/$jira_str/$jira_key ($jira_str)/; } } } print $out_str; ' "$@" } SVN_LOG=`svnlook -r $REV log $REPOS` TEMP_FILE=`mktemp /tmp/svn_tmp_XXXXX`

We added such script after commit/changing log_message
find_jira_key(){
perl -e '
        $org_str = $ARGV[0];
        $out_str = $org_str;
        if ($org_str =~ m/(https\:\/\/&lt;your http jira address&gt;\:[0-9]*\/browse\/[A-Z]*\-[0-9]*)/) {
                $jira_str = $1;
                if( $jira_str =~ m/([A-Z]*\-\d+)/) {
                        $jira_key = $1;
                        if ( !($org_str =~ m/(?&lt;!\/)$jira_key / ) ) {
                                $out_str = $org_str;
                                $out_str =~ s/$jira_str/$jira_key ($jira_str)/;
                        }
                }
        }
        print $out_str;
' "$@"
}
SVN_LOG=`svnlook -r $REV log $REPOS`
TEMP_FILE=`mktemp /tmp/svn_tmp_XXXXX`


					
				
			
			
			
				
2 votes

You can set the system property jira.option.ignore.url.with.key then it will work with the full url - this is what we've been using for years. https://jira.atlassian.com/browse/JRA-12032

Set that <jira-home>/jira-config.properties.

are you sure that URL will be interpreted by SVN plugin as key?

Works fine for me. But perhaps I hacked something in the source... I've had to do a lot of hacking to that plugin over the years. Or maybe it's another property, I'll check when I'm in work tomorrow.

It does not work @REnijyh, I've tried it.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

175 views 0 4
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