View Issue Details

IDProjectCategoryView StatusLast Update
0003371mantisbtfeaturepublic2004-08-29 02:03
Reporterleus Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Fixed in Version0.19.0rc1 
Summary0003371: CVS Integration (patch included)
Description

Hi, this is a small patch for CVS integration (and cvsweb)

TagsNo tags attached.
Attached Files
mantis_cvs.tar.gz (2,480 bytes)
diff.txt (2,593 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.130
diff -r1.130 config_defaults_inc.php
1007a1008,1013
> 
> 	#########
> 	# CVS Integration
> 	#########
> 	$g_cvs_integration = 'ON';
> 	$g_cvs_url = 'http://localhost/cgi-bin/cvsweb.cgi/';
Index: core/constant_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v
retrieving revision 1.7
diff -r1.7 constant_inc.php
135a136
> 	define( 'CVS_CHECKIN',					15 );
Index: core/history_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/history_api.php,v
retrieving revision 1.16
diff -r1.16 history_api.php
234a235,237
> 				case CVS_CHECKIN:
> 					$t_note = lang_get( 'cvs_checkin' );
> 					break;
249,252c252,253
< 			if ( NORMAL_TYPE != $v_type ) {
< 				$history[$i]['note'] = $t_note;
< 				$history[$i]['change'] = '';
< 			} else {   # output normal changes
---
> 			switch( $v_type ) {
> 			case NORMAL_TYPE:   # output normal changes
255c256,283
< 			} # end if DEFAULT
---
> 				break;
> 			case CVS_CHECKIN:
> 				$history[$i]['note'] = $t_note;
> 				if (config_get('cvs_integration') == 'ON') {
> 					# This works with cvsweb only
> 					$history[$i]['change'] = 
> 						'<a href="'
> 						. config_get('cvs_url')
> 						. $v_old_value
> 						. '/?rev='
> 						. $v_new_value
> 						.  '&content-type=text/x-cvsweb-markup'
> 						. '">'
> 						. $v_old_value . ' '
> 						. $v_new_value
> 						. '</a>';
> 				} else {
>                                         $history[$i]['change'] =
>                                                 $v_old_value . ' '
>                                                 . $v_new_value;
> 				}
> 				break;
> 			default:
> 				$history[$i]['note'] = $t_note;
> 				$history[$i]['change'] = '';
> 				break;
> 			
> 			}
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.144
diff -r1.144 strings_english.txt
32a33,34
> $s_cvs_checkin = 'CVS Checkin';
> 
Index: lang/strings_spanish.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_spanish.txt,v
retrieving revision 1.56
diff -r1.56 strings_spanish.txt
32a33
> $s_cvs_checkin = 'CVS Checkin';
865c866
< ?>
\ No newline at end of file
---
> ?>
diff.txt (2,593 bytes)   
instructions.txt (1,301 bytes)   
mantis_cvs

This perl script allows you to add cvs information to your bugs. Every
time you commit a change that affects some bug that is reported to
mantis, you can add to your commit message the bug that this change affects.


EXAMPLE

Let's suppose you have a bug, Bug 123. Some developer fixes this bug, and
is about to commit it to the CVS repository. He can commit like this:

	cvs commit -m "Fix to error reported in Bug 123"
	
This script will parse the commit message and add a history entry
to the bug 123.


INSTALLATION

1) You need Mail::Sender to send email. Remove the "use" line if you
   don't want to get nagged every time a checkin for a bug is issued.
2) Checkout your CVSROOT module

        cvs checkout CVSROOT

3) Add mantis_cvs to your CVSROOT module:

        cp mantis_cvs CVSROOT
        cvs add CVSROOT/mantis_cvs

4) Modify the CVSROOT/loginfo file, add the following line:

        ALL perl -s $CVSROOT/CVSROOT/mantis_cvs %{sv}

5) Commit your changes and release the module

        cvs commit CVSROOT
        cvs release -d CVSROOT

6) To register a checkout, just add in your comment the bug that this 
   commit applies for, for example, "Fix to Bug 123" (case insensitive)
   

Leonardo Herrera
mailto:leus@epublish.cl
instructions.txt (1,301 bytes)   
mantis_cvs.pl.txt (4,150 bytes)   
#!/usr/bin/perl
###################################################################
# mantis_cvs
# Basic CVS Integration with Mantis Bug Tracker
# Author: Leonardo Herrera (leus@epublish.cl)
###################################################################
  use strict;
  use DBI();
  use Mail::Sender;


