View Issue Details

IDProjectCategoryView StatusLast Update
0007604mantisbtadministrationpublic2010-09-19 03:11
Reporterdapozzom Assigned Todhx  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionwon't fix 
Summary0007604: CVS Commit error
Description

During the commit I receive the following error messages
"Appending defaults (" %r/%p %s"), but please be aware that this usage is
deprecated."

"Comment does not reference any issues."

The commitinfo file contains
/usr/bin/php /var/www/html/mantis_S315/core/checkin.php

The config_inc file contains the correct enabled user anable for the note insert and the bug reported in the issue #0575 exists in Mantis db.the config_inc.php paramenters are
$g_source_control_notes_view_status = VS_PUBLIC;
$g_source_control_account = 'sviluppo';
$g_source_control_set_status_to = OFF;
$g_source_control_set_resolution_to = FIXED;
$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";
$g_source_control_fixed_regexp = "%source_control_regexp%";

Any suggestions

TagsNo tags attached.
Attached Files
checkin.php (3,671 bytes)   
#!/usr/local/bin/php -q
<?php
	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details

	# --------------------------------------------------------
	# $Id: checkin.php,v 1.4 2005/06/15 14:46:20 vboctor Exp $
	# --------------------------------------------------------

	global $g_bypass_headers;
	$g_bypass_headers = 1;
	require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' );

	# Make sure this script doesn't run via the webserver
	# @@@ This is a hack to detect php-cgi, there must be a better way.
	if ( isset( $_SERVER['SERVER_PORT'] ) ) {
		echo "checkin.php is not allowed to run through the webserver.\n";
		exit( 1 );
	}

	# Check that the username is set and exists
	$t_username = config_get( 'source_control_account' );
	if ( is_blank( $t_username ) || ( user_get_id_by_name( $t_username ) === false ) ) {
		echo "Invalid source control account ('$t_username').\n";
		exit( 1 );
	}

	if ( !defined( "STDIN" ) ) {
		define("STDIN", fopen('php://stdin','r'));
	}

	# Detect references to issues + concat all lines to have the comment log.

/*
# Detect references to issues + concat all lines to have the comment log.
$t_commit_regexp = config_get( 'source_control_regexp' );
$t_comment = '';
$t_issues = array();
$t_line=exec( "cat $argv[1]\n" ); # line added + modified
$t_comment .= $t_line;
if ( preg_match_all( $t_commit_regexp, $t_line, $t_matches ) ) {
  for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
     $t_issues[] = $t_matches[1][$i];
  }
}

*/
    $t_commit_regexp = config_get( 'source_control_regexp' );
    $t_commit_fixed_regexp = config_get( 'source_control_fixed_regexp' );

    $t_comment = '';
    $t_issues = array();
    $t_fixed_issues = array();

/*Personalizzazione per visualizzare nella nota solo il commento*/

    $t_line = exec( "cat $argv[2]\n" );
    $t_line2 = exec( "echo $argv[1]\n" );
    preg_match_all($t_commit_regexp, $t_line, $out, PREG_PATTERN_ORDER);
    $myissue = $out[0][0];
    $msg = substr($t_line,strlen($myissue)+1);
    $t_comment .= "Consolidato in cvs.\n".$msg."\n ";
		if ( preg_match_all( $t_commit_regexp, $t_line, $t_matches ) ) {
			for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
				$t_issues[] = $t_matches[1][$i];
			}
		}
		if ( preg_match_all( $t_commit_fixed_regexp, $t_line, $t_matches) ) {
			for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
				$t_fixed_issues[] = $t_matches[1][$i];
			}
		}
$t_line2 = exec( "echo $argv[1]\n" );
$t_comment .= "\nFile modificato: \n\t".$t_line2."\n";
	# If no issues found, then no work to do.
	if ( ( count( $t_issues ) == 0 ) && ( count( $t_fixed_issues ) == 0 ) ) {
		echo "Comment does not reference any issues.\n";
		exit(0);
	}



	# Login as source control user
	if ( !auth_attempt_script_login( $t_username ) ) {
		echo "Unable to login\n";
		exit( 1 );
	}

	# history parameters are reserved for future use.
	$t_history_old_value = '';
	$t_history_new_value = '';

	# Call the custom function to register the checkin on each issue.

	foreach ( $t_issues as $t_issue_id ) {
		if ( !in_array( $t_issue_id, $t_fixed_issues ) ) {
			helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, false ) );
		}
	}

	foreach ( $t_fixed_issues as $t_issue_id ) {
		helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, true ) );
	}

	exit( 0 );
