aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-10-06 15:08:12 -0400
committerJoey Hess <joey@kitenet.net>2010-10-06 15:08:12 -0400
commit238e8b95a5b084e7131d3314b78419b9404cba4c (patch)
tree448ac7310509725d8d344fe0b9aba721f6ed127f /IkiWiki
parent58a0698d921efe0daa932599515f6b41b2da4044 (diff)
downloadikiwiki-238e8b95a5b084e7131d3314b78419b9404cba4c.tar
ikiwiki-238e8b95a5b084e7131d3314b78419b9404cba4c.tar.gz
convert rcs_revert to only stage the reversion
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/git.pm13
-rw-r--r--IkiWiki/Plugin/recentchanges.pm13
2 files changed, 13 insertions, 13 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index 3ccaa446a..996ab6fba 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -846,19 +846,14 @@ sub rcs_preprevert (@) {
[git_parse_changes(git_commit_info($rev, 1))]);
}
-sub rcs_revert (@) {
- # Try to revert the given patch; returns undef on _success_.
- my %params = @_;
- my $rev = $params{rev};
+sub rcs_revert ($) {
+ # Try to revert the given rev; returns undef on _success_.
+ my $rev = $shift;
if (run_or_non('git', 'revert', '--no-commit', $rev)) {
- debug "Committing revert for patch '$rev'.";
- rcs_commit_staged(message =>
- sprintf(gettext("This reverts commit %s"), $rev), @_);
+ return undef;
}
else {
- # No idea what is actually getting reverted, so all we can
- # do is say we failed.
run_or_die('git', 'reset', '--hard');
return sprintf(gettext("Failed to revert commit %s"), $rev);
}
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index 439241b93..44c981548 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -101,12 +101,17 @@ sub sessioncgi ($$) {
if ($form->submitted eq 'Revert' && $form->validate) {
IkiWiki::checksessionexpiry($q, $session, $q->param('sid'));
IkiWiki::disable_commit_hook();
- my $r = IkiWiki::rcs_revert(
- session => $session,
- rev => $rev);
+ my $r = IkiWiki::rcs_revert($rev);
+ if (! defined $r) { # success
+ rcs_commit_staged(
+ message => sprintf(gettext("This reverts commit %s"), $rev),
+ session => $session,
+ rev => $rev,
+ );
+ }
IkiWiki::enable_commit_hook();
- if ($r) {
+ if (defined $r) {
die "Revert '$rev' failed.";
}
else {