From: Joey Hess <joey@kodama.kitenet.net>
Date: Mon, 21 Jul 2008 17:40:06 +0000 (-0400)
Subject: All rcs backends need to implement rcs_remove
X-Git-Tag: 2.55~102
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/c6d1ae33d224486f347d39005e516f514c613d3c

All rcs backends need to implement rcs_remove

(Done for svn, git.)
---

diff --git a/IkiWiki/Rcs/Stub.pm b/IkiWiki/Rcs/Stub.pm
index 6b69e65dc..375591c96 100644
--- a/IkiWiki/Rcs/Stub.pm
+++ b/IkiWiki/Rcs/Stub.pm
@@ -33,6 +33,12 @@ sub rcs_add ($) {
 	# prepare for it to be checked in when rcs_commit is called.
 }
 
+sub rcs_remove ($) {
+	# Remove a file. The filename is relative to the root of the srcdir.
+	# Note that this should not check the removal in, it should only
+	# prepare for it to be checked in when rcs_commit is called.
+}
+
 sub rcs_recentchanges ($) {
 	# Examine the RCS history and generate a list of recent changes.
 	# The data structure returned for each change is:
diff --git a/IkiWiki/Rcs/bzr.pm b/IkiWiki/Rcs/bzr.pm
index 0dc456de2..ca60190ea 100644
--- a/IkiWiki/Rcs/bzr.pm
+++ b/IkiWiki/Rcs/bzr.pm
@@ -89,6 +89,12 @@ sub rcs_add ($) { # {{{
 	}
 } #}}}
 
+sub rcs_remove ($) { # {{{
+	my ($file) = @_;
+
+	error("rcs_remove not implemented for bzr"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
 	my ($num) = @_;
 
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm
index 7fb612a39..b02b286bd 100644
--- a/IkiWiki/Rcs/git.pm
+++ b/IkiWiki/Rcs/git.pm
@@ -348,6 +348,14 @@ sub rcs_add ($) { # {{{
 	run_or_cry('git', 'add', $file);
 } #}}}
 
+sub rcs_remove ($) { # {{{
+	# Remove file from archive.
+
+	my ($file) = @_;
+
+	run_or_cry('git', 'rm', '-f', $file);
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
 	# List of recent changes.
 
diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm
index bfe6ba49c..1bfcf6242 100644
--- a/IkiWiki/Rcs/mercurial.pm
+++ b/IkiWiki/Rcs/mercurial.pm
@@ -101,6 +101,12 @@ sub rcs_add ($) { # {{{
 	}
 } #}}}
 
+sub rcs_remove ($) { # {{{
+	my ($file) = @_;
+
+	error("rcs_remove not implemented for mercurial"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
 	my ($num) = @_;
 
diff --git a/IkiWiki/Rcs/monotone.pm b/IkiWiki/Rcs/monotone.pm
index ce4a2a3ed..948edac0a 100644
--- a/IkiWiki/Rcs/monotone.pm
+++ b/IkiWiki/Rcs/monotone.pm
@@ -370,6 +370,12 @@ sub rcs_add ($) { #{{{
 	}
 } #}}}
 
+sub rcs_remove ($) { # {{{
+	my $file = shift;
+
+	error("rcs_remove not implemented for monotone"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) { #{{{
 	my $num=shift;
 	my @ret;
diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm
index 6a822e896..6c15c2ca9 100644
--- a/IkiWiki/Rcs/svn.pm
+++ b/IkiWiki/Rcs/svn.pm
@@ -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;
diff --git a/IkiWiki/Rcs/tla.pm b/IkiWiki/Rcs/tla.pm
index e7fed9ad8..29dbd092a 100644
--- a/IkiWiki/Rcs/tla.pm
+++ b/IkiWiki/Rcs/tla.pm
@@ -88,6 +88,12 @@ sub rcs_add ($) { #{{{
 	}
 } #}}}
 
+sub rcs_remove ($) { # {{{
+	my $file = shift;
+
+	error("rcs_remove not implemented for tla"); # TODO
+} #}}}
+
 sub rcs_recentchanges ($) {
 	my $num=shift;
 	my @ret;
diff --git a/debian/changelog b/debian/changelog
index 78a7af001..1c7d03b97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ ikiwiki (2.55) UNRELEASED; urgency=low
   * prefix_directives enabled in doc wiki, all preprocessor directives
     converted. (Simon McVittie)
   * editpage: Don't show attachments link when attachments are disabled.
+  * All rcs backends need to implement rcs_rm. (Done for svn, git).
 
  -- Joey Hess <joeyh@debian.org>  Mon, 21 Jul 2008 11:35:46 -0400
 
diff --git a/doc/todo/Moving_Pages.mdwn b/doc/todo/Moving_Pages.mdwn
index 7485f06fd..8ec61e4f5 100644
--- a/doc/todo/Moving_Pages.mdwn
+++ b/doc/todo/Moving_Pages.mdwn
@@ -395,16 +395,10 @@ is checked too.
 
 ## RCS
 
-Two new optional functions are added to the RCS interface:
+Two new functions are added to the RCS interface:
 
-* `rcs_delete(file, message, rcstoken, user, ipaddr)`
-* `rcs_rename(old, new, message, rcstoken, user, ipaddr)`
-
-The page move/rename code will check if these are not available, and error
-out.
-
-Similar to `rcs_commit` both of these take a rcstoken, which is generated
-by an earlier `rcs_prepedit`.
+* `rcs_remove(file)`
+* `rcs_rename(old, new)`
 
 ## conflicts