From 6c8a8dd13b96f2990f58596c7ec5e7c497b39cbe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Jul 2008 14:32:48 -0400 Subject: add guard against enabling multiple rcs plugins --- 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 +++ 6 files changed, 18 insertions(+) diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 99025a973..e7b22f3c5 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -8,6 +8,9 @@ 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 5e302729e..6f0ac56d5 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -11,6 +11,9 @@ 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 d2c34fa6a..b05c954dc 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -8,6 +8,9 @@ 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 4b9be316a..a591ecec5 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -11,6 +11,9 @@ 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 51683704c..262fca99a 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -7,6 +7,9 @@ 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 6faaecccc..fe5965259 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -6,6 +6,9 @@ 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); -- cgit v1.2.3