View Issue Details

IDProjectCategoryView StatusLast Update
0005796mantisbtadministrationpublic2010-09-19 03:11
Reporterkmcnamee Assigned Todhx  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionwon't fix 
Product Version1.0.0a3 
Summary0005796: CVS integration improvement
Description

I have been working on integrating Mantis with CVS, since it is the current integration is quite rudimentary. It is really useful in closed development environments such as companies

Requirements:
1) CVS usernames can be used when bugnotes are added via checkin (and defaulting to $g_source_control_account if not found)
2) The checked in files listed in the bugnote are hyperlinks to cvsweb. Specifically the link is a diff to the previous version.
3) Place the log message above the file listing in the bugnote.
4) Fix a bug in string_process_cvs_link function where <br> is not filtered.

Steps To Reproduce

1) Set $g_source_control_account to be a valid Mantis user (e.g. "cvsuser")
2) Put the two files (attached) into your Mantis installation
3) Add the following line to your loginfo file:
DEFAULT /usr/local/bin/php /usr/local/mantis/core/checkin.php %{,sVv} $USER

Additional Information

The entry in loginfo expands into a list of files and versions followed by the usernames. See https://www.cvshome.org/docs/manual/cvs-1.11.6/cvs_18.html#SEC171 for more details. Because some of our folders and files contain spaces the extra "," avoids having to tokenise on spaces.

Files that are added or removed by the commit are presented as hyperlinks to the files, whereas modified files are listed as diffs.

When processing the "CVS:" tag in string_process_cvs_link, a second regexp substitution is performed to produce the diff hyperlink. This regexp matchs on cvs:filename.ext:n.nn:n.nn

Also, an annoying bug was fixed where if the
CVS:foo/bar
appeared on a separate line, it would be mangled

TagsNo tags attached.

Relationships

related to 0006092 closedryandesign CVS link gets mangled if filename is followed by a newline 
related to 0011732 closeddhx Remove built-in source code integration support 
child of 0004181 closed Features in Mantis 1.1 release 

Activities

2005-06-15 10:13

 

cvs_integration.tar.gz (7,071 bytes)

2005-06-16 03:28

 

2005-06-16 03:36

 

kmcnamee

kmcnamee

2005-06-16 03:37

reporter   ~0010545

Forgot to include changes in uploaded file :)
Correct file: cvs_integration2.tar.gz

2005-06-16 03:55

 

kmcnamee

kmcnamee

2005-06-16 03:55

reporter   ~0010546

More testing done: cvs_integration3.tar.gz

2005-06-16 04:20

 

kmcnamee

kmcnamee

2005-06-16 04:22

reporter   ~0010547

New version: cvs_integration.tar4.gz
Added revision to hyperlink for added and removed files. Hopefully the last change for now.

Please remove the old files.

2005-06-16 10:24

 

kmcnamee

kmcnamee

2005-06-16 10:26

reporter   ~0010553

New version: cvs_integration5.tar.gz
More testing with spaces in filenames.
Removed files are linked to cvsweb history.

2005-06-16 10:31

 

2005-08-04 11:34

 

kmcnamee

kmcnamee

2005-08-04 11:35

reporter   ~0011069

Merged changes with RC1 release and uploaded the diff files.

ryandesign

ryandesign

2005-08-07 10:43

reporter   ~0011097

I'd rather handle separate issues separately. I'll take the annoying bug that mangles the link if you have a newline after the cvs filename and fix it in 0006092. We may also want to break the other issues in this ticket out into separate tickets (if they don't exist separately already...)

kmcnamee

kmcnamee

2005-08-08 03:33

reporter   ~0011117

This is the only ticket I have created. Apart from the CVS bug everything here is really one improvement, i.e. pretty print the CVS loginfo in a bugnote.

The standard loginfo text is unusable but fortunately CVS provides all the necesary information as arguments (see Step 3 in "Steps To Reproduce"). This is parsed and ordered to form a user friendly bugnote. The CVS links differ as follows:
Files added: foo/bar:1.23 (goes to file)
Files updated: foo/bar:1.23:1.24 (goes to diff)
Files removed: foo/bar (goes to file listing)

The $USER argument allows the script to try posting the bugnote with that username otherwise it defaults back to $g_source_control_account.

If you need some help with this, just ask.

webwesen

webwesen

2005-12-07 12:26

reporter   ~0011730

Requirements:
1) CVS usernames can be used when bugnotes are added via checkin (and defaulting to $g_source_control_account if not found)

