diff options
author | Joey Hess <joey@kitenet.net> | 2010-12-29 19:58:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-12-29 19:58:49 -0400 |
commit | 4fb26f4e60f2df282fc972e4b8506ccd306de789 (patch) | |
tree | ba95769fbc59a296364076fd2e649f3ebc0438af /IkiWiki/Plugin/bzr.pm | |
parent | 7d48813166c637e5bb2e11ef690fc7521716bd31 (diff) | |
download | ikiwiki-4fb26f4e60f2df282fc972e4b8506ccd306de789.tar ikiwiki-4fb26f4e60f2df282fc972e4b8506ccd306de789.tar.gz |
Add a second parameter to the rcs_diff hook, and avoid bloating memory reading in enormous commits.
Diffstat (limited to 'IkiWiki/Plugin/bzr.pm')
-rw-r--r-- | IkiWiki/Plugin/bzr.pm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 562d5d389..3bc4ea8dd 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -271,8 +271,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 +282,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; } |