All rcs backends need to implement rcs_remove
[ikiwiki.git] / IkiWiki / Rcs / svn.pm
index f7d2242f043209cd9ca7291d3af6186c0407990e..6c15c2ca9b260bda8efd204d0be3d0a4b0f6c8af 100644 (file)
@@ -1,12 +1,12 @@
 #!/usr/bin/perl
 
+package IkiWiki::Rcs::svn;
+
 use warnings;
 use strict;
 use IkiWiki;
 use POSIX qw(setlocale LC_CTYPE);
 
-package IkiWiki::Rcs::svn;
-
 sub import { #{{{
        if (exists $IkiWiki::config{svnpath}) {
                # code depends on the path not having extraneous slashes
@@ -134,6 +134,23 @@ sub rcs_add ($) { #{{{
        }
 } #}}}
 
+sub rcs_remove ($) { #{{{
+       # filename is relative to the root of the srcdir
+       my $file=shift;
+
+       if (-d "$config{srcdir}/.svn") {
+               my $parent=dirname($file);
+               while (! -d "$config{srcdir}/$parent/.svn") {
+                       $file=$parent;
+                       $parent=dirname($file);
+               }
+               
+               if (system("svn", "rm", "--force", "--quiet", "$config{srcdir}/$file") != 0) {
+                       warn("svn rm failed\n");
+               }
+       }
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
        my $num=shift;
        my @ret;
@@ -217,6 +234,11 @@ sub rcs_recentchanges ($) { #{{{
        return @ret;
 } #}}}
 
+sub rcs_diff ($) { #{{{
+       my $rev=possibly_foolish_untaint(int(shift));
+       return `svnlook diff $config{svnrepo} -r$rev --no-diff-deleted`;
+} #}}}
+
 sub rcs_getctime ($) { #{{{
        my $file=shift;