diff options
author | Joey Hess <joey@kitenet.net> | 2011-07-19 11:44:09 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-07-19 11:44:26 -0400 |
commit | e04cb1ffd39f64c7f3216dcd6b7a69308754bef0 (patch) | |
tree | 8083cddd3394817b65ff8fafb6cdd4533906d39d /IkiWiki/Plugin/mercurial.pm | |
parent | 339b95e719990ea6fec1ed4ef3f06e26edcf8213 (diff) | |
download | ikiwiki-e04cb1ffd39f64c7f3216dcd6b7a69308754bef0.tar ikiwiki-e04cb1ffd39f64c7f3216dcd6b7a69308754bef0.tar.gz |
mercurial: Implement rcs_diff. (Daniel Andersson)
Diffstat (limited to 'IkiWiki/Plugin/mercurial.pm')
-rw-r--r-- | IkiWiki/Plugin/mercurial.pm | 18 |
1 files changed, 17 insertions, 1 deletions
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); + } } { |