View Issue Details

IDProjectCategoryView StatusLast Update
0004522mantisbtotherpublic2010-09-19 03:11
Reporterthraxisp Assigned Todhx  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionwon't fix 
Product Versiongit trunk 
Summary0004522: checkin.php should extract more information from the commit
Description

checkin.php should extract the username doing the commit from the environment (environment variable "USER"). It should also add in the file names and versions (%{sV} from the command line).

TagsNo tags attached.
Attached Files
checkin.patch (1,237 bytes)   
--- mantis-0.19.2/core/checkin.php	2004-09-30 14:26:38.000000000 -0400
+++ mantis/core/checkin.php	2005-01-31 14:06:05.000000000 -0500
@@ -34,7 +34,39 @@
 
 	# Detect references to issues + concat all lines to have the comment log.
 	$t_commit_regexp = config_get( 'source_control_regexp' );
-	$t_comment = '';
+
+	# Special Hakcs by Gennady for Better Integration
+	if ($USER) {
+		$t_comment = "*** CVS COMMIT by $USER ***\n";
+	} else
+		$t_comment = "*** CVS COMMIT ***\n";
+	#
+	# Need to check the command-line stuff and build the files list.
+	#
+
+	if ($argc > 1) {
+		$dir = strtok($argv[1], " ");
+		if ($dir) {
+			$f = strtok(" ");
+
+			list ($file, $newrev ) = split(",", $f, 2);
+			#print "ARG: $i -> " . $argv[$i] . "\n";
+        	        $v = strtok($argv[$i], ',');
+                	#print "cvs:" . $argv[1] . "/" . $v;
+                	$t_comment .= "cvs:" . $dir . "/" . $file;
+
+			if ($newrev) {
+	                	#print ":$v\n";
+	                	$t_comment .= ":$newrev\n";
+			}
+        	}
+
+		#print "PARSED ARGS: $argc -> $t_comment\n";
+	} else {
+		#print "NO ARGS????\n";
+	}
+	$t_comment .= "\n";
+
 	$t_issues = array();
 	while ( ( $t_line = fgets( STDIN, 1024 ) ) ) {
 		$t_comment .= $t_line;
checkin.patch (1,237 bytes)   

Relationships

related to 0011732 closeddhx Remove built-in source code integration support 
has duplicate 0006588 closedgiallu CVS/SVN Integration - userid 

Activities

Gena01

Gena01

2005-01-31 14:49

reporter   ~0009153

I have been doing this for my local mantis configuration. Some things i looked into [considering i just started figuring it out]:

  1. Changing checkin.php to identify cvs commits differently from other bug notes.
  2. Using cvs:/file:1.1 notation to linking mantis back to cvs repository for each file. The way i have done it now is just listing each file w/ a link to cvs one per line and then having the regular text follow the little header.

Things to consider:

  • One thing that i am trying to figure out instead of linking 1 revision per file to link to a "diff" between the 2 revisions which should be possible from the provided parameters [if properly configured from loginfo file], however the current cvs protocol parser doesn't understand it or I am not sure how to properly specify that information. Also not specifying a revision breaks things.

I am still experimenting. I could include my changes as a possible patch. I am still making some small changes.

vboctor

vboctor

2005-02-02 05:55

manager   ~0009170

Gena01, it would be great if you can provide us with whatever work you do in this area. I implemented checkin.php on a Windows machine and hence I didn't have the infrastructure and the knowledge to do full integration.

You can also evalutate the following library which integrates Mantis with several source control systems:
http://freshmeat.net/projects/scmbug/

Gena01

Gena01

2005-02-08 18:30

reporter   ~0009261

Here is 1st draft of my checkin.php changes. It parses the %(sV} set. For a more complete integration we should support %{sVv} which would contain both the old revision and the new revision. I got it currently setup on my local setup here and it's running ok.

A better way to do this is if mantis could support doing diffs while parsing and handling more than 1 revision in cvs :/ file , rev syntax.

jjtest

jjtest

2005-05-16 17:00

reporter   ~0010146

Been working on this too... and thought I had it handling diffs integrated to Horde's Chora weblog nicely... until I ran into some windows-based filenames with embedded spaces. Arrrrrrrrrrgh!

Is there ANY way to pass these from loginfo notation %{sVv} as args into checkin.php and still make embedded space dirs/filenames work?! I have tried so many combinations my head is spinning. Just wondered if you have it working.

vboctor

vboctor

2005-05-17 03:26

manager   ~0010152

When passing file names as command line parameters on Windows, it is necessary to enclose the file names in double quotes in order for them to work properly when file names include spaces.

jjtest

jjtest

2005-05-17 09:13

reporter   ~0010157

I am on unix. Just trying to handle filenames with spaces is such a pain from cvs. So far the best I have been able to do is to pass one long string in as arg1 to checkin.php... in the form of <dirname> <newrev>,<filename>,<oldrev> <newrev>,<filename>,<oldrev>...and now will have to write a char parser to make that useful. And only after passing %{vsV} so I can exploit the version#'s as "delimiters" themselves. Can't believe it has to be this hard, but to me it really looks like the fault of cvs and how they pass the filenames.

What, if any, is the limitation on the length of one argument to a PHP script? That could foil my plans. jj

dhx

dhx

2010-03-31 04:21

reporter   ~0024958

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.