rcs plugin loading reorg

Move rcs plugin load to loadplugins; move duplicate rcs detection logic out
of individual plugins and into loadplugins. Avoids checkconfig failing when
run twice.
master
Joey Hess 2008-08-01 16:02:01 -04:00
parent bb394fdae8
commit f41448d9ca
7 changed files with 10 additions and 25 deletions

View File

@ -413,13 +413,6 @@ sub checkconfig () { #{{{
$config{wikistatedir}="$config{srcdir}/.ikiwiki" $config{wikistatedir}="$config{srcdir}/.ikiwiki"
unless exists $config{wikistatedir}; unless exists $config{wikistatedir};
if ($config{rcs}) {
loadplugin($config{rcs});
}
else {
loadplugin("norcs");
}
if (defined $config{umask}) { if (defined $config{umask}) {
umask(possibly_foolish_untaint($config{umask})); umask(possibly_foolish_untaint($config{umask}));
} }
@ -456,6 +449,16 @@ sub loadplugins () { #{{{
loadplugin($_) foreach @{$config{default_plugins}}, @{$config{add_plugins}}; loadplugin($_) foreach @{$config{default_plugins}}, @{$config{add_plugins}};
if ($config{rcs}) {
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
loadplugin($config{rcs});
}
if (! exists $IkiWiki::hooks{rcs}) {
loadplugin("norcs");
}
run_hooks(getopt => sub { shift->() }); run_hooks(getopt => sub { shift->() });
if (grep /^-/, @ARGV) { if (grep /^-/, @ARGV) {
print STDERR "Unknown option: $_\n" print STDERR "Unknown option: $_\n"

View File

@ -8,9 +8,6 @@ use Encode;
use open qw{:utf8 :std}; use open qw{:utf8 :std};
sub import { #{{{ sub import { #{{{
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
hook(type => "checkconfig", id => "bzr", call => \&checkconfig); hook(type => "checkconfig", id => "bzr", call => \&checkconfig);
hook(type => "getsetup", id => "bzr", call => \&getsetup); hook(type => "getsetup", id => "bzr", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_update", call => \&rcs_update);

View File

@ -11,9 +11,6 @@ my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums
my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes
sub import { #{{{ sub import { #{{{
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
hook(type => "checkconfig", id => "git", call => \&checkconfig); hook(type => "checkconfig", id => "git", call => \&checkconfig);
hook(type => "getsetup", id => "git", call => \&getsetup); hook(type => "getsetup", id => "git", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_update", call => \&rcs_update);

View File

@ -8,9 +8,6 @@ use Encode;
use open qw{:utf8 :std}; use open qw{:utf8 :std};
sub import { #{{{ sub import { #{{{
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
hook(type => "checkconfig", id => "mercurial", call => \&checkconfig); hook(type => "checkconfig", id => "mercurial", call => \&checkconfig);
hook(type => "getsetup", id => "mercurial", call => \&getsetup); hook(type => "getsetup", id => "mercurial", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_update", call => \&rcs_update);

View File

@ -11,9 +11,6 @@ use Date::Format qw(time2str);
my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate sha1sums my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate sha1sums
sub import { #{{{ sub import { #{{{
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
hook(type => "checkconfig", id => "monotone", call => \&checkconfig); hook(type => "checkconfig", id => "monotone", call => \&checkconfig);
hook(type => "getsetup", id => "monotone", call => \&getsetup); hook(type => "getsetup", id => "monotone", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_update", call => \&rcs_update);

View File

@ -7,9 +7,6 @@ use IkiWiki;
use POSIX qw(setlocale LC_CTYPE); use POSIX qw(setlocale LC_CTYPE);
sub import { #{{{ sub import { #{{{
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
hook(type => "checkconfig", id => "svn", call => \&checkconfig); hook(type => "checkconfig", id => "svn", call => \&checkconfig);
hook(type => "getsetup", id => "svn", call => \&getsetup); hook(type => "getsetup", id => "svn", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_update", call => \&rcs_update);

View File

@ -6,9 +6,6 @@ use strict;
use IkiWiki; use IkiWiki;
sub import { #{{{ sub import { #{{{
if (exists $IkiWiki::hooks{rcs}) {
error(gettext("cannot use multiple rcs plugins"));
}
hook(type => "checkconfig", id => "tla", call => \&checkconfig); hook(type => "checkconfig", id => "tla", call => \&checkconfig);
hook(type => "getsetup", id => "tla", call => \&getsetup); hook(type => "getsetup", id => "tla", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_update", call => \&rcs_update);