+sub rcs_getmtime ($) {
+ error "rcs_getmtime is not implemented for cvs\n"; # TODO
+}
+
+
+# INTERNAL SUPPORT ROUTINES
+
+sub commitmessage (@) {
+ my %params=@_;
+
+ if (defined $params{session}) {
+ if (defined $params{session}->param("name")) {
+ return "web commit by ".
+ $params{session}->param("name").
+ (length $params{message} ? ": $params{message}" : "");
+ }
+ elsif (defined $params{session}->remote_addr()) {
+ return "web commit from ".
+ $params{session}->remote_addr().
+ (length $params{message} ? ": $params{message}" : "");
+ }
+ }
+ return $params{message};
+}
+
+sub cvs_info ($$) {
+ my $field=shift;
+ my $file=shift;
+
+ local $CWD = $config{srcdir};
+
+ my $info=`cvs status $file`;
+ my ($ret)=$info=~/^\s*$field:\s*(\S+)/m;
+ return $ret;
+}
+
+sub cvs_is_controlling {
+ my $dir=shift;
+ $dir=$config{srcdir} unless defined($dir);
+ return (-d "$dir/CVS") ? 1 : 0;
+}
+
+sub cvs_keyword_subst_args ($) {
+ my $file = shift;
+
+ local $CWD = $config{srcdir};
+
+ eval q{use File::MimeInfo};
+ error($@) if $@;
+ my $filemime = File::MimeInfo::default($file);
+ # if (-T $file) {
+
+ if (defined($filemime) && $filemime eq 'text/plain') {
+ return ($file);
+ }
+ else {
+ return ('-kb', $file);
+ }
+}
+
+sub cvs_runcvs(@) {
+ my @cmd = @_;
+ unshift @cmd, 'cvs', '-Q';
+
+ local $CWD = $config{srcdir};
+
+ open(my $savedout, ">&STDOUT");
+ open(STDOUT, ">", "/dev/null");
+ my $ret = system(@cmd);
+ open(STDOUT, ">&", $savedout);
+
+ return ($ret == 0) ? 1 : 0;
+}
+