return "";
}
-sub rcs_commit ($$$;$$$) {
- my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
+sub rcs_commit (@) {
+ my %params=@_;
- if (defined $user) {
- $user = IkiWiki::possibly_foolish_untaint($user);
- }
- elsif (defined $ipaddr) {
- $user = "Anonymous from ".IkiWiki::possibly_foolish_untaint($ipaddr);
- }
- else {
- $user = "Anonymous";
+ my $user="Anonymous";
+ if (defined $params{session}) {
+ if (defined $params{session}->param("name")) {
+ $user = $params{session}->param("name");
+ }
+ elsif (defined $params{session}->remote_addr()) {
+ $user = "Anonymous from ".$params{session}->remote_addr();
+ }
}
- $message = IkiWiki::possibly_foolish_untaint($message);
- if (! length $message) {
- $message = "no message given";
+ if (! length $params{message}) {
+ $params{message} = "no message given";
}
my @cmdline = ("hg", "-q", "-R", $config{srcdir}, "commit",
- "-m", $message, "-u", $user);
+ "-m", IkiWiki::possibly_foolish_untaint($params{message}),
+ "-u", IkiWiki::possibly_foolish_untaint($user));
if (system(@cmdline) != 0) {
warn "'@cmdline' failed: $!";
}
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 mercurial"); # TODO
}
return @ret;
}
-sub rcs_diff ($) {
+sub rcs_diff ($;$) {
# TODO
}
my ($file) = @_;
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v",
- "--style", "default", $file);
+ "--style", "default", "$config{srcdir}/$file");
open (my $out, "-|", @cmdline);
my @log = (mercurial_log($out));