this does not work if you have 'anonymous' user in your setup. every note is then logged by an anonymous.

anarcat

anarcat

2005-12-08 09:10

reporter   ~0011746

see also bug 0003045.

2005-12-29 08:25

 

string_api.php.rc2.diff (1,788 bytes)   
Index: string_api.php
===================================================================
RCS file: /cvs/TPS/mantis/core/string_api.php,v
retrieving revision 1.9
diff -u -r1.9 string_api.php
--- string_api.php	19 Sep 2005 11:58:45 -0000	1.9
+++ string_api.php	29 Dec 2005 13:24:37 -0000
@@ -176,20 +176,33 @@
 	# --------------------
 	# process the $p_string and convert filenames in the format
 	#  cvs:filename.ext or cvs:filename.ext:n.nn to a html link
+	# filenames in the format cvs:filename.ext:n.nn:n.nn are 
+	#  converted to html links of diffs between the two versions
 	# if $p_include_anchor is true, include an <a href="..."> tag,
 	#  otherwise, just insert the URL as text
 	function string_process_cvs_link( $p_string, $p_include_anchor=true ) {
 		$t_cvs_web = config_get( 'cvs_web' );
 
+ 		if ( $p_include_anchor ) {
+			$t_replace_with = '[CVS] <a href="'.$t_cvs_web.'\\1?r1=\\4&r2=\\6" target="_new">\\1:\\4:\\6</a>\\7';
+		} else {
+			$t_replace_with = '[CVS] '.$t_cvs_web.'\\1?r1=\\4&r2=\\6\\7';
+		}
+
+		$new_string = preg_replace( '/cvs:([^\.\s:,\?!]+(\.[^\.\s:,\?!]+)*)(:)(\d\.[\d\.]+)(:)(\d\.[\d\.]+)([\W\s])?/i',
+							 $t_replace_with,
+							 $p_string );
+
+
 		if ( $p_include_anchor ) {
-			$t_replace_with = '[CVS] <a href="'.$t_cvs_web.'\\1?rev=\\4" target="_new">\\1</a>\\5';
+			$t_replace_with = '[CVS] <a href="'.$t_cvs_web.'\\1?rev=\\4" target="_new">\\1\\3</a>\\5';
 		} else {
 			$t_replace_with = '[CVS] '.$t_cvs_web.'\\1?rev=\\4\\5';
 		}
 
-		return preg_replace( '/cvs:([^\.\s:,\?!<]+(\.[^\.\s:,\?!<]+)*)(:)?(\d\.[\d\.]+)?([\W\s])?/i',
+		return preg_replace( '/cvs:([^\.\s:,\?!]+(\.[^\.\s:,\?!<]+)*)(:(\d\.[\d\.]+))?([\W\s])?/i',
 							 $t_replace_with,
-							 $p_string );
+							 $new_string );
 	}
 
 	# --------------------
string_api.php.rc2.diff (1,788 bytes)   
polzin

polzin

2005-12-29 08:26

reporter   ~0011849

Last edited: 2005-12-30 04:11

Thanks for your patches.

I modified your string_api patch slightly, so that the links text still display the ":XX" and ":XX:XX" to show, it´s a link to a specific version.

polzin

polzin

2005-12-29 10:11

reporter   ~0011850

Last edited: 2005-12-29 10:14

I just noted that in CVS >= 1.12 the old format of loginfo options is deprecated.
To remove the deprecation-warning, one has to redesign the loginfo entry and the checkin.php script.
http://ximbiot.com/cvs/manual/cvs-1.12.13/cvs_18.html#SEC190

