diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-07-22 16:14:33 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-07-22 16:14:33 -0400 |
commit | cbddb5a4b8e0e2fb63886ad9d1cf8a087cdb83b1 (patch) | |
tree | fab8316d385e89d959189cc199e79457dcb90486 /IkiWiki/Plugin | |
parent | cf9620074acb1309118f08094229ce21d7352ed0 (diff) |
add rcs_commit_staged and rcs_rename
Implemented for git and svn so far.
Note that rcs_commit_staged does assume that the rcs has the ability to
"stage" multiple changes for a later commit. Support for this varies, but
all we really care about is staging removals and renames, which, AFAIK, all
modern rcs's support.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/remove.pm | 5 | ||||
-rw-r--r-- | IkiWiki/Plugin/rename.pm | 13 |
2 files changed, 10 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index f263db9b8..4c73ed9e5 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -171,11 +171,10 @@ sub sessioncgi ($$) { #{{{ if ($config{rcs}) { IkiWiki::disable_commit_hook(); foreach my $file (@files) { - my $token=IkiWiki::rcs_prepedit($file); IkiWiki::rcs_remove($file); - IkiWiki::rcs_commit($file, gettext("removed"), - $token, $session->param("name"), $ENV{REMOTE_ADDR}); } + IkiWiki::rcs_commit_staged(gettext("removed"), + $session->param("name"), $ENV{REMOTE_ADDR}); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index c0ccb25ce..32888877f 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -66,7 +66,9 @@ sub check_canrename ($$$$$$$) { #{{{ # Must be editable. IkiWiki::check_canedit($dest, $q, $session); if ($attachment) { - IkiWiki::Plugin::attachment::check_canattach($session, $dest, $destfile); + # Note that $srcfile is used here, not $destfile, + # because it wants the current file, to check it. + IkiWiki::Plugin::attachment::check_canattach($session, $dest, $srcfile); } } } #}}} @@ -210,15 +212,16 @@ sub sessioncgi ($$) { #{{{ check_canrename($src, $srcfile, $dest, $destfile, $q, $session, $q->param("attachment")); + # Ensures that the dest directory exists and is ok. + IkIWiki::prep_writefile($destfile, $config{srcdir}); + # Do rename, and update the wiki. require IkiWiki::Render; if ($config{rcs}) { IkiWiki::disable_commit_hook(); - my $token=IkiWiki::rcs_prepedit($srcfile); IkiWiki::rcs_rename($srcfile, $destfile); - # TODO commit destfile too - IkiWiki::rcs_commit($srcfile, gettext("rename $srcfile to $destfile"), - $token, $session->param("name"), $ENV{REMOTE_ADDR}); + IkiWiki::rcs_commit_staged(gettext("rename $srcfile to $destfile"), + $session->param("name"), $ENV{REMOTE_ADDR}); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } |