View Issue Details

IDProjectCategoryView StatusLast Update
0008070mantisbtbugtrackerpublic2014-06-16 14:56
ReportermarcAssigned Todregad 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionwon't fix 
Product Version1.0.7 
Target VersionFixed in Version 
Summary0008070: Support for WebSVN
Description

I added support for WebSVN (http://websvn.tigris.org).

Currently it converts text of the form
SVN:143:trunk/myproject/readme.txt
into a URL pointing to your WebSVN installation, showing you the diff between revision 143 of that file and the previous version.

Patch attached.

Additional Information

--- 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-06-15 16:16:02.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 <a href="..."> 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'].'<a href=\"'.\$t_svn_web.'/'.\$t_svn_web_file_page.'?repname='.\$t_svn_web_repname.'&sc=1&path='.urlencode('/\3').'&rev=\1\" target=\"_blank\">\3</a>'";
  • $t_rev_replace_with = 'Revision: '.$t_svn_web.'/listing.php?repname='.$t_svn_web_repname.'&sc=1&path=%2F&rev=\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.
    #

    --- 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-06-15 16:37:32.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

  • (no 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 (true) or

  • the whole file contents (false).

  • $g_svn_web_showdiff = true;
  • # --- Source Control Integration ------
    
    # For open source projects it is expected that the notes be public, however,
TagsNo tags attached.

Relationships

Activities

2007-06-15 11:32

 

post-commit (347 bytes)
marc

marc

2007-06-15 11:34

reporter   ~0014766

added an example subversion commit hook, which generates issues in the required format.

This belongs into the 'hooks' directory of your SVN repository

vboctor

vboctor

2007-06-20 20:37

manager   ~0014783

Looks good. Following are some comments:

I would change this to require a trailing slash. This a standard requirement for similar configurations.

  • the WebSVN name of the repository

  • (WebSVNs $config->addRepository())

  • $g_svn_web_repname = '';

The comment here doesn't tell me what needs to be assigned to this configuration option.

  • when showing a file, WebSVN can either display

  • a diff with the previous version (true) or

  • the whole file contents (false).

  • $g_svn_web_showdiff = true;

Use ON/OFF (without quotations) rather than true and false.

It would be nice if you can upload an updated patch as an attachment. I'll then clear the old from from Additional Information field.

2007-08-27 11:18

 

websvn_support.patch (4,737 bytes)
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 <a href="..."> 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'].'<a href=\"'.\$t_svn_web.\$t_svn_web_file_page.'?repname='.\$t_svn_web_repname.'&sc=1&path='.urlencode('/\\3').'&rev=\\1\" target=\"_blank\">\\3</a>'";
+            $t_rev_replace_with  = 'Revision: <a href="'.$t_svn_web.'listing.php?repname='.$t_svn_web_repname.'&sc=1&path=%2F&rev=\\1" target="_blank">\\1</a>';
+        } 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.
 	#
websvn_support.patch (4,737 bytes)
marc

marc

2007-08-27 11:25

reporter   ~0015538

Oops, never noticed that comment till now...

I just uploaded the adjusted patch. Regarding the g_svn_web_repname question, that is a setting in WebSVN. One WebSVN installation can handle multiple SVN repositories, and this option tells Mantis which one to use.

marc

marc

2007-08-27 11:40

reporter   ~0015539

I guess a little bit more of an explanation would be in order:

When I commit my changes into the SVN repository, I can use a comment like this:
"adjusted my patch for bug #0008070"

That comment will then be added to the issue 8070 in Mantis as a Bug Note. This is done by the post-commit file I attached here.

The post-commit in addition to adding the commit comment also queries the SVN repository for the list of files changed by my commit, and attaches that list in a special format to the Bug Note.

Now my patch here parses that format, and for display converts it into clickable links, which will open WebSVN to display the diff for every single file or the complete commit.

2007-09-14 06:19

 

websvn_support2.patch (4,536 bytes)
diff -Naur 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,
diff -Naur 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-09-14 12:18:04.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,47 @@
 	}
 
 	# --------------------