Unfortunately, the correct loginfo line nearly not documented in the mantis documentation. There is also some confusion in which admin file to put the line: The mantis docs suggest "commitinfo" but this does not provide the version information.

Just if anyone is interested, the following works with cvs 1.12 and "UseNewInfoFmtStrings=yes" in CVSROOT/config:

loginfo:
<pre>
[...]
^PATH/TO/REPOSITORY /PATH/TO/MATIS/core/checkin.php %p $USER %{sVv}
</pre>

in checkin.php:
<pre>
[...]
$t_checkin_params = $_SERVER['argv'];
$t_checkin_path = trim($t_checkin_params[1]);
$t_revisions = array();
for ($i=3; $i < count($t_checkin_params); $i+=3) {
[...]
</pre>

webwesen

webwesen

2006-09-21 16:24

reporter   ~0013427

can anyone upload the missing attachments? thanks

2007-02-05 08:17

 

kmcnamee

kmcnamee

2007-02-05 08:17

reporter   ~0014003

Seems you cannot upload a file with the same filename again if though it says "(attachment missing)".

dhx

dhx

2010-03-31 04:12

reporter   ~0024951

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.

Issue History

Date Modified Username Field Change
2005-06-15 10:13 kmcnamee New Issue
2005-06-15 10:13 kmcnamee File Added: cvs_integration.tar.gz
2005-06-16 03:28 kmcnamee File Added: cvs_integration1.tar.gz
2005-06-16 03:36 kmcnamee File Added: cvs_integration2.tar.gz
2005-06-16 03:37 kmcnamee Note Added: 0010545
2005-06-16 03:55 kmcnamee File Added: cvs_integration3.tar.gz
2005-06-16 03:55 kmcnamee Note Added: 0010546
2005-06-16 04:20 kmcnamee File Added: cvs_integration.tar4.gz
2005-06-16 04:22 kmcnamee Note Added: 0010547
2005-06-16 10:24 kmcnamee File Added: cvs_integration5.tar.gz
2005-06-16 10:26 kmcnamee Note Added: 0010553
2005-06-16 10:31 kmcnamee File Added: cvs_integration6.tar.gz
2005-08-04 11:34 kmcnamee File Added: cvs_integration_rc1_diff.tar.gz
2005-08-04 11:35 kmcnamee Note Added: 0011069
2005-08-07 10:43 ryandesign Note Added: 0011097
2005-08-07 11:35 ryandesign Relationship added related to 0006092
2005-08-08 03:33 kmcnamee Note Added: 0011117
2005-12-07 12:26 webwesen Note Added: 0011730
2005-12-08 04:41 jlatour Status new => acknowledged
2005-12-08 04:41 jlatour Relationship added child of 0004181
2005-12-08 09:10 anarcat Note Added: 0011746
2005-12-29 08:25 polzin File Added: string_api.php.rc2.diff
2005-12-29 08:26 polzin Note Added: 0011849
2005-12-29 10:11 polzin Note Added: 0011850
2005-12-29 10:14 polzin Note Edited: 0011850
2005-12-30 04:11 polzin Note Edited: 0011849
2006-09-21 16:24 webwesen Note Added: 0013427
2007-02-05 08:17 kmcnamee File Added: cvs_integration_rc1_diff_copy.tar.gz
2007-02-05 08:17 kmcnamee Note Added: 0014003
2008-07-28 14:26 grangeway Status acknowledged => assigned
2008-07-28 14:26 grangeway Assigned To => grangeway
2010-03-31 03:59 dhx Relationship added related to 0011732
2010-03-31 04:12 dhx Note Added: 0024951
2010-03-31 04:12 dhx Status assigned => resolved
2010-03-31 04:12 dhx Resolution open => won't fix
2010-03-31 04:12 dhx Assigned To grangeway => dhx
2010-09-19 03:11 dhx Status resolved => closed