?>
checkin.php (3,671 bytes)   
loginfo (1,815 bytes)
checkin_new.php (3,335 bytes)   
#!/usr/local/bin/php -q

<?php

	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details


	# --------------------------------------------------------
	# $Id: checkin.php,v 1.4.12.1 2006/05/28 14:27:15 vboctor Exp $
	# --------------------------------------------------------



	global $g_bypass_headers;
	$g_bypass_headers = 1;
	require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' );


	# Make sure this script doesn't run via the webserver
	# @@@ This is a hack to detect php-cgi, there must be a better way.

	if ( isset( $_SERVER['SERVER_PORT'] ) ) {
		echo "checkin.php is not allowed to run through the webserver.\n";
		exit( 1 );
	}

	# Check that the username is set and exists
	$t_username = config_get( 'source_control_account' );
	if ( is_blank( $t_username ) || ( user_get_id_by_name( $t_username ) === false ) ) {
		echo "Invalid source control account ('$t_username').\n";
		exit( 1 );
	}

	if ( !defined( "STDIN" ) ) {
		define("STDIN", fopen('php://stdin','r'));
	}

	# Detect references to issues + concat all lines to have the comment log.
	$t_commit_regexp = config_get( 'source_control_regexp' );
        $t_commit_fixed_regexp = config_get( 'source_control_fixed_regexp' );

	$t_comment = '';
	$t_issues = array();
	$t_fixed_issues = array();
        ###########INIZIO MODIFICA
        #Personalizzazione per visualizzare solo il file modificato ed il commento
	//while ( ( $t_line = fgets( STDIN, 1024 ) ) ) {
        $t_line = "<b>".exec("echo $argv[1]\n");
        $t_line .= "</b> consolidato in cvs. ";
        $t_line .= "<br><br>";
        $t_line .= exec("cat $argv[2]\n");
		$t_comment .= $t_line;
		if ( preg_match_all( $t_commit_regexp, $t_line, $t_matches ) ) {
			for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
				$t_issues[] = $t_matches[1][$i];
			}
		}
		if ( preg_match_all( $t_commit_fixed_regexp, $t_line, $t_matches) ) {
			for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
				$t_fixed_issues[] = $t_matches[1][$i];
			}
		}
	//}
        ##########FINE  MODIFICA

	# If no issues found, then no work to do.
	if ( ( count( $t_issues ) == 0 ) && ( count( $t_fixed_issues ) == 0 ) ) {
		echo "Comment does not reference any issues.\n";
		exit(0);
	}

	# Login as source control user
	if ( !auth_attempt_script_login( $t_username ) ) {
		echo "Unable to login\n";
		exit( 1 );
	}

	# history parameters are reserved for future use.
	$t_history_old_value = '';
	$t_history_new_value = '';

	# add note to each bug only once
	$t_issues = array_unique( $t_issues );
	$t_fixed_issues = array_unique( $t_fixed_issues );

	# Call the custom function to register the checkin on each issue.
	foreach ( $t_issues as $t_issue_id ) {
		if ( !in_array( $t_issue_id, $t_fixed_issues ) ) {
			helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, false ) );
		}
	}
	foreach ( $t_fixed_issues as $t_issue_id ) {
		helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, true ) );
	}

	exit( 0 );

?>
checkin_new.php (3,335 bytes)   
checkin_V2.php (4,090 bytes)   
#!/usr/local/bin/php -q

