X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/bd7221ae5450e14e9641e01e0c2890a8f018ddb4..462d8f8015db338c7a5c718f1b92006c2bee9cfe:/IkiWiki/Plugin/bzr.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 562d5d389..99a07d2c0 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -5,6 +5,7 @@ use warnings; use strict; use IkiWiki; use Encode; +use URI::Escape q{uri_escape_utf8}; use open qw{:utf8 :std}; sub import { @@ -194,7 +195,7 @@ sub rcs_add ($) { sub rcs_remove ($) { my ($file) = @_; - my @cmdline = ("bzr", "rm", "--force", "--quiet", "$config{srcdir}/$file"); + my @cmdline = ("bzr", "rm", "--quiet", "$config{srcdir}/$file"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } @@ -242,8 +243,10 @@ sub rcs_recentchanges ($) { # Skip source name in renames $filename =~ s/^.* => //; + my $efilename = uri_escape_utf8($filename); + my $diffurl = defined $config{'diffurl'} ? $config{'diffurl'} : ""; - $diffurl =~ s/\[\[file\]\]/$filename/go; + $diffurl =~ s/\[\[file\]\]/$efilename/go; $diffurl =~ s/\[\[file-id\]\]/$fileid/go; $diffurl =~ s/\[\[r2\]\]/$info->{revno}/go; @@ -271,8 +274,9 @@ sub rcs_recentchanges ($) { return @ret; } -sub rcs_diff ($) { +sub rcs_diff ($;$) { my $taintedrev=shift; + my $maxlines=shift; my ($rev) = $taintedrev =~ /^(\d+(\.\d+)*)$/; # untaint my $prevspec = "before:" . $rev; @@ -281,8 +285,11 @@ sub rcs_diff ($) { "--new", $config{srcdir}, "-r", $prevspec . ".." . $revspec); open (my $out, "@cmdline |"); - - my @lines = <$out>; + my @lines; + while (my $line=<$out>) { + last if defined $maxlines && @lines == $maxlines; + push @lines, $line; + } if (wantarray) { return @lines; }