]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/monotone.pm
monotone: When getting the log, tell monotone how many entries we want, rather than...
[git.ikiwiki.info.git] / IkiWiki / Plugin / monotone.pm
index a591ecec56e3f099e6bf2cff5bc4a565f753a71f..3a8b267a393f5d69cdccc1577df795d2504ce73d 100644 (file)
@@ -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);
@@ -58,7 +55,7 @@ sub checkconfig () { #{{{
                error("Monotone version too old, is $version but required 0.38");
        }
 
-       if (length $config{mtn_wrapper}) {
+       if (defined $config{mtn_wrapper} && length $config{mtn_wrapper}) {
                push @{$config{wrappers}}, {
                        wrapper => $config{mtn_wrapper},
                        wrappermode => (defined $config{mtn_wrappermode} ? $config{mtn_wrappermode} : "06755"),
@@ -68,10 +65,14 @@ sub checkconfig () { #{{{
 
 sub getsetup () { #{{{
        return
+               plugin => {
+                       safe => 0, # rcs plugin
+                       rebuild => undef,
+               },
                mtn_wrapper => {
                        type => "string",
                        example => "/srv/mtn/wiki/_MTN/ikiwiki-netsync-hook",
-                       description => "monotone netsync hook executable to generate",
+                       description => "monotone netsync hook to generate",
                        safe => 0, # file
                        rebuild => 0,
                },
@@ -524,13 +525,12 @@ sub rcs_recentchanges ($) { #{{{
        my $child = open(MTNLOG, "-|");
        if (! $child) {
                exec("mtn", "log", "--root=$config{mtnrootdir}", "--no-graph",
-                    "--brief") || error("mtn log failed to run");
+                    "--brief", "--last=$num") || error("mtn log failed to run");
        }
 
-       while (($num >= 0) and (my $line = <MTNLOG>)) {
+       while (my $line = <MTNLOG>) {
                if ($line =~ m/^($sha1_pattern)/) {
                        push @revs, $1;
-                       $num -= 1;
                }
        }
        close MTNLOG || debug("mtn log exited $?");