* Add recentchangesdiff plugin that adds diffs to the recentchanges feeds.
* rcs_diff is a new function that rcs modules should implement. * Implemented rcs_diff for git, svn, and tla (tla version untested). Mercurial and monotone still todo.master
parent
59379d0205
commit
d93aaed791
|
@ -133,7 +133,7 @@ sub store ($$$) { #{{{
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# escape wikilinks and preprocessor stuff in commit messages
|
# escape wikilinks and preprocessor stuff in commit messages
|
||||||
if (ref $change->{message}) {
|
if (ref $change->{message}) {
|
||||||
foreach my $field (@{$change->{message}}) {
|
foreach my $field (@{$change->{message}}) {
|
||||||
if (exists $field->{line}) {
|
if (exists $field->{line}) {
|
||||||
|
@ -150,7 +150,8 @@ sub store ($$$) { #{{{
|
||||||
wikiname => $config{wikiname},
|
wikiname => $config{wikiname},
|
||||||
);
|
);
|
||||||
IkiWiki::run_hooks(pagetemplate => sub {
|
IkiWiki::run_hooks(pagetemplate => sub {
|
||||||
shift->(page => $page, destpage => $page, template => $template);
|
shift->(page => $page, destpage => $page,
|
||||||
|
template => $template, rev => $change->{rev});
|
||||||
});
|
});
|
||||||
|
|
||||||
my $file=$page."._change";
|
my $file=$page."._change";
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
package IkiWiki::Plugin::recentchangesdiff;
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use IkiWiki 2.00;
|
||||||
|
|
||||||
|
sub import { #{{{
|
||||||
|
hook(type => "pagetemplate", id => "recentchangesdiff",
|
||||||
|
call => \&pagetemplate);
|
||||||
|
} #}}}
|
||||||
|
|
||||||
|
sub pagetemplate (@) { #{{{
|
||||||
|
my %params=@_;
|
||||||
|
my $template=$params{template};
|
||||||
|
if ($config{rcs} && exists $params{rev} && length $params{rev} &&
|
||||||
|
$template->query(name => "diff")) {
|
||||||
|
my $diff=IkiWiki::rcs_diff($params{rev});
|
||||||
|
if (defined $diff && length $diff) {
|
||||||
|
# escape links and preprocessor stuff
|
||||||
|
$diff =~ s/(?<!\\)\[\[/\\\[\[/g;
|
||||||
|
$template->param(diff => $diff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} #}}}
|
||||||
|
|
||||||
|
1
|
|
@ -57,6 +57,12 @@ sub rcs_recentchanges ($) {
|
||||||
# }
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub rcs_diff ($) {
|
||||||
|
# Optional, used to get diffs for recentchanges.
|
||||||
|
# The parameter is the rev from rcs_recentchanges.
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
sub rcs_getctime ($) {
|
sub rcs_getctime ($) {
|
||||||
# Optional, used to get the page creation time from the RCS.
|
# Optional, used to get the page creation time from the RCS.
|
||||||
error gettext("getctime not implemented");
|
error gettext("getctime not implemented");
|
||||||
|
|
|
@ -419,6 +419,12 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
return @rets;
|
return @rets;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
sub rcs_diff ($) { #{{{
|
||||||
|
my $rev=shift;
|
||||||
|
my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint
|
||||||
|
return join("\n", run_or_non("git", "diff", "$sha1^", $sha1));
|
||||||
|
} #}}}
|
||||||
|
|
||||||
sub rcs_getctime ($) { #{{{
|
sub rcs_getctime ($) { #{{{
|
||||||
my $file=shift;
|
my $file=shift;
|
||||||
# Remove srcdir prefix
|
# Remove srcdir prefix
|
||||||
|
|
|
@ -148,6 +148,10 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
return @ret;
|
return @ret;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
sub rcs_diff ($) { #{{{
|
||||||
|
# TODO
|
||||||
|
} #}}}
|
||||||
|
|
||||||
sub rcs_getctime ($) { #{{{
|
sub rcs_getctime ($) { #{{{
|
||||||
my ($file) = @_;
|
my ($file) = @_;
|
||||||
|
|
||||||
|
|
|
@ -475,6 +475,10 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
return @ret;
|
return @ret;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
sub rcs_diff ($) { #{{{
|
||||||
|
# TODO
|
||||||
|
} #}}}
|
||||||
|
|
||||||
sub rcs_getctime ($) { #{{{
|
sub rcs_getctime ($) { #{{{
|
||||||
my $file=shift;
|
my $file=shift;
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,11 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
return @ret;
|
return @ret;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
sub rcs_diff ($) { #{{{
|
||||||
|
my $rev=possibly_foolish_untaint(int(shift));
|
||||||
|
return scalar `svnlook diff $config{svnrepo} -r$rev --no-diff-deleted`;
|
||||||
|
} #}}}
|
||||||
|
|
||||||
sub rcs_getctime ($) { #{{{
|
sub rcs_getctime ($) { #{{{
|
||||||
my $file=shift;
|
my $file=shift;
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,20 @@ sub rcs_recentchanges ($) {
|
||||||
return @ret;
|
return @ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub rcs_diff ($) { #{{{
|
||||||
|
my $rev=shift;
|
||||||
|
my $logs = `tla logs -d $config{srcdir}`;
|
||||||
|
my @changesets = reverse split(/\n/, $logs);
|
||||||
|
my $i;
|
||||||
|
|
||||||
|
for($i=0;$i<$#changesets;$i++) {
|
||||||
|
last if $changesets[$i] eq $rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $revminusone = $changesets[$i+1];
|
||||||
|
return scalar `tla diff -d $config{srcdir} $revminusone`;
|
||||||
|
} #}}}
|
||||||
|
|
||||||
sub rcs_getctime ($) { #{{{
|
sub rcs_getctime ($) { #{{{
|
||||||
my $file=shift;
|
my $file=shift;
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
|
|
|
@ -9,6 +9,12 @@ ikiwiki (2.41) UNRELEASED; urgency=low
|
||||||
* The meta plugin now allows for the robots tag to be specified without the
|
* The meta plugin now allows for the robots tag to be specified without the
|
||||||
risk of it being scrubbed.
|
risk of it being scrubbed.
|
||||||
|
|
||||||
|
[ Joey Hess ]
|
||||||
|
* Add recentchangesdiff plugin that adds diffs to the recentchanges feeds.
|
||||||
|
* rcs_diff is a new function that rcs modules should implement.
|
||||||
|
* Implemented rcs_diff for git, svn, and tla (tla version untested).
|
||||||
|
Mercurial and monotone still todo.
|
||||||
|
|
||||||
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
||||||
|
|
||||||
ikiwiki (2.40) unstable; urgency=low
|
ikiwiki (2.40) unstable; urgency=low
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[[template id=plugin name=recentchangesdiff core=0 author="[[Joey]]"]]
|
||||||
|
|
||||||
|
This plugin extends the [[recentchanges]] plugin, adding a diff for each
|
||||||
|
change. The diffs are by default hidden from display on the recentchanges
|
||||||
|
page, but will display in its feeds. The [[rcs]] must have implemented
|
||||||
|
support for the `rcs_diff()` function for any diffs to be generated.
|
|
@ -92,6 +92,9 @@ div.recentchanges {
|
||||||
.recentchanges .desc {
|
.recentchanges .desc {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.recentchanges .diff {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.recentchanges .committer {
|
.recentchanges .committer {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2008-02-24 16:02-0500\n"
|
"POT-Creation-Date: 2008-03-03 15:41-0500\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -508,7 +508,7 @@ msgstr ""
|
||||||
msgid "(not toggleable in preview mode)"
|
msgid "(not toggleable in preview mode)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Rcs/Stub.pm:62
|
#: ../IkiWiki/Rcs/Stub.pm:68
|
||||||
msgid "getctime not implemented"
|
msgid "getctime not implemented"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -33,4 +33,11 @@
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
</TMPL_LOOP>
|
</TMPL_LOOP>
|
||||||
</div>
|
</div>
|
||||||
|
<TMPL_IF NAME="DIFF">
|
||||||
|
<div class=diff>
|
||||||
|
<pre>
|
||||||
|
<TMPL_VAR NAME="DIFF" ESCAPE="HTML">
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</TMPL_IF>
|
||||||
<!-- <TMPL_VAR REV> -->
|
<!-- <TMPL_VAR REV> -->
|
||||||
|
|
Loading…
Reference in New Issue