From e04cb1ffd39f64c7f3216dcd6b7a69308754bef0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 Jul 2011 11:44:09 -0400 Subject: [PATCH] mercurial: Implement rcs_diff. (Daniel Andersson) --- IkiWiki/Plugin/mercurial.pm | 18 +++++++++++++++++- debian/changelog | 9 +++++---- doc/rcs.mdwn | 2 +- ...ial_backend__44___based_on_Git_backend.mdwn | 2 ++ 4 files changed, 25 insertions(+), 6 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); + } } { diff --git a/debian/changelog b/debian/changelog index 5e9c91016..6499a40b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,13 @@ ikiwiki (3.20110716) UNRELEASED; urgency=low - * mercurial: openid nicknames are now used when committing. (Daniel Andersson) - * mercurial: implement rcs_commit_staged so comments, attachments, etc + * mercurial: Openid nicknames are now used when committing. (Daniel Andersson) + * mercurial: Implement rcs_commit_staged so comments, attachments, etc can be used. (Daniel Andersson) - * mercurial: implement rcs_rename and rcs_remove. (Daniel Andersson) - * mercurial: fix viewing of a diff containing non-utf8 changes. + * mercurial: Implement rcs_rename, rcs_remove. (Daniel Andersson) + * mercurial: Fix viewing of a diff containing non-utf8 changes. (Daniel Andersson) * mercurial: Make both rcs_getctime and rcs_getmtime fast. (Daniel Andersson) + * mercurial: Implement rcs_diff. (Daniel Andersson) -- Joey Hess Tue, 19 Jul 2011 11:22:52 -0400 diff --git a/doc/rcs.mdwn b/doc/rcs.mdwn index 61aa76410..1f6b3c24e 100644 --- a/doc/rcs.mdwn +++ b/doc/rcs.mdwn @@ -20,7 +20,7 @@ auto.setup |yes |yes |incomplete|yes |incomplete |yes `rcs_commit_staged` |yes |yes |yes |yes |yes |yes |no |yes `rcs_rename` |yes |yes |yes |yes |yes |yes |no |yes `rcs_remove` |yes |yes |yes |yes |yes |yes |no |yes -`rcs_diff` |yes |yes |yes |yes |no |yes |yes |yes +`rcs_diff` |yes |yes |yes |yes |yes |yes |yes |yes `rcs_getctime` |fast |slow |slow |slow |fast |slow |slow |slow `rcs_getmtime` |fast |slow |slow |slow |fast |no |no |no `rcs_preprevert` |yes |no |no |no |no |no |no |no diff --git a/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn b/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn index 8843e0c86..42cfe1a19 100644 --- a/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn +++ b/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn @@ -6,6 +6,8 @@ CC of `rcs_diff` implementation in `git.pm` with few changes. Mercurial provides --[[Daniel Andersson]] +> Guess that makes sense, [[done]] --[[Joey]] + --- diff -r 1b6c46b62a28 -r cc73d670bf99 Plugin/mercurial.pm -- 2.26.2