<?php

	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details

	# --------------------------------------------------------
	# $Id: checkin.php,v 1.4.12.1 2006/05/28 14:27:15 vboctor Exp $
	# --------------------------------------------------------

	global $g_bypass_headers;
	$g_bypass_headers = 1;
	require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' );

	# Make sure this script doesn't run via the webserver
	# @@@ This is a hack to detect php-cgi, there must be a better way.
	if ( isset( $_SERVER['SERVER_PORT'] ) ) {
		echo "checkin.php is not allowed to run through the webserver.\n";
		exit( 1 );
	}

	# Check that the username is set and exists
	$t_username = config_get( 'source_control_account' );
	if ( is_blank( $t_username ) || ( user_get_id_by_name( $t_username ) === false ) ) {
		echo "Invalid source control account ('$t_username').\n";
		exit( 1 );
	}

	if ( !defined( "STDIN" ) ) {
		define("STDIN", fopen('php://stdin','r'));
	}

	# Detect references to issues + concat all lines to have the comment log.
	$t_commit_regexp = config_get( 'source_control_regexp' );
    $t_commit_fixed_regexp = config_get( 'source_control_fixed_regexp' );

	$t_comment = '';
	$t_issues = array();
	$t_fixed_issues = array();
	while ( ( $t_line = fgets( STDIN, 1024 ) ) ) {
		$t_comment .= $t_line;
		if ( preg_match_all( $t_commit_regexp, $t_line, $t_matches ) ) {
			for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
				$t_issues[] = $t_matches[1][$i];
			}
		}

		if ( preg_match_all( $t_commit_fixed_regexp, $t_line, $t_matches) ) {
			for ( $i = 0; $i < count( $t_matches[0] ); ++$i ) {
				$t_fixed_issues[] = $t_matches[1][$i];
			}
		}

	}



	# If no issues found, then no work to do.
	if ( ( count( $t_issues ) == 0 ) && ( count( $t_fixed_issues ) == 0 ) ) {
		echo "Comment does not reference any issues.\n";
		exit(0);
	}

	# Login as source control user
	if ( !auth_attempt_script_login( $t_username ) ) {
		echo "Unable to login\n";
		exit( 1 );
	}

	# history parameters are reserved for future use.
	$t_history_old_value = '';
	$t_history_new_value = '';

	# add note to each bug only once
	$t_issues = array_unique( $t_issues );
	$t_fixed_issues = array_unique( $t_fixed_issues );

#inizio personalizzazione
        # estrae il nome del progetto
        $strcvs = substr($t_comment,0,strpos($t_comment,"In directory"));
        $strcvs = substr($strcvs, strpos($strcvs,"cvs/")+4);
 
        # estrae i nomi dei file consolidati
        $start = strpos($t_comment,"Modified Files") + strlen("Modified Files:\n");
        $end = strpos($t_comment,"Log Message") - $start;
        $strfiles=trim(substr($t_comment,$start,$end));
        $strfiles=str_replace(" ", "<br>",$strfiles);
      
        
        $str = strpos($t_comment, "Modified Files:");
        $t_comment = substr($t_comment,$str);
        $modfiles = "<b>Sorgente/i consolidato/i in CVS <i>".$strcvs."</i></b>".$strfiles;
       // $t_comment = str_replace("Modified Files:\n\t", $modfiles, $t_comment);
        $t_comment = substr_replace($t_comment, $modfiles, strpos($t_comment,"Modified Files"), strpos($t_comment,"Log Message"));
        //echo "t_comment".$t_comment; 
  
        $t_comment = str_replace("Log Message:", "<br><br><b>Commento checkin</b>: ", $t_comment);
#fine personalizzazione

	# Call the custom function to register the checkin on each issue.
	foreach ( $t_issues as $t_issue_id ) {
		if ( !in_array( $t_issue_id, $t_fixed_issues ) ) {
			helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, false ) );
		}
	}

	foreach ( $t_fixed_issues as $t_issue_id ) {
		helper_call_custom_function( 'checkin', array( $t_issue_id, $t_comment, $t_history_old_value, $t_history_new_value, true ) );
	}

	exit( 0 );
?>

checkin_V2.php (4,090 bytes)   

Relationships

related to 0011732 closeddhx Remove built-in source code integration support 

Activities

dapozzom

dapozzom

2006-11-20 07:07

reporter   ~0013740

Using CVS 1.2.x, the CVS file that must be updated with the following stmt for mantis integration is loginfo

^ALL /usr/bin/php mantis_path/checkin.php %s

Attache a customizer version of checkin.php

dapozzom

dapozzom

2006-11-21 07:18

reporter   ~0013743

Attached the new customized verion of checkin.php for multiple issue referencing the note in the commit must be #nnnnn #nnnn ..... comment

Attached loginfo sample

dapozzom

dapozzom

2006-11-22 12:19

reporter   ~0013748

Attached a new version of checking.php for multiple module checkin

dhx

dhx

2010-03-31 04:18

reporter   ~0024954

Won't fix as this old source code integration support is being dropped in favour of using a more modern plugin approach with the SourceIntegration plugin.

Refer to 0011732 for more details and feedback.