X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/b4db945b34d0475894467792acc69038d5b25306..e04cb1ffd39f64c7f3216dcd6b7a69308754bef0:/IkiWiki/Plugin/mercurial.pm diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index e64e00512..102b4692b 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -307,7 +307,23 @@ sub rcs_recentchanges ($) { } sub rcs_diff ($;$) { - # TODO + my $rev=shift; + my $maxlines=shift; + my @lines; + my $addlines=sub { + my $line=shift; + return if defined $maxlines && @lines == $maxlines; + push @lines, $line."\n" + if (@lines || $line=~/^diff --git/); + return 1; + }; + safe_hg(undef, $addlines, "hg", "diff", "-c", $rev, "-g"); + if (wantarray) { + return @lines; + } + else { + return join("", @lines); + } } {