diff options
author | Joey Hess <joey@kitenet.net> | 2010-06-23 17:35:21 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-06-23 19:04:36 -0400 |
commit | ecdfd1b8644bc926db008054ab6192e18351afed (patch) | |
tree | 4bb8d74b48d107562d9d1c194a9d8435c7215c03 /IkiWiki/Plugin/tla.pm | |
parent | caf7bcdda38c1f2c31c70e36a95e4fa3f116f0d7 (diff) | |
download | ikiwiki-ecdfd1b8644bc926db008054ab6192e18351afed.tar ikiwiki-ecdfd1b8644bc926db008054ab6192e18351afed.tar.gz |
rcs_commit and rcs_commit_staged api changes
Using named parameters for these is overdue. Passing the session in a
parameter instead of passing username and IP separately will later allow
storing other session info, like username or part of the email.
Note that these functions are not part of the exported API,
and the prototype change will catch (most) skew, so I am not changing
API versions. Any third-party plugins that call them will need updated
though.
Diffstat (limited to 'IkiWiki/Plugin/tla.pm')
-rw-r--r-- | IkiWiki/Plugin/tla.pm | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index 80c015e3c..da4385446 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -98,19 +98,23 @@ sub rcs_prepedit ($) { } } -sub rcs_commit ($$$;$$$) { - my $file=shift; - my $message=shift; - my $rcstoken=shift; - my $user=shift; - my $ipaddr=shift; - my $emailuser=shift; - - if (defined $user) { - $message="web commit by $user".(length $message ? ": $message" : ""); - } - elsif (defined $ipaddr) { - $message="web commit from $ipaddr".(length $message ? ": $message" : ""); +sub rcs_commit (@) { + my %params=@_; + + my ($file, $message, $rcstoken)= + ($params{file}, $params{message}, $params{token}); + + if (defined $params{session}) { + if (defined $params{session}->param("name")) { + $message="web commit by ". + $params{session}->param("name"). + (length $message ? ": $message" : ""); + } + elsif (defined $params{session}->remote_addr()) { + $message="web commit from ". + $params{session}->remote_addr(). + (length $message ? ": $message" : ""); + } } if (-d "$config{srcdir}/{arch}") { @@ -140,10 +144,10 @@ sub rcs_commit ($$$;$$$) { return undef # success } -sub rcs_commit_staged ($$$;$) { +sub rcs_commit_staged (@) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr, $emailuser)=@_; + my %params=@_; error("rcs_commit_staged not implemented for tla"); # TODO } |