diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-06 15:08:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-06 15:08:12 -0400 |
commit | 238e8b95a5b084e7131d3314b78419b9404cba4c (patch) | |
tree | 448ac7310509725d8d344fe0b9aba721f6ed127f /IkiWiki/Plugin | |
parent | 58a0698d921efe0daa932599515f6b41b2da4044 (diff) | |
download | ikiwiki-238e8b95a5b084e7131d3314b78419b9404cba4c.tar ikiwiki-238e8b95a5b084e7131d3314b78419b9404cba4c.tar.gz |
convert rcs_revert to only stage the reversion
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/git.pm | 13 | ||||
-rw-r--r-- | IkiWiki/Plugin/recentchanges.pm | 13 |
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 { |