--- checkin.php.old	Mon Jul 25 21:09:21 2005
+++ checkin.php	Mon Jul 25 21:08:09 2005
@@ -32,6 +32,26 @@
 		define("STDIN", fopen('php://stdin','r'));
 	}
 
+	# If command line arguments are given, the format is as follows:
+	#   checkin.php directory {file rev_old rev_new}
+	$cvslinks = '';
+	if (count($argv) > 0 && !empty($g_cvs_web)) {
+		array_shift($argv);
+		$cvs_dir = array_shift($argv);
+
+		while (count($argv) >= 3) {
+			$cvs_file = array_shift($argv);
+			$cvs_version_prev = array_shift($argv);
+			$cvs_version_new = array_shift($argv);
+			if ($cvs_version_prev == 'NONE') {
+				// new file
+				$cvslinks .= $g_cvs_web.$cvs_dir."/".$cvs_file."?rev=".$cvs_version_new."&content-type=text/vnd.viewcvs-markup\n";
+			} else {
+				$cvslinks .= $g_cvs_web.$cvs_dir."/".$cvs_file.".diff?r1=".$cvs_version_prev."&r2=".$cvs_version_new."\n";
+			}
+		}
+	}
+
 	# 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' );
@@ -52,6 +72,10 @@
 				$t_fixed_issues[] = $t_matches[1][$i];
 			}
 		}
+	}
+
+	if (!empty($cvslinks)) {
+		$t_comment .= "\n\n$cvslinks";
 	}
 
 	# If no issues found, then no work to do.
