X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/fb6c6895c629f23b0a82840684fac3672b409711..f91d79f469956c423373c8747c92218c668f0ba8:/IkiWiki/Plugin/cvs.pm diff --git a/IkiWiki/Plugin/cvs.pm b/IkiWiki/Plugin/cvs.pm index ccd697e1b..f6db8bc98 100644 --- a/IkiWiki/Plugin/cvs.pm +++ b/IkiWiki/Plugin/cvs.pm @@ -1,7 +1,7 @@ -#!/usr/pkg/bin/perl +#!/usr/bin/perl package IkiWiki::Plugin::cvs; -# Copyright (c) 2008 Amitai Schlair +# Copyright (c) 2009 Amitai Schlair # All rights reserved. # # This code is derived from software contributed to ikiwiki @@ -52,7 +52,7 @@ sub import { } sub genwrapper () { - my $check_args=<<"EOF"; + return < { type => "string", example => "/cvs/wikirepo/CVSROOT/post-commit", - description => "cvs post-commit hook to generate (triggered by CVSROOT/loginfo entry", + description => "cvs post-commit hook to generate (triggered by CVSROOT/loginfo entry)", safe => 0, # file rebuild => 0, }, @@ -264,11 +263,13 @@ sub rcs_add ($) { if (defined($filemime) && $filemime eq 'text/plain') { cvs_runcvs('add', $file) || warn("cvs add $file failed\n"); - } else { + } + else { cvs_runcvs('add', '-kb', $file) || warn("cvs add binary $file failed\n"); } - } else { + } + else { # directory cvs_runcvs('add', $file) || warn("cvs add $file failed\n"); @@ -321,11 +322,12 @@ sub rcs_recentchanges($) { eval q{use File::ReadBackwards}; error($@) if $@; - my (undef, $tmpfile) = tempfile(OPEN=>0); + my ($tmphandle, $tmpfile) = tempfile(); system("env TZ=UTC cvsps -q --cvs-direct -z 30 -x >$tmpfile"); if ($? == -1) { error "couldn't run cvsps: $!\n"; - } elsif (($? >> 8) != 0) { + } + elsif (($? >> 8) != 0) { error "cvsps exited " . ($? >> 8) . ": $!\n"; } @@ -382,7 +384,8 @@ sub rcs_recentchanges($) { $message[0]->{line}=~/$config{web_commit_regexp}/) { $user=defined $2 ? "$2" : "$3"; $message[0]->{line}=$4; - } else { + } + else { $committype="cvs"; } @@ -392,21 +395,24 @@ sub rcs_recentchanges($) { $line = ; if ($line =~ /^Author: (.*)$/) { $user = $1 unless defined $user && length $user; - } else { + } + else { error "expected Author, got $line"; } $line = ; if ($line =~ /^Date: (.*)$/) { $when = str2time($1, 'UTC'); - } else { + } + else { error "expected Date, got $line"; } $line = ; if ($line =~ /^PatchSet (.*)$/) { $rev = $1; - } else { + } + else { error "expected PatchSet, got $line"; } @@ -444,7 +450,8 @@ sub rcs_diff ($) { if (wantarray) { return @cvsps; - } else { + } + else { return join("", @cvsps); } }