summaryrefslogtreecommitdiff
path: root/IkiWiki/Rcs
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Rcs')
-rw-r--r--IkiWiki/Rcs/Stub.pm6
-rw-r--r--IkiWiki/Rcs/git.pm6
-rw-r--r--IkiWiki/Rcs/mercurial.pm4
-rw-r--r--IkiWiki/Rcs/monotone.pm4
-rw-r--r--IkiWiki/Rcs/svn.pm5
-rw-r--r--IkiWiki/Rcs/tla.pm14
6 files changed, 39 insertions, 0 deletions
diff --git a/IkiWiki/Rcs/Stub.pm b/IkiWiki/Rcs/Stub.pm
index df347f6a9..d94daf8bc 100644
--- a/IkiWiki/Rcs/Stub.pm
+++ b/IkiWiki/Rcs/Stub.pm
@@ -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 ($) {
# Optional, used to get the page creation time from the RCS.
error gettext("getctime not implemented");
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm
index 26a6f4266..376d03c78 100644
--- a/IkiWiki/Rcs/git.pm
+++ b/IkiWiki/Rcs/git.pm
@@ -419,6 +419,12 @@ sub rcs_recentchanges ($) { #{{{
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 ($) { #{{{
my $file=shift;
# Remove srcdir prefix
diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm
index 8b1f2c6a1..a042f4a45 100644
--- a/IkiWiki/Rcs/mercurial.pm
+++ b/IkiWiki/Rcs/mercurial.pm
@@ -148,6 +148,10 @@ sub rcs_recentchanges ($) { #{{{
return @ret;
} #}}}
+sub rcs_diff ($) { #{{{
+ # TODO
+} #}}}
+
sub rcs_getctime ($) { #{{{
my ($file) = @_;
diff --git a/IkiWiki/Rcs/monotone.pm b/IkiWiki/Rcs/monotone.pm
index 6a156892a..06615da11 100644
--- a/IkiWiki/Rcs/monotone.pm
+++ b/IkiWiki/Rcs/monotone.pm
@@ -475,6 +475,10 @@ sub rcs_recentchanges ($) { #{{{
return @ret;
} #}}}
+sub rcs_diff ($) { #{{{
+ # TODO
+} #}}}
+
sub rcs_getctime ($) { #{{{
my $file=shift;
diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm
index f7d2242f0..7bad40747 100644
--- a/IkiWiki/Rcs/svn.pm
+++ b/IkiWiki/Rcs/svn.pm
@@ -217,6 +217,11 @@ sub rcs_recentchanges ($) { #{{{
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 ($) { #{{{
my $file=shift;
diff --git a/IkiWiki/Rcs/tla.pm b/IkiWiki/Rcs/tla.pm
index 231496445..2890ff8c7 100644
--- a/IkiWiki/Rcs/tla.pm
+++ b/IkiWiki/Rcs/tla.pm
@@ -160,6 +160,20 @@ sub rcs_recentchanges ($) {
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 ($) { #{{{
my $file=shift;
eval q{use Date::Parse};