+	# process the $p_string and convert filenames in the formats
+	#  SVN:rev:U   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 <a href="..."> 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'].'<a href=\"'.\$t_svn_web.\$t_svn_web_file_page.'?repname='.\$t_svn_web_repname.'&sc=1&path='.urlencode('/\\3').'&rev=\\1\" target=\"_blank\">\\3</a>'";
+            $t_rev_replace_with  = 'Revision: <a href="'.$t_svn_web.'listing.php?repname='.$t_svn_web_repname.'&sc=1&path=%2F&rev=\\1" target="_blank">\\1</a>';
+        } 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{2}([\/\w\.]+)/e',
+							 $t_file_replace_with,
+							 $t_string );
+        # revisions
+		$t_string = preg_replace( '/^SVN:Revision:\s*(\d+)/m',
+							 $t_rev_replace_with,
+							 $t_string );
+        return $t_string;
+	}
+	# --------------------
 	# Process $p_string, looking for bug ID references and creating bug view
 	#  links for them.
 	#
websvn_support2.patch (4,536 bytes)

2007-09-14 06:20

 

post-commit2 (352 bytes)
marc

marc

2007-09-14 06:22

reporter   ~0015637

Sorry, I just noticed that I uploaded some broken versions of the files. I just uploaded two new ones, post-commit2 and websvn_support2.patch.

I cannot delete the old files, could someone please do that, and also delete the Addtitional Info text.

Thanks.

jreese

jreese

2009-03-03 17:35

reporter   ~0020993

For anyone interested, in the development versions of 1.2.x, there is support for plugins; I've created a Source Integration plugin set that includes support for WebSVN.

http://leetcode.net/blog/2009/01/integrating-git-svn-with-mantisbt/

Cheers

ntherning

ntherning

2011-01-12 03:08

reporter  

WebSVN.zip (3,646 bytes)
swkim

swkim

2011-01-12 03:13

reporter   ~0027907

.

ntherning

ntherning

2011-01-12 03:14

reporter   ~0027908

I used to use the original patch but after I upgraded to 1.2.x I'm not sure it works anymore. Moving to the new source integration plugins doesn't help me since I have lots of old commit logs in my bugs which won't get nice links to WebSVN anymore. So I made a 1.2.x plugin which does exactly what the patch used to do and it seems to work very well for me. Configuration is now done using the UI! You will find it attached (WebSVN.zip).

dregad

dregad

2014-06-04 18:23

developer   ~0040741

WebSVN is covered by the Source Integration plugin https://github.com/mantisbt-plugins/source-integration

Since the built-in source control will be removed in Mantis 1.3, I'm resolving this as won't fix.

Issue History

Date Modified Username Field Change
2007-06-15 11:31 marc New Issue
2007-06-15 11:32 marc File Added: post-commit
2007-06-15 11:34 marc Note Added: 0014766
2007-06-20 20:37 vboctor Note Added: 0014783
2007-06-20 20:37 vboctor Status new => acknowledged
2007-08-27 11:18 marc File Added: websvn_support.patch
2007-08-27 11:25 marc Note Added: 0015538
2007-08-27 11:40 marc Note Added: 0015539
2007-09-14 06:19 marc File Added: websvn_support2.patch
2007-09-14 06:20 marc File Added: post-commit2
2007-09-14 06:22 marc Note Added: 0015637
2009-03-03 17:35 jreese Note Added: 0020993
2011-01-12 03:08 ntherning File Added: WebSVN.zip
2011-01-12 03:13 swkim Note Added: 0027907
2011-01-12 03:14 ntherning Note Added: 0027908
2014-06-04 18:23 dregad Note Added: 0040741
2014-06-04 18:23 dregad Status acknowledged => resolved
2014-06-04 18:23 dregad Resolution open => won't fix
2014-06-04 18:23 dregad Assigned To => dregad
2014-06-16 14:56 atrol Status resolved => closed