From f41448d9caf591ba369bf319297d15552be94678 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Aug 2008 16:02:01 -0400 Subject: [PATCH] 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. --- IkiWiki.pm | 17 ++++++++++------- IkiWiki/Plugin/bzr.pm | 3 --- IkiWiki/Plugin/git.pm | 3 --- IkiWiki/Plugin/mercurial.pm | 3 --- IkiWiki/Plugin/monotone.pm | 3 --- IkiWiki/Plugin/svn.pm | 3 --- IkiWiki/Plugin/tla.pm | 3 --- 7 files changed, 10 insertions(+), 25 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 6a6e93e7e..bfa85343d 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -412,13 +412,6 @@ sub checkconfig () { #{{{ $config{wikistatedir}="$config{srcdir}/.ikiwiki" unless exists $config{wikistatedir}; - - if ($config{rcs}) { - loadplugin($config{rcs}); - } - else { - loadplugin("norcs"); - } if (defined $config{umask}) { umask(possibly_foolish_untaint($config{umask})); @@ -455,6 +448,16 @@ sub loadplugins () { #{{{ } 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->() }); if (grep /^-/, @ARGV) { diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index e7b22f3c5..99025a973 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -8,9 +8,6 @@ use Encode; use open qw{:utf8 :std}; sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "bzr", call => \&checkconfig); hook(type => "getsetup", id => "bzr", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index b683e4ec3..d1c1165e0 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -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 sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "git", call => \&checkconfig); hook(type => "getsetup", id => "git", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index b05c954dc..d2c34fa6a 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -8,9 +8,6 @@ use Encode; use open qw{:utf8 :std}; sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "mercurial", call => \&checkconfig); hook(type => "getsetup", id => "mercurial", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index a591ecec5..4b9be316a 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -11,9 +11,6 @@ use Date::Format qw(time2str); my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate sha1sums sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "monotone", call => \&checkconfig); hook(type => "getsetup", id => "monotone", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index 262fca99a..51683704c 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -7,9 +7,6 @@ use IkiWiki; use POSIX qw(setlocale LC_CTYPE); sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "svn", call => \&checkconfig); hook(type => "getsetup", id => "svn", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index fe5965259..6faaecccc 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -6,9 +6,6 @@ use strict; use IkiWiki; sub import { #{{{ - if (exists $IkiWiki::hooks{rcs}) { - error(gettext("cannot use multiple rcs plugins")); - } hook(type => "checkconfig", id => "tla", call => \&checkconfig); hook(type => "getsetup", id => "tla", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); -- 2.44.0