X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/ffb27000431f744f2cec9d198d0a0d8cbb0bd405..62aaf67a32ada70d1eaa5f29cf80824642eeb7ff:/IkiWiki/Rcs/svn.pm diff --git a/IkiWiki/Rcs/svn.pm b/IkiWiki/Rcs/svn.pm index ee5065379..af4641d3a 100644 --- a/IkiWiki/Rcs/svn.pm +++ b/IkiWiki/Rcs/svn.pm @@ -60,13 +60,22 @@ sub rcs_prepedit ($) { #{{{ } } #}}} -sub rcs_commit ($$$) { #{{{ +sub rcs_commit ($$$;$$) { #{{{ # Tries to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on failure. # The file is relative to the srcdir. my $file=shift; my $message=shift; my $rcstoken=shift; + my $user=shift; + my $ipaddr=shift; + + if (defined $user) { + $message="web commit by $user".(length $message ? ": $message" : ""); + } + elsif (defined $ipaddr) { + $message="web commit from $ipaddr".(length $message ? ": $message" : ""); + } if (-d "$config{srcdir}/.svn") { # Check to see if the page has been changed by someone @@ -76,9 +85,8 @@ sub rcs_commit ($$$) { #{{{ if (defined $rev && defined $oldrev && $rev != $oldrev) { # Merge their changes into the file that we've # changed. - chdir($config{srcdir}); # svn merge wants to be here if (system("svn", "merge", "--quiet", "-r$oldrev:$rev", - "$config{srcdir}/$file") != 0) { + "$config{srcdir}/$file", "$config{srcdir}/$file") != 0) { warn("svn merge -r$oldrev:$rev failed\n"); } } @@ -86,7 +94,7 @@ sub rcs_commit ($$$) { #{{{ if (system("svn", "commit", "--quiet", "--encoding", "UTF-8", "-m", possibly_foolish_untaint($message), - "$config{srcdir}") != 0) { + $config{srcdir}) != 0) { my $conflict=readfile("$config{srcdir}/$file"); if (system("svn", "revert", "--quiet", "$config{srcdir}/$file") != 0) { warn("svn revert failed\n"); @@ -122,7 +130,6 @@ sub rcs_recentchanges ($) { #{{{ eval q{ use Date::Parse; - use Time::Duration; use XML::SAX; use XML::Simple; }; @@ -195,12 +202,18 @@ sub rcs_recentchanges ($) { #{{{ sub rcs_notify () { #{{{ if (! exists $ENV{REV}) { - error("REV is not set, not running from svn post-commit hook, cannot send notifications"); + error(gettext("REV is not set, not running from svn post-commit hook, cannot send notifications")); } my $rev=int(possibly_foolish_untaint($ENV{REV})); my $user=`svnlook author $config{svnrepo} -r $rev`; chomp $user; + + my $message=`svnlook log $config{svnrepo} -r $rev`; + if ($message=~/$config{web_commit_regexp}/) { + $user=defined $2 ? "$2" : "$3"; + $message=$4; + } my @changed_pages; foreach my $change (`svnlook changed $config{svnrepo} -r $rev`) { @@ -213,11 +226,6 @@ sub rcs_notify () { #{{{ require IkiWiki::UserInfo; send_commit_mails( sub { - my $message=`svnlook log $config{svnrepo} -r $rev`; - if ($message=~/$config{web_commit_regexp}/) { - $user=defined $2 ? "$2" : "$3"; - $message=$4; - } return $message; }, sub {