# CONFIGURATION SECTION

my $mantis_dbserver = 'localhost';
my $mantis_username = 'root';
my $mantis_password = '';
my $mantis_database = 'bugtracker';

# Define this if you want basic email support.
# Note: this is just a simple way to nag people about new checkins in
# some bugs. It doesn't attemp (yet) to determine to whom really send
# email, for example, people monitoring this bug.

my $smtp	= undef; # Example: 'smtp.mydomain.com'
my $smtp_from	= undef; # Example: 'user@mydomain.com'
my $mail_to	= undef; # Example: 'usera@domain.com'

# This variable defines who is reporting this checkin. Use
# a generic user, example, "cvsman". "administrator" is okay.
my $default_reporter_name	= 'administrator';

# This is the URL where your Mantis Bug Tracker is located. Include
# full query string for prefixing to a bug number
my $base_url	 	= 'http://127.0.0.1/mantisbt/bug_view_page.php?bug_id=';

# See "constants_inc.php" for this value.
my $CVS_CHECKIN = 15;

# This regex will find ocurrences of the word "bug" followed by a number.
my $bugregex = qr/\bbug (\d+)\b/;

# END CONFIGURATION SECTION.

##########################################################################
sub send_email {
	my %bugs = @_;

	my $sender = new Mail::Sender {
		smtp => $smtp, 
		from => $smtp_from,
		on_errors => undef,
	} or return;
	$sender->Open({
		to => $mail_to,
		subject => "Mantis: New checkins for bugs " . join ",", keys %bugs
	}) or return;

	foreach my $bug_id (keys %bugs) {
		$sender->SendLineEnc( "\t$bug_id: $base_url$bugs{$bug_id}" );
	}

	$sender->SendLineEnc( "\n" . localtime() . "\n" );
	$sender->Close() or return;
}
##########################################################################
sub registerCheckIn() {
	# Register the event into the historic table.
	my $dbh = shift;
	my $bug_id = shift;
	my $reporter_id = shift;
	my $file = $dbh->quote( shift );
	my $newv = $dbh->quote( shift );
	
	$dbh->do( 
		"INSERT INTO mantis_bug_history_table ( user_id, bug_id, date_modified, type, old_value, new_value ) " .
		"VALUES ( $reporter_id, $bug_id, NOW(), $CVS_CHECKIN, $file, $newv)" );
}
##########################################################################
sub get_user_id()
{
	my $dbh = shift;
	my $reporter_name = shift;
	my $reporter_id = $dbh->quote( $reporter_name );
	my $sth = $dbh->prepare("SELECT * FROM mantis_user_table where username = '$reporter_name'" );
	$sth->execute();
	while (my $ref = $sth->fetchrow_hashref()) {
		$reporter_id = $ref->{'id'};
	}
	$sth->finish();

	die "Cannot obtain reporter id\n" if $reporter_id == -1;
	print "Reporter id: $reporter_id\n";

	return $reporter_id;
}
##########################################################################
sub process() {
	my $dbh = shift;
	my $reporter_id = shift;
	my $bug_id = shift;

	foreach ( @ARGV ) {
		my ($file,$newv) = split ",";
		&registerCheckIn( $dbh, $bug_id, $reporter_id, $file, $newv );
	}
}
##########################################################################
sub main() {
	my %bugs;

	while( <STDIN> ) {
		while ( /$bugregex/gi ) {
			print "Mentioning of bug $1 found.\n";
			$bugs{"Bug$1"} = $1;
		}
	}
	
	if (scalar keys %bugs) {
		print "Bug mentioning in commit log found.\n";

		my $dbh = DBI->connect("DBI:mysql:database=$mantis_database;host=$mantis_dbserver",
					 "$mantis_username", "$mantis_password",
					 {'RaiseError' => 1});
		die if !$dbh;
		my $reporter_id = &get_user_id( $dbh, $default_reporter_name );

		foreach (keys %bugs) {
			print "Adding informacion of $_...\n";
			&process( $dbh, $reporter_id, $bugs{$_} );
		}
		$dbh->disconnect();
		&send_email( %bugs );
	}
}
##########################################################################
&main;

