]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/tla.pm
Group related plugins into sections in the setup file, and drop unused rcs plugins...
[ikiwiki.git] / IkiWiki / Plugin / tla.pm
index fe596525970a0be23a1fa416cfb01c966018697c..16d73b1362fa75ad2be342942136c76f475f4e4c 100644 (file)
@@ -5,10 +5,7 @@ use warnings;
 use strict;
 use IkiWiki;
 
-sub import { #{{{
-       if (exists $IkiWiki::hooks{rcs}) {
-               error(gettext("cannot use multiple rcs plugins"));
-       }
+sub import {
        hook(type => "checkconfig", id => "tla", call => \&checkconfig);
        hook(type => "getsetup", id => "tla", call => \&getsetup);
        hook(type => "rcs", id => "rcs_update", call => \&rcs_update);
@@ -21,23 +18,28 @@ sub import { #{{{
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
-} #}}}
+}
 
-sub checkconfig () { #{{{
+sub checkconfig () {
        if (defined $config{tla_wrapper} && length $config{tla_wrapper}) {
                push @{$config{wrappers}}, {
                        wrapper => $config{tla_wrapper},
                        wrappermode => (defined $config{tla_wrappermode} ? $config{tla_wrappermode} : "06755"),
                };
        }
-} #}}}
+}
 
-sub getsetup () { #{{{
+sub getsetup () {
        return
+               plugin => {
+                       safe => 0, # rcs plugin
+                       rebuild => undef,
+                       section => "rcs",
+               },
                tla_wrapper => {
                        type => "string",
                        #example => "", # TODO example
-                       description => "tla post-commit executable to generate",
+                       description => "tla post-commit hook to generate",
                        safe => 0, # file
                        rebuild => 0,
                },
@@ -62,9 +64,9 @@ sub getsetup () { #{{{
                        safe => 1,
                        rebuild => 1,
                },
-} #}}}
+}
 
-sub quiet_system (@) { #{{{
+sub quiet_system (@) {
        # See Debian bug #385939.
        open (SAVEOUT, ">&STDOUT");
        close STDOUT;
@@ -74,17 +76,17 @@ sub quiet_system (@) { #{{{
        open (STDOUT, ">&SAVEOUT");
        close SAVEOUT;
        return $ret;
-} #}}}
+}
 
-sub rcs_update () { #{{{
+sub rcs_update () {
        if (-d "$config{srcdir}/{arch}") {
                if (quiet_system("tla", "replay", "-d", $config{srcdir}) != 0) {
                        warn("tla replay failed\n");
                }
        }
-} #}}}
+}
 
-sub rcs_prepedit ($) { #{{{
+sub rcs_prepedit ($) {
        my $file=shift;
 
        if (-d "$config{srcdir}/{arch}") {
@@ -93,9 +95,9 @@ sub rcs_prepedit ($) { #{{{
                my $rev=`tla tree-id $config{srcdir}`;
                return defined $rev ? $rev : "";
        }
-} #}}}
+}
 
-sub rcs_commit ($$$;$$) { #{{{
+sub rcs_commit ($$$;$$) {
        my $file=shift;
        my $message=shift;
        my $rcstoken=shift;
@@ -134,7 +136,7 @@ sub rcs_commit ($$$;$$) { #{{{
                }
        }
        return undef # success
-} #}}}
+}
 
 sub rcs_commit_staged ($$$) {
        # Commits all staged changes. Changes can be staged using rcs_add,
@@ -144,7 +146,7 @@ sub rcs_commit_staged ($$$) {
        error("rcs_commit_staged not implemented for tla"); # TODO
 }
 
-sub rcs_add ($) { #{{{
+sub rcs_add ($) {
        my $file=shift;
 
        if (-d "$config{srcdir}/{arch}") {
@@ -152,19 +154,19 @@ sub rcs_add ($) { #{{{
                        warn("tla add failed\n");
                }
        }
-} #}}}
+}
 
-sub rcs_remove ($) { # {{{
+sub rcs_remove ($) {
        my $file = shift;
 
        error("rcs_remove not implemented for tla"); # TODO
-} #}}}
+}
 
 sub rcs_rename ($$) { # {{{a
        my ($src, $dest) = @_;
 
        error("rcs_rename not implemented for tla"); # TODO
-} #}}}
+}
 
 sub rcs_recentchanges ($) {
        my $num=shift;
@@ -238,7 +240,7 @@ sub rcs_recentchanges ($) {
        return @ret;
 }
 
-sub rcs_diff ($) { #{{{
+sub rcs_diff ($) {
        my $rev=shift;
        my $logs = `tla logs -d $config{srcdir}`;
        my @changesets = reverse split(/\n/, $logs);
@@ -250,9 +252,9 @@ sub rcs_diff ($) { #{{{
 
        my $revminusone = $changesets[$i+1];
        return `tla diff -d $config{srcdir} $revminusone`;
-} #}}}
+}
 
-sub rcs_getctime ($) { #{{{
+sub rcs_getctime ($) {
        my $file=shift;
        eval q{use Date::Parse};
        error($@) if $@;
@@ -280,6 +282,6 @@ sub rcs_getctime ($) { #{{{
        my $date=str2time($sdate, 'UTC');
        debug("found ctime ".localtime($date)." for $file");
        return $date;
-} #}}}
+}
 
 1