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

Maciej Krajewski January 17, 2013

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

0 votes
Answer accepted
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2013

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.

Maciej Krajewski January 17, 2013

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

Maciej Krajewski January 23, 2013
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`

Maciej Krajewski January 23, 2013
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`

Maciej Krajewski January 23, 2013
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`

Maciej Krajewski January 23, 2013
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
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2013

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.

Maciej Krajewski January 23, 2013

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

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2013

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.

Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2013
Maciej Krajewski January 29, 2013

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events