mantis_cvs.pl.txt (4,150 bytes)   
Image1.gif (9,513 bytes)   
Image1.gif (9,513 bytes)   
source_control_integration.diff (12,242 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.183
diff -u -r1.183 config_defaults_inc.php
--- config_defaults_inc.php	25 Jul 2004 21:09:39 -0000	1.183
+++ config_defaults_inc.php	30 Jul 2004 12:28:35 -0000
@@ -53,9 +53,14 @@
 			$t_protocol = 'https';
 		}
 
-		$t_port = ':' . $_SERVER['SERVER_PORT'];
-		if ( ( ':80' == $t_port && 'http' == $t_protocol )
-		  || ( ':443' == $t_port && 'https' == $t_protocol )) {
+		# $_SERVER['SERVER_PORT'] is not defined in case of php-cgi.exe
+		if ( isset( $_SERVER['SERVER_PORT'] ) ) {
+			$t_port = ':' . $_SERVER['SERVER_PORT'];
+			if ( ( ':80' == $t_port && 'http' == $t_protocol )
+			  || ( ':443' == $t_port && 'https' == $t_protocol )) {
+				$t_port = '';
+			}
+		} else {
 			$t_port = '';
 		}
 
@@ -99,7 +104,11 @@
 	#############################
 
 	# Using Microsoft Internet Information Server (IIS)
-	$g_use_iis = ( strstr( $_SERVER['SERVER_SOFTWARE'], 'IIS' ) !== false ) ? ON : OFF;
+	if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { # SERVER_SOFTWARE not defined in case of php-cgi.exe
+		$g_use_iis = ( strstr( $_SERVER['SERVER_SOFTWARE'], 'IIS' ) !== false ) ? ON : OFF;
+	} else {
+		$g_use_iis = OFF;
+	}
 
 	#############################
 	# Mantis Email Settings
@@ -883,6 +892,26 @@
 	# insert the URL to your CVSweb or ViewCVS
 	# eg: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mantisbt/mantisbt/
 	$g_cvs_web				= '';
+	
+	# --- Source Control Integration ------
+	
+	# For open source projects it is expected that the notes be public, however,
+	# for non-open source it will probably be VS_PRIVATE.
+	$g_source_control_notes_view_status = VS_PRIVATE;
+
+	# Account to be used by the source control script.  The account must be enabled
+	# and must have the appropriate access level to add notes to all issues even
+	# private ones (DEVELOPER access recommended).
+	$g_source_control_account           = '';
+
+	# If set to a status, then after a checkin, the issue status is set to the 
+	# specified status, otherwise if set to OFF, the issue status is not affected.
+	$g_source_control_set_status_to     = OFF;
+
+	# Regular expression used to detect issue ids within checkin comments.
+	# see preg_match_all() documentation at
+	# http://www.php.net/manual/en/function.preg-match-all.php
+	$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";
 
 	# --- Bug Linking ---------------
 	# if a number follows this tag it will create a link to a bug.
Index: manage_user_delete.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_user_delete.php,v
retrieving revision 1.27
diff -u -r1.27 manage_user_delete.php
--- manage_user_delete.php	11 Jan 2004 07:16:07 -0000	1.27
+++ manage_user_delete.php	27 Jul 2004 13:58:53 -0000
@@ -20,7 +20,7 @@
 
 	user_delete( $f_user_id );
 
-    $t_redirect_url = 'manage_user_page.php';
+	$t_redirect_url = 'manage_user_page.php';
 
 	html_page_top1();
 
Index: core/authentication_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/authentication_api.php,v
retrieving revision 1.42
diff -u -r1.42 authentication_api.php
--- core/authentication_api.php	27 Jul 2004 14:24:57 -0000	1.42
+++ core/authentication_api.php	29 Jul 2004 14:15:28 -0000
@@ -11,6 +11,8 @@
 
 	### Authentication API ###
 
+	$g_script_login_cookie = null;
+
 	#===================================
 	# Boolean queries and ensures
 	#===================================
@@ -49,11 +51,7 @@
 	# Return true if there is a currently logged in and authenticated user,
 	#  false otherwise
 	function auth_is_user_authenticated() {
-		if ( is_blank( auth_get_current_user_cookie() ) ) {
-			return false;
-		} else {
-			return true;
-		}
+		return ( !is_blank( auth_get_current_user_cookie() ) );
 	}
 
 
@@ -126,12 +124,45 @@
 	}
 
 	# --------------------
