diff -u -r mantis-1.0.7/config_defaults_inc.php mantis-1.0.7_mine/config_defaults_inc.php --- mantis-1.0.7/config_defaults_inc.php 2007-04-01 10:09:32.000000000 +0200 +++ mantis-1.0.7_mine/config_defaults_inc.php 2007-08-27 17:08:48.000000000 +0200 @@ -1071,6 +1071,24 @@ # eg: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mantisbt/mantisbt/ $g_cvs_web = ''; + # --- SVN linking --------------- + # Converts SVN filenames into URLs pointing to your WebSVN server + # (e.g.: 'SVN:513:trunk/myproject/readme.txt') + # + # insert the URL to your WebSVN server + # eg: http://www.mydomain.org/WebSVN/ + # (include trailing slash, no php filename) + $g_svn_web = ''; + + # the WebSVN name of the repository + # (WebSVNs $config->addRepository()) + $g_svn_web_repname = ''; + + # when showing a file, WebSVN can either display + # a diff with the previous version (ON) or + # the whole file contents (OFF). + $g_svn_web_showdiff = ON; + # --- Source Control Integration ------ # For open source projects it is expected that the notes be public, however, Only in mantis-1.0.7: config_inc.php.sample diff -u -r mantis-1.0.7/core/string_api.php mantis-1.0.7_mine/core/string_api.php --- mantis-1.0.7/core/string_api.php 2007-03-06 08:00:33.000000000 +0100 +++ mantis-1.0.7_mine/core/string_api.php 2007-08-27 17:06:40.000000000 +0200 @@ -101,6 +101,7 @@ $p_string = string_process_bug_link( $p_string ); $p_string = string_process_bugnote_link( $p_string ); $p_string = string_process_cvs_link( $p_string ); + $p_string = string_process_svn_link( $p_string ); return $p_string; } @@ -120,6 +121,7 @@ $t_string = string_process_bug_link( $t_string, /* anchor */ true, /* detailInfo */ false, /* fqdn */ true ); $t_string = string_process_bugnote_link( $t_string, /* anchor */ true, /* detailInfo */ false, /* fqdn */ true ); $t_string = string_process_cvs_link( $t_string ); + $t_string = string_process_svn_link( $t_string ); # another escaping to escape the special characters created by the generated links $t_string = string_html_specialchars( $t_string ); @@ -143,6 +145,7 @@ $p_string = string_process_bug_link( $p_string, false ); $p_string = string_process_bugnote_link( $p_string, false ); $p_string = string_process_cvs_link( $p_string, false ); + $p_string = string_process_svn_link( $p_string, false ); return $p_string; } @@ -231,6 +234,51 @@ } # -------------------- + # process the $p_string and convert filenames in the formats + # SVN:rev:U full/path/filename.ext + # SVN:rev:full/path/filename.ext + # SVN:rev: + # into URLs pointing to the WebSVN server. + # 'rev' is the revision number. + # 'U full/path/filename.ext' is the output format + # of 'svnlook changed'. + # + # if $p_include_anchor is true, include an tag, + # otherwise, just insert the URL as text + function string_process_svn_link( $p_string, $p_include_anchor=true ) { + $t_string = $p_string; + $t_svn_web = config_get( 'svn_web' ); + $t_svn_web_repname = config_get( 'svn_web_repname' ); + $t_svn_web_showdiff = config_get( 'svn_web_showdiff' ); + $t_svn_web_file_page = $t_svn_web_showdiff ? "diff.php" : "filedetails.php"; + + $t_status['A '] = 'added: '; + $t_status['D '] = 'deleted: '; + $t_status['U '] = 'modified: '; + $t_status['_U'] = 'props: '; + $t_status['UU'] = 'mod+prop: '; + + if ( $p_include_anchor ) { + $t_file_replace_with = "\$t_status['\\2'].'\\3'"; + $t_rev_replace_with = 'Revision: \\1'; + } else { + $t_file_replace_with = "\$t_status['\\2'].': \\3 - '.\$t_svn_web.\$t_svn_web_file_page.'?repname='.\$t_svn_web_repname.'&sc=1&path='.urlencode('/\\3').'&rev=\\1'"; + $t_rev_replace_with = 'Revision: \\1 - '.$t_svn_web.'listing.php?repname='.$t_svn_web_repname.'&sc=1&path=%2F&rev=\\1'; + } + # files + $t_string = preg_replace( '/SVN:(\\d+):([\\w\\s]{2})\\s{5}((?:[\/\w\.]+)+)/e', + $t_file_replace_with, + $t_string ); + $t_string = preg_replace( '/SVN:(\\d+):()((?:[\/\w\.]+)+)/e', + $t_file_replace_with, + $t_string ); + # revisions + $t_string = preg_replace( '/SVN:(\\d+):/', + $t_rev_replace_with, + $t_string ); + return $t_string; + } + # -------------------- # Process $p_string, looking for bug ID references and creating bug view # links for them. #