+	# Allows scripts to login using a login name or ( login name + password )
+	function auth_attempt_script_login( $p_username, $p_password = null ) {
+		global $g_script_login_cookie;
+
+		$t_user_id = user_get_id_by_name( $p_username );
+
+		$t_user = user_get_row( $t_user_id );
+
+		# check for disabled account
+		if ( OFF == $t_user['enabled'] ) {
+			return false;
+		}
+
+		# validate password if supplied	
+		if ( null !== $p_password ) {
+			if ( !auth_does_password_match( $t_user_id, $p_password ) ) {
+				return false;
+			}
+		}
+
+		# ok, we're good to login now
+
+		# increment login count
+		user_increment_login_count( $t_user_id );
+
+		# set the cookies
+		$g_script_login_cookie = $t_user['cookie_string'];
+
+		return true;
+	}
+
+	# --------------------
 	# Logout the current user and remove any remaining cookies from their browser
 	# Returns true on success, false otherwise
 	function auth_logout() {
 		auth_clear_cookies();
 		helper_clear_pref_cookies();
 		filter_db_delete_current_filters();
+
 		return true;
 	}
 
@@ -238,6 +269,10 @@
 	# --------------------
 	# Clear login cookies
 	function auth_clear_cookies() {
+		global $g_script_login_cookie;
+
+		$g_script_login_cookie = null;
+
 		$t_cookie_name =  config_get( 'string_cookie' );
 		$t_cookie_path = config_get( 'cookie_path' );
 
@@ -291,19 +326,25 @@
 	# if no user is logged in and anonymous login is enabled, returns cookie for anonymous user
 	# otherwise returns '' (an empty string)
 	function auth_get_current_user_cookie() {
+		global $g_script_login_cookie;
+
 		$t_cookie_name = config_get( 'string_cookie' );
 		$t_cookie = gpc_get_cookie( $t_cookie_name, '' );
 
 		# if cookie not found, and anonymous login enabled, use cookie of anonymous account.
 		if ( is_blank( $t_cookie ) ) {
-			if ( ON == config_get( 'allow_anonymous_login' ) ) {
-				$query = sprintf('SELECT id, cookie_string FROM %s WHERE username = "%s"',
-						config_get( 'mantis_user_table' ), config_get( 'anonymous_account' ) );
-				$result = db_query( $query );
-
-				if ( 1 == db_num_rows( $result ) ) {
-					$row		= db_fetch_array( $result );
-					$t_cookie	= $row['cookie_string'];
+			if ( $g_script_login_cookie !== null ) {
+				return $g_script_login_cookie;
+			} else {
+				if ( ON == config_get( 'allow_anonymous_login' ) ) {
+					$query = sprintf('SELECT id, cookie_string FROM %s WHERE username = "%s"',
+							config_get( 'mantis_user_table' ), config_get( 'anonymous_account' ) );
+					$result = db_query( $query );
+
+					if ( 1 == db_num_rows( $result ) ) {
+						$row		= db_fetch_array( $result );
+						$t_cookie	= $row['cookie_string'];
+					}
 				}
 			}
 		}
Index: core/constant_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v
retrieving revision 1.24
diff -u -r1.24 constant_inc.php
--- core/constant_inc.php	25 Jul 2004 21:09:41 -0000	1.24
+++ core/constant_inc.php	30 Jul 2004 11:14:21 -0000
@@ -133,21 +133,18 @@
 	define( 'BUG_ADD_SPONSORSHIP',				15 );
 	define( 'BUG_UPDATE_SPONSORSHIP',			16 );
 	define( 'BUG_DELETE_SPONSORSHIP',			17 );
-	# MASC RELATIONSHIP
 	define( 'BUG_ADD_RELATIONSHIP', 		18 );
 	define( 'BUG_DEL_RELATIONSHIP', 		19 );
 	define( 'BUG_CLONED_TO', 				20 );
 	define( 'BUG_CREATED_FROM', 			21 );
-	# MASC RELATIONSHIP
+	define( 'CHECKIN',				22 );
 
 	# bug relationship constants
 	define( 'BUG_DUPLICATE',	0 );
 	define( 'BUG_RELATED',		1 );
 	define( 'BUG_DEPENDANT',	2 );
-	# MASC RELATIONSHIP
 	define( 'BUG_BLOCKS', 3 );
 	define( 'BUG_HAS_DUPLICATE', 4 );
-	# MASC RELATIONSHIP
 
 	# error messages
 	define( 'ERROR_GENERIC',						0 );
Index: core/custom_function_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/custom_function_api.php,v
retrieving revision 1.4
diff -u -r1.4 custom_function_api.php
--- core/custom_function_api.php	10 Jul 2004 23:29:49 -0000	1.4
+++ core/custom_function_api.php	30 Jul 2004 11:51:15 -0000
@@ -29,4 +29,20 @@
 		$t_bug = bug_get( $p_issue_id );
 		echo '- ', string_get_bug_view_link( $p_issue_id ), ': <b>[', $t_bug->category, ']</b> ', string_display( $t_bug->summary ), ' (', user_get_name( $t_bug->handler_id ), ')<br />';
 	}
+	
+	# --------------------
+	# Register a checkin in source control by adding a history entry and a note
+	# This can be overriden to do extra work like changing the issue status to 
+	# config_get( 'bug_readonly_status_threshold' );
+	function custom_function_default_checkin( $p_issue_id, $p_comment, $p_file, $p_new_version ) {
+		if ( bug_exists( $p_issue_id ) ) {
+			history_log_event_special( $p_issue_id, CHECKIN, $p_file, $p_new_version );
+			bugnote_add( $p_issue_id, $p_comment, VS_PRIVATE == config_get( 'source_control_notes_view_status' ) );
+
+			$t_status = config_get( 'source_control_set_status_to' );
+			if ( OFF != $t_status ) {
+				bug_set_field( $p_issue_id, 'status', $t_status );
+			}
+		}
+	}
 ?>
\ No newline at end of file
Index: core/history_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/history_api.php,v
retrieving revision 1.25
diff -u -r1.25 history_api.php
--- core/history_api.php	18 Jul 2004 09:58:29 -0000	1.25
+++ core/history_api.php	30 Jul 2004 12:14:12 -0000
@@ -302,7 +302,6 @@
 					$t_note = lang_get( 'sponsorship_deleted' );
 					$t_change = user_get_name( $p_old_value ) . ': ' . sponsorship_format_amount( $p_new_value );
 					break;
-				# MASC RELATIONSHIP
 				case BUG_ADD_RELATIONSHIP:
 					$t_note = lang_get( 'relationship_added' ) . ': ' . lang_get( 'bug' ) . ' ' . bug_format_id( $p_new_value );
 					break;
@@ -315,8 +314,9 @@
 				case BUG_CREATED_FROM:
 					$t_note = lang_get( 'bug_created_from' ) . ': ' . bug_format_id( $p_new_value );
 					break;
-				# MASC RELATIONSHIP
-
+				case CHECKIN:
+					$t_note = lang_get( 'checkin' );
+					break;
 			}
 		}
 
Index: core/html_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v
retrieving revision 1.113
diff -u -r1.113 html_api.php
--- core/html_api.php	24 Jul 2004 15:20:45 -0000	1.113
+++ core/html_api.php	24 Jul 2004 15:37:27 -0000
@@ -375,7 +375,7 @@
 
 		foreach( $t_custom_menu_options as $t_custom_option ) {
 			$t_access_level = $t_custom_option[1];
-			if ( access_has_project_level( $t_access_level ) ) {
+			if ( access_has_global_level( $t_access_level ) ) {
 				$t_caption = lang_get_defaulted( $t_custom_option[0] );
 				$t_link = $t_custom_option[2];
 				$t_options[] = "<a href=\"$t_link\">$t_caption</a>";
Index: doc/ChangeLog
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/doc/ChangeLog,v
retrieving revision 1.716
diff -u -r1.716 ChangeLog
--- doc/ChangeLog	27 Jul 2004 11:44:26 -0000	1.716
+++ doc/ChangeLog	30 Jul 2004 12:34:34 -0000
@@ -2,6 +2,7 @@
 
 2004.08.xx  -  0.19.0xx
 
+- 0003371: [feature] CVS Integration - general source control integration implemented (vboctor)
 - 0004137: [feature] Support a simple "view" URL (vboctor)
 - 0004145: [feature] Mantis pages should have descriptive titles (vboctor)
 - 0004185: [customization] Support custom menu options (vboctor)
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.189
diff -u -r1.189 strings_english.txt
--- lang/strings_english.txt	22 Jul 2004 15:05:13 -0000	1.189
+++ lang/strings_english.txt	30 Jul 2004 12:06:27 -0000
@@ -1000,4 +1000,7 @@
 $s_create_child_bug_button = "Create Child";
 $s_bug_cloned_to = "Issue cloned";
 $s_bug_created_from = "Issue generated from";
+
+# Source Control Integration
+$s_checkin = 'Checkin';
 ?>
\ No newline at end of file
source_control_integration.diff (12,242 bytes)   

Relationships

has duplicate 0002172 closedvboctor CVS integration a la cvstrac? 
has duplicate 0004079 closedvboctor Integration into CVS 
related to 0003758 closedjreese Perforce Integration (script included) 
child of 0003987 closedvboctor Mantis 0.19.0 Release 

Activities

vboctor

vboctor

2003-09-29 01:25

manager   ~0004658

Leus, this looks like a very good work. I will look at it in details. Have a look at 0002172 which I marked as a duplicate for this one.

leus

leus

2003-09-29 18:01

reporter   ~0004662

Thanks. However, is not that good, as I've found two bugs to the perl script already...

vboctor

vboctor

2003-09-30 01:18

manager   ~0004665

There will always be bugs, we just need to keep fixing them :)

leus

leus

2003-09-30 16:13

reporter   ~0004666

Thee is a problem with the mantis_cvs script attached. The "process" function is parsing incorrectly the parameters passed to the script.

Here is a small patch.

102,103c102,107
< foreach ( @ARGV ) {
< my ($file,$newv) = split ",";

    for (my $i=0; $i < scalar @ARGV; $i++ ) {
            my @args = split ' ', $ARGV[$i];
            my $module_name = $args[0];
            for (my $j=1; $j < scalar @args; $j++ ) {
                    my ($file,$newv) = split ",", $args[$j];
                    $file = "$module_name/$file";

105a110
}

leus

leus

2004-03-11 08:15

reporter   ~0005199

Hi, just wanted to know if anybody is looking for this feature.

kmars

kmars

2004-03-11 16:45

reporter   ~0005200

Very interested. We use cvs to roll out many systems and software. WEare constantly developing and would lov to see this feature implemented

vboctor

vboctor

2004-03-14 17:08

manager   ~0005206

Leus, how easy would it be to port mantis_cvs.pl to PHP?

leus

leus

2004-03-15 07:16

reporter   ~0005208

Frankly, I don't know. Should be easy.

vboctor

vboctor

2004-03-15 07:43

manager   ~0005210

It would be good if we do the following:

  • Port the script to PHP.
  • Update instructions to reflect the use of the PHP script.
  • Update instructions to explain how does the integration work. For example, what will appear in Mantis after a commit (i.e. the benefit of the whole thing)

Once we have this stuff done, I think we should add this to Mantis distribution + manual.

leus

leus

2004-03-15 08:19

reporter   ~0005211

Last edited: 2004-03-15 08:21

There is one thing that bothered me about mantis: the fact that bugnotes and history events are separated. It bothered me so much that I did change it; the way I see, a bugtracker should be an annotated history of every event related to the solution of one particular issue. I did it by listing the history events by time, and showing the appropiate remark. I'm attaching a screenshot for you to see.

Should we add a new "view" for a bug? (Normal view /Advanced view /Chrono list)

If we can't, maybe just adding a history item or a special bugnote should do the trick. In the attached image check out the "CVS checkin" event (in my setup, the link goes to the cvsweb)

edited on: 03-15-04 08:21

vboctor

vboctor

2004-04-01 08:42

manager   ~0005316

Leus, I like your chronological view, it can be an option that would affect how the simple/advanced view pages are rendered. Please re-upload your screenshot and add any patches/comments to 0003701.

gstarrett

gstarrett

2004-04-02 00:31

reporter   ~0005324

I'd be interested in this patch too since we already use both Mantis and CVS here.

alexl

alexl

2004-04-07 15:08

reporter   ~0005353

I tried CVS integration patch and patching with diff.txt produces errors with 0.18.2

patch -p0 <diff.txt

patching file config_defaults_inc.php
patching file core/constant_inc.php
patching file core/history_api.php
Hunk 0000002 FAILED at 252.
Hunk 0000003 FAILED at 256.
2 out of 3 hunks FAILED -- saving rejects to file core/history_api.php.rej
patching file lang/strings_english.txt
patching file lang/strings_spanish.txt
Hunk 0000002 FAILED at 866.
1 out of 2 hunks FAILED -- saving rejects to file lang/strings_spanish.txt.rej

kmars

kmars

2004-06-24 11:19

reporter   ~0005792

I have this installed and have one last thing to overcome. In my Bug History section my change field comes up with the location of the file in cvs, but it is not a hyperlink.

I am unsure if this is something with the mantis core or the cvs integration patch. I have allow_html_tags enabled.
I would love to complete this and implement it for our developers. Any help is appreciated

vboctor

vboctor

2004-07-24 09:54

manager   ~0006331

I can see some interest in this issue given the monitor list + the sponsorship. So is Perl solution ok for now or do you guys prefer a PHP port of the script before adding this into Mantis?

If there is enough support for this, I will try to put it in 0.19.0, if not, then will be in the following major release.

gstarrett

gstarrett

2004-07-24 14:48

reporter   ~0006336

Last edited: 2004-07-24 14:49

So is Perl solution ok for now or do you guys prefer a PHP port of the script before adding this into Mantis?
<<<

The PERL CVS script is fine for me, it's customary for CVS and I'm all set up for that anyway. I'd be happy if the required elements are added to Mantis core and the CVS script is supported (e.g. maintained across releases of Mantis, and posted at the Mantis site).

I'm assuming that the Mantis side will take care of notifying all the people monitoring the bug that there is a new bugnote as if it were directly added in Mantis, but the script talks about sending an email. I hope it would :)

Another note: For CVSNT (http://www.cvsnt.org/ ), the list of files & versions will come in from STDIN, not on the command line. We use CVSNT, but I suppose I could ask someone on the CVSNT list for some help porting it if you don't have a way to do that. (The change was made because of a limit on the length of the command line that caused missed information on large checkins)

edited on: 07-24-04 14:49

grangeway

grangeway

2004-07-25 08:15

reporter   ~0006345

PHP port + cvsnt support for me

gabbs

gabbs

2004-07-26 08:15

reporter   ~0006365

Last edited: 2004-07-26 08:17

Yup PHP port would be good, in the future maybe instead of putting it in as a comment, putting it into the mantis database in another table so you can list the files and versions changed within the bug and then link them to a web based CVS viewer (Chora etc) now that would be SMART! :) all you need now is simple integration into a testing tool (eg: http://majordojo.com/testitool/ - dunno if its any good tho) and everybody will be using it :) Mantis is great all hail mantis :)

edited on: 07-26-04 08:17

leus

leus

2004-07-26 09:29

reporter   ~0006367

Gabbs, checkins are inserted as history notes; you can list all checkins associated to a bug. And linking to cvsweb is already in place; there is a lot of room for improvement here.

(I have an updated diff file for the current version of Mantis, but I cannot upload attachments...)

leus

leus

2004-07-27 15:57

reporter   ~0006400

Okay, I have updated versions of the diff file and a new PHP version of the
mantis_cvs script. I cannot upload files, thought; who can upload these files for
me?

vboctor

vboctor

2004-07-27 17:11

manager   ~0006402

Leus, please send me the files. Thanks.

fusenigk

fusenigk

2004-07-28 07:08

reporter   ~0006416

Last edited: 2004-07-28 07:09

hi, this feature looks really good!
But I have some problems to patch the core/history_api.php file correctly to the current Mantis version.
Can someone send me a working version for 0.19.a2 to fusenigk@web.de or a current path file?
thanks in advance!

edited on: 07-28-04 07:09

vboctor

vboctor

2004-07-30 07:51

manager   ~0006474

I attached a patch that I applied to CVS. This patch achieves the following:

  • Supports script logins
  • Fixes some issues with php-cgi.
  • Implements a PHP script which calls a custom function per issue when a commit is done. By default this adds a history entry + can set status of the issue to a specified status (eg: FIXED or something). This can be overridden to do more/other things.

The thing that this patch doesn't do is to link to cvsweb. I am not aware of all the details regarding how to get the filenames + versions. Also what if the developer made a commit which affects 50 files?

I suggest people have a look at it and give me feedback (suggestions / bugs). Note that I didn't test it with a real cvs (source control) server. I test the script by entering data in stdin, and made sure that the appropriate actions are done.

vboctor

vboctor

2004-08-04 06:35

manager   ~0006620

Did anyone get a chance to test the CVS integration in CVS HEAD version of Mantis?

thraxisp

thraxisp

2004-08-04 08:39

reporter   ~0006625

Is the script called from CVS in CVS HEAD? I can't seem to find it.

vboctor

vboctor

2004-08-04 09:20

manager   ~0006629

The script can be found under core/checkin.php