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.master
parent
caf7bcdda3
commit
ecdfd1b864
|
@ -1840,11 +1840,11 @@ sub rcs_prepedit ($) {
|
||||||
$hooks{rcs}{rcs_prepedit}{call}->(@_);
|
$hooks{rcs}{rcs_prepedit}{call}->(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$) {
|
sub rcs_commit (@) {
|
||||||
$hooks{rcs}{rcs_commit}{call}->(@_);
|
$hooks{rcs}{rcs_commit}{call}->(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$) {
|
sub rcs_commit_staged (@) {
|
||||||
$hooks{rcs}{rcs_commit_staged}{call}->(@_);
|
$hooks{rcs}{rcs_commit_staged}{call}->(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,10 +183,12 @@ sub formbuilder (@) {
|
||||||
if ($config{rcs}) {
|
if ($config{rcs}) {
|
||||||
IkiWiki::rcs_add($filename);
|
IkiWiki::rcs_add($filename);
|
||||||
IkiWiki::disable_commit_hook();
|
IkiWiki::disable_commit_hook();
|
||||||
IkiWiki::rcs_commit($filename, gettext("attachment upload"),
|
IkiWiki::rcs_commit(
|
||||||
IkiWiki::rcs_prepedit($filename),
|
file => $filename,
|
||||||
$session->param("name"),
|
message => gettext("attachment upload"),
|
||||||
$session->remote_addr());
|
token => IkiWiki::rcs_prepedit($filename),
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
IkiWiki::rcs_update();
|
IkiWiki::rcs_update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,8 @@ sub refresh () {
|
||||||
}
|
}
|
||||||
if ($config{rcs}) {
|
if ($config{rcs}) {
|
||||||
IkiWiki::rcs_commit_staged(
|
IkiWiki::rcs_commit_staged(
|
||||||
gettext("automatic index generation"),
|
message => gettext("automatic index generation"),
|
||||||
undef, undef);
|
);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,13 @@ sub rcs_prepedit ($) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub bzr_author ($$) {
|
sub bzr_author ($) {
|
||||||
my ($user, $ipaddr) = @_;
|
my $session=shift;
|
||||||
|
|
||||||
|
return unless defined $session;
|
||||||
|
|
||||||
|
my $user=$session->param("name");
|
||||||
|
my $ipaddr=$session->remote_addr();
|
||||||
|
|
||||||
if (defined $user) {
|
if (defined $user) {
|
||||||
return IkiWiki::possibly_foolish_untaint($user);
|
return IkiWiki::possibly_foolish_untaint($user);
|
||||||
|
@ -137,18 +142,19 @@ sub bzr_author ($$) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub rcs_commit (@) {
|
||||||
my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
|
my %params=@_;
|
||||||
|
|
||||||
$user = bzr_author($user, $ipaddr);
|
my $user=bzr_author($params{session});
|
||||||
|
|
||||||
$message = IkiWiki::possibly_foolish_untaint($message);
|
$params{message} = IkiWiki::possibly_foolish_untaint($params{message});
|
||||||
if (! length $message) {
|
if (! length $params{message}) {
|
||||||
$message = "no message given";
|
$params{message} = "no message given";
|
||||||
}
|
}
|
||||||
|
|
||||||
my @cmdline = ("bzr", "commit", "--quiet", "-m", $message, "--author", $user,
|
my @cmdline = ("bzr", "commit", "--quiet", "-m", $params{message},
|
||||||
$config{srcdir}."/".$file);
|
(defined $user ? ("--author", $user) : ()),
|
||||||
|
$config{srcdir}."/".$params{file});
|
||||||
if (system(@cmdline) != 0) {
|
if (system(@cmdline) != 0) {
|
||||||
warn "'@cmdline' failed: $!";
|
warn "'@cmdline' failed: $!";
|
||||||
}
|
}
|
||||||
|
@ -156,19 +162,18 @@ sub rcs_commit ($$$;$$$) {
|
||||||
return undef; # success
|
return undef; # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
my %params=@_;
|
||||||
# rcs_remove, and rcs_rename.
|
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
|
||||||
|
|
||||||
$user = bzr_author($user, $ipaddr);
|
my $user=bzr_author($params{session});
|
||||||
|
|
||||||
$message = IkiWiki::possibly_foolish_untaint($message);
|
$params{message} = IkiWiki::possibly_foolish_untaint($params{message});
|
||||||
if (! length $message) {
|
if (! length $params{message}) {
|
||||||
$message = "no message given";
|
$params{message} = "no message given";
|
||||||
}
|
}
|
||||||
|
|
||||||
my @cmdline = ("bzr", "commit", "--quiet", "-m", $message, "--author", $user,
|
my @cmdline = ("bzr", "commit", "--quiet", "-m", $params{message},
|
||||||
|
(defined $user ? ("--author", $user) : ()),
|
||||||
$config{srcdir});
|
$config{srcdir});
|
||||||
if (system(@cmdline) != 0) {
|
if (system(@cmdline) != 0) {
|
||||||
warn "'@cmdline' failed: $!";
|
warn "'@cmdline' failed: $!";
|
||||||
|
|
|
@ -513,9 +513,10 @@ sub editcomment ($$) {
|
||||||
|
|
||||||
IkiWiki::rcs_add($file);
|
IkiWiki::rcs_add($file);
|
||||||
IkiWiki::disable_commit_hook();
|
IkiWiki::disable_commit_hook();
|
||||||
$conflict = IkiWiki::rcs_commit_staged($message,
|
$conflict = IkiWiki::rcs_commit_staged(
|
||||||
$session->param('name'),
|
message => $message,
|
||||||
$session->remote_addr());
|
session => $session,
|
||||||
|
);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
IkiWiki::rcs_update();
|
IkiWiki::rcs_update();
|
||||||
}
|
}
|
||||||
|
@ -603,9 +604,10 @@ sub commentmoderation ($$) {
|
||||||
if ($config{rcs} and $config{comments_commit}) {
|
if ($config{rcs} and $config{comments_commit}) {
|
||||||
my $message = gettext("Comment moderation");
|
my $message = gettext("Comment moderation");
|
||||||
IkiWiki::disable_commit_hook();
|
IkiWiki::disable_commit_hook();
|
||||||
$conflict=IkiWiki::rcs_commit_staged($message,
|
$conflict=IkiWiki::rcs_commit_staged(
|
||||||
$session->param('name'),
|
message => $message,
|
||||||
$session->remote_addr());
|
session => $session,
|
||||||
|
);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
IkiWiki::rcs_update();
|
IkiWiki::rcs_update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,41 +183,47 @@ sub rcs_prepedit ($) {
|
||||||
return defined $rev ? $rev : "";
|
return defined $rev ? $rev : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub commitmessage (@) {
|
||||||
|
my %params=@_;
|
||||||
|
|
||||||
|
if (defined $params{session}) {
|
||||||
|
if (defined $params{session}->param("name")) {
|
||||||
|
return "web commit by ".
|
||||||
|
$params{session}->param("name").
|
||||||
|
(length $params{message} ? ": $params{message}" : "");
|
||||||
|
}
|
||||||
|
elsif (defined $params{session}->remote_addr()) {
|
||||||
|
return "web commit from ".
|
||||||
|
$params{session}->remote_addr().
|
||||||
|
(length $params{message} ? ": $params{message}" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $params{message};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub rcs_commit (@) {
|
||||||
# Tries to commit the page; returns undef on _success_ and
|
# Tries to commit the page; returns undef on _success_ and
|
||||||
# a version of the page with the rcs's conflict markers on failure.
|
# a version of the page with the rcs's conflict markers on failure.
|
||||||
# The file is relative to the srcdir.
|
# The file is relative to the srcdir.
|
||||||
my $file=shift;
|
my %params=@_;
|
||||||
my $message=shift;
|
|
||||||
my $rcstoken=shift;
|
|
||||||
my $user=shift;
|
|
||||||
my $ipaddr=shift;
|
|
||||||
my $emailuser=shift;
|
|
||||||
|
|
||||||
return unless cvs_is_controlling;
|
return unless cvs_is_controlling;
|
||||||
|
|
||||||
if (defined $user) {
|
|
||||||
$message="web commit by $user".(length $message ? ": $message" : "");
|
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check to see if the page has been changed by someone
|
# Check to see if the page has been changed by someone
|
||||||
# else since rcs_prepedit was called.
|
# else since rcs_prepedit was called.
|
||||||
my ($oldrev)=$rcstoken=~/^([0-9]+)$/; # untaint
|
my ($oldrev)=$params{token}=~/^([0-9]+)$/; # untaint
|
||||||
my $rev=cvs_info("Repository revision", "$config{srcdir}/$file");
|
my $rev=cvs_info("Repository revision", "$config{srcdir}/$params{file}");
|
||||||
if (defined $rev && defined $oldrev && $rev != $oldrev) {
|
if (defined $rev && defined $oldrev && $rev != $oldrev) {
|
||||||
# Merge their changes into the file that we've
|
# Merge their changes into the file that we've
|
||||||
# changed.
|
# changed.
|
||||||
cvs_runcvs('update', $file) ||
|
cvs_runcvs('update', $params{file}) ||
|
||||||
warn("cvs merge from $oldrev to $rev failed\n");
|
warn("cvs merge from $oldrev to $rev failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! cvs_runcvs('commit', '-m',
|
if (! cvs_runcvs('commit', '-m',
|
||||||
IkiWiki::possibly_foolish_untaint $message)) {
|
IkiWiki::possibly_foolish_untaint(commitmessage(%params)))) {
|
||||||
my $conflict=readfile("$config{srcdir}/$file");
|
my $conflict=readfile("$config{srcdir}/$params{file}");
|
||||||
cvs_runcvs('update', '-C', $file) ||
|
cvs_runcvs('update', '-C', $params{file}) ||
|
||||||
warn("cvs revert failed\n");
|
warn("cvs revert failed\n");
|
||||||
return $conflict;
|
return $conflict;
|
||||||
}
|
}
|
||||||
|
@ -225,20 +231,13 @@ sub rcs_commit ($$$;$$$) {
|
||||||
return undef # success
|
return undef # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
# Commits all staged changes. Changes can be staged using rcs_add,
|
||||||
# rcs_remove, and rcs_rename.
|
# rcs_remove, and rcs_rename.
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
my %params=@_;
|
||||||
|
|
||||||
if (defined $user) {
|
|
||||||
$message="web commit by $user".(length $message ? ": $message" : "");
|
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! cvs_runcvs('commit', '-m',
|
if (! cvs_runcvs('commit', '-m',
|
||||||
IkiWiki::possibly_foolish_untaint $message)) {
|
IkiWiki::possibly_foolish_untaint(commitmessage(%params)))) {
|
||||||
warn "cvs staged commit failed\n";
|
warn "cvs staged commit failed\n";
|
||||||
return 1; # failure
|
return 1; # failure
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,14 +140,31 @@ sub rcs_prepedit ($) {
|
||||||
return $rev;
|
return $rev;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub commitauthor (@) {
|
||||||
|
my %params=@_;
|
||||||
|
|
||||||
|
my $author="anon\@web";
|
||||||
|
if (defined $params{session}) {
|
||||||
|
if (defined $params{session}->param("name")) {
|
||||||
|
return $params{session}->param("name").'@web';
|
||||||
|
}
|
||||||
|
elsif (defined $params{session}->remote_addr()) {
|
||||||
|
return $params{session}->remote_addr().'@web';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 'anon@web';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub rcs_commit (@) {
|
||||||
# Commit the page. Returns 'undef' on success and a version of the page
|
# Commit the page. Returns 'undef' on success and a version of the page
|
||||||
# with conflict markers on failure.
|
# with conflict markers on failure.
|
||||||
|
my %params=@_;
|
||||||
|
|
||||||
my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
|
my ($file, $message, $token) =
|
||||||
|
($params{file}, $params{message}, $params{token});
|
||||||
|
|
||||||
# Compute if the "revision" of $file changed.
|
# Compute if the "revision" of $file changed.
|
||||||
my $changed = darcs_rev($file) ne $rcstoken;
|
my $changed = darcs_rev($file) ne $token;
|
||||||
|
|
||||||
# Yes, the following is a bit convoluted.
|
# Yes, the following is a bit convoluted.
|
||||||
if ($changed) {
|
if ($changed) {
|
||||||
|
@ -155,7 +172,7 @@ sub rcs_commit ($$$;$$$) {
|
||||||
rename("$config{srcdir}/$file", "$config{srcdir}/$file.save") or
|
rename("$config{srcdir}/$file", "$config{srcdir}/$file.save") or
|
||||||
error("failed to rename $file to $file.save: $!");
|
error("failed to rename $file to $file.save: $!");
|
||||||
|
|
||||||
# Roll the repository back to $rcstoken.
|
# Roll the repository back to $token.
|
||||||
|
|
||||||
# TODO. Can we be sure that no changes are lost? I think that
|
# TODO. Can we be sure that no changes are lost? I think that
|
||||||
# we can, if we make sure that the 'darcs push' below will always
|
# we can, if we make sure that the 'darcs push' below will always
|
||||||
|
@ -166,37 +183,28 @@ sub rcs_commit ($$$;$$$) {
|
||||||
# TODO: 'yes | ...' needed? Doesn't seem so.
|
# TODO: 'yes | ...' needed? Doesn't seem so.
|
||||||
silentsystem('darcs', "revert", "--repodir", $config{srcdir}, "--all") == 0 ||
|
silentsystem('darcs', "revert", "--repodir", $config{srcdir}, "--all") == 0 ||
|
||||||
error("'darcs revert' failed");
|
error("'darcs revert' failed");
|
||||||
# Remove all patches starting at $rcstoken.
|
# Remove all patches starting at $token.
|
||||||
my $child = open(DARCS_OBLITERATE, "|-");
|
my $child = open(DARCS_OBLITERATE, "|-");
|
||||||
if (! $child) {
|
if (! $child) {
|
||||||
open(STDOUT, ">/dev/null");
|
open(STDOUT, ">/dev/null");
|
||||||
exec('darcs', "obliterate", "--repodir", $config{srcdir},
|
exec('darcs', "obliterate", "--repodir", $config{srcdir},
|
||||||
"--match", "hash " . $rcstoken) and
|
"--match", "hash " . $token) and
|
||||||
error("'darcs obliterate' failed");
|
error("'darcs obliterate' failed");
|
||||||
}
|
}
|
||||||
1 while print DARCS_OBLITERATE "y";
|
1 while print DARCS_OBLITERATE "y";
|
||||||
close(DARCS_OBLITERATE);
|
close(DARCS_OBLITERATE);
|
||||||
# Restore the $rcstoken one.
|
# Restore the $token one.
|
||||||
silentsystem('darcs', "pull", "--quiet", "--repodir", $config{srcdir},
|
silentsystem('darcs', "pull", "--quiet", "--repodir", $config{srcdir},
|
||||||
"--match", "hash " . $rcstoken, "--all") == 0 ||
|
"--match", "hash " . $token, "--all") == 0 ||
|
||||||
error("'darcs pull' failed");
|
error("'darcs pull' failed");
|
||||||
|
|
||||||
# We're back at $rcstoken. Re-install the modified file.
|
# We're back at $token. Re-install the modified file.
|
||||||
rename("$config{srcdir}/$file.save", "$config{srcdir}/$file") or
|
rename("$config{srcdir}/$file.save", "$config{srcdir}/$file") or
|
||||||
error("failed to rename $file.save to $file: $!");
|
error("failed to rename $file.save to $file: $!");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Record the changes.
|
# Record the changes.
|
||||||
my $author;
|
my $author=commitauthor(%params);
|
||||||
if (defined $user) {
|
|
||||||
$author = "$user\@web";
|
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$author = "$ipaddr\@web";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$author = "anon\@web";
|
|
||||||
}
|
|
||||||
if (!defined $message || !length($message)) {
|
if (!defined $message || !length($message)) {
|
||||||
$message = "empty message";
|
$message = "empty message";
|
||||||
}
|
}
|
||||||
|
@ -211,13 +219,13 @@ sub rcs_commit ($$$;$$$) {
|
||||||
|
|
||||||
# If this updating yields any conflicts, we'll record them now to resolve
|
# If this updating yields any conflicts, we'll record them now to resolve
|
||||||
# them. If nothing is recorded, there are no conflicts.
|
# them. If nothing is recorded, there are no conflicts.
|
||||||
$rcstoken = darcs_rev($file);
|
$token = darcs_rev($file);
|
||||||
# TODO: Use only the first line here, i.e. only the patch name?
|
# TODO: Use only the first line here, i.e. only the patch name?
|
||||||
writefile("$file.log", $config{srcdir}, 'resolve conflicts: ' . $message);
|
writefile("$file.log", $config{srcdir}, 'resolve conflicts: ' . $message);
|
||||||
silentsystem('darcs', 'record', '--repodir', $config{srcdir}, '--all',
|
silentsystem('darcs', 'record', '--repodir', $config{srcdir}, '--all',
|
||||||
'-m', 'resolve conflicts: ' . $message, '--author', $author, $file) == 0 ||
|
'-m', 'resolve conflicts: ' . $message, '--author', $author, $file) == 0 ||
|
||||||
error("'darcs record' failed");
|
error("'darcs record' failed");
|
||||||
my $conflicts = darcs_rev($file) ne $rcstoken;
|
my $conflicts = darcs_rev($file) ne $token;
|
||||||
unlink("$config{srcdir}/$file.log") or
|
unlink("$config{srcdir}/$file.log") or
|
||||||
error("failed to remove '$file.log'");
|
error("failed to remove '$file.log'");
|
||||||
|
|
||||||
|
@ -239,25 +247,18 @@ sub rcs_commit ($$$;$$$) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
my ($message, $user, $ipaddr, $emailuser) = @_;
|
my %params=@_;
|
||||||
|
|
||||||
my $author;
|
my $author=commitauthor(%params);
|
||||||
if (defined $user) {
|
if (!defined $params{message} || !length($params{message})) {
|
||||||
$author = "$user\@web";
|
$params{message} = "empty message";
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$author = "$ipaddr\@web";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$author = "anon\@web";
|
|
||||||
}
|
|
||||||
if (!defined $message || !length($message)) {
|
|
||||||
$message = "empty message";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
silentsystem('darcs', "record", "--repodir", $config{srcdir}, "-a", "-A", $author,
|
silentsystem('darcs', "record", "--repodir", $config{srcdir},
|
||||||
"-m", $message) == 0 || error("'darcs record' failed");
|
"-a", "-A", $author,
|
||||||
|
"-m", $params{message},
|
||||||
|
) == 0 || error("'darcs record' failed");
|
||||||
|
|
||||||
# Push the changes to the main repository.
|
# Push the changes to the main repository.
|
||||||
silentsystem('darcs', 'push', '--quiet', '--repodir', $config{srcdir}, '--all') == 0 ||
|
silentsystem('darcs', 'push', '--quiet', '--repodir', $config{srcdir}, '--all') == 0 ||
|
||||||
|
|
|
@ -401,10 +401,12 @@ sub cgi_editpage ($$) {
|
||||||
# signaling to it that it should not try to
|
# signaling to it that it should not try to
|
||||||
# do anything.
|
# do anything.
|
||||||
disable_commit_hook();
|
disable_commit_hook();
|
||||||
$conflict=rcs_commit($file, $message,
|
$conflict=rcs_commit(
|
||||||
$form->field("rcsinfo"),
|
file => $file,
|
||||||
$session->param("name"),
|
message => $message,
|
||||||
$session->remote_addr());
|
token => $form->field("rcsinfo"),
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
enable_commit_hook();
|
enable_commit_hook();
|
||||||
rcs_update();
|
rcs_update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,43 +464,55 @@ sub rcs_prepedit ($) {
|
||||||
return git_sha1($file);
|
return git_sha1($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub rcs_commit (@) {
|
||||||
# Try to commit the page; returns undef on _success_ and
|
# Try to commit the page; returns undef on _success_ and
|
||||||
# a version of the page with the rcs's conflict markers on
|
# a version of the page with the rcs's conflict markers on
|
||||||
# failure.
|
# failure.
|
||||||
|
my %params=@_;
|
||||||
my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
|
|
||||||
|
|
||||||
# Check to see if the page has been changed by someone else since
|
# Check to see if the page has been changed by someone else since
|
||||||
# rcs_prepedit was called.
|
# rcs_prepedit was called.
|
||||||
my $cur = git_sha1($file);
|
my $cur = git_sha1($params{file});
|
||||||
my ($prev) = $rcstoken =~ /^($sha1_pattern)$/; # untaint
|
my ($prev) = $params{token} =~ /^($sha1_pattern)$/; # untaint
|
||||||
|
|
||||||
if (defined $cur && defined $prev && $cur ne $prev) {
|
if (defined $cur && defined $prev && $cur ne $prev) {
|
||||||
my $conflict = merge_past($prev, $file, $dummy_commit_msg);
|
my $conflict = merge_past($prev, $params{file}, $dummy_commit_msg);
|
||||||
return $conflict if defined $conflict;
|
return $conflict if defined $conflict;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcs_add($file);
|
rcs_add($params{file});
|
||||||
return rcs_commit_staged($message, $user, $ipaddr);
|
return rcs_commit_staged(
|
||||||
|
message => $params{message},
|
||||||
|
session => $params{session},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
# Commits all staged changes. Changes can be staged using rcs_add,
|
||||||
# rcs_remove, and rcs_rename.
|
# rcs_remove, and rcs_rename.
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
my %params=@_;
|
||||||
|
|
||||||
# Set the commit author and email to the web committer.
|
|
||||||
my %env=%ENV;
|
my %env=%ENV;
|
||||||
if (defined $user || defined $ipaddr) {
|
|
||||||
my $u=encode_utf8(defined $user ? $user : $ipaddr);
|
if (defined $params{session}) {
|
||||||
$ENV{GIT_AUTHOR_NAME}=$u;
|
# Set the commit author and email based on web session info.
|
||||||
$ENV{GIT_AUTHOR_EMAIL}="$u\@web";
|
my $u;
|
||||||
|
if (defined $params{session}->param("name")) {
|
||||||
|
$u=$params{session}->param("name");
|
||||||
|
}
|
||||||
|
elsif (defined $params{session}->remote_addr()) {
|
||||||
|
$u=$params{session}->remote_addr();
|
||||||
|
}
|
||||||
|
if (defined $u) {
|
||||||
|
$u=encode_utf8($u);
|
||||||
|
$ENV{GIT_AUTHOR_NAME}=$u;
|
||||||
|
$ENV{GIT_AUTHOR_EMAIL}="$u\@web";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = IkiWiki::possibly_foolish_untaint($message);
|
$params{message} = IkiWiki::possibly_foolish_untaint($params{message});
|
||||||
my @opts;
|
my @opts;
|
||||||
if ($message !~ /\S/) {
|
if ($params{message} !~ /\S/) {
|
||||||
# Force git to allow empty commit messages.
|
# Force git to allow empty commit messages.
|
||||||
# (If this version of git supports it.)
|
# (If this version of git supports it.)
|
||||||
my ($version)=`git --version` =~ /git version (.*)/;
|
my ($version)=`git --version` =~ /git version (.*)/;
|
||||||
|
@ -508,13 +520,13 @@ sub rcs_commit_staged ($$$;$) {
|
||||||
push @opts, '--cleanup=verbatim';
|
push @opts, '--cleanup=verbatim';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message.=".";
|
$params{message}.=".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
push @opts, '-q';
|
push @opts, '-q';
|
||||||
# git commit returns non-zero if file has not been really changed.
|
# git commit returns non-zero if file has not been really changed.
|
||||||
# so we should ignore its exit status (hence run_or_non).
|
# so we should ignore its exit status (hence run_or_non).
|
||||||
if (run_or_non('git', 'commit', @opts, '-m', $message)) {
|
if (run_or_non('git', 'commit', @opts, '-m', $params{message})) {
|
||||||
if (length $config{gitorigin_branch}) {
|
if (length $config{gitorigin_branch}) {
|
||||||
run_or_cry('git', 'push', $config{gitorigin_branch});
|
run_or_cry('git', 'push', $config{gitorigin_branch});
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,26 +126,26 @@ sub rcs_prepedit ($) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub rcs_commit (@) {
|
||||||
my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
|
my %params=@_;
|
||||||
|
|
||||||
if (defined $user) {
|
my $user="Anonymous";
|
||||||
$user = IkiWiki::possibly_foolish_untaint($user);
|
if (defined $params{session}) {
|
||||||
}
|
if (defined $params{session}->param("name")) {
|
||||||
elsif (defined $ipaddr) {
|
$user = $params{session}->param("name");
|
||||||
$user = "Anonymous from ".IkiWiki::possibly_foolish_untaint($ipaddr);
|
}
|
||||||
}
|
elsif (defined $params{session}->remote_addr()) {
|
||||||
else {
|
$user = "Anonymous from ".$params{session}->remote_addr();
|
||||||
$user = "Anonymous";
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = IkiWiki::possibly_foolish_untaint($message);
|
if (! length $params{message}) {
|
||||||
if (! length $message) {
|
$params{message} = "no message given";
|
||||||
$message = "no message given";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my @cmdline = ("hg", "-q", "-R", $config{srcdir}, "commit",
|
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) {
|
if (system(@cmdline) != 0) {
|
||||||
warn "'@cmdline' failed: $!";
|
warn "'@cmdline' failed: $!";
|
||||||
}
|
}
|
||||||
|
@ -153,10 +153,10 @@ sub rcs_commit ($$$;$$$) {
|
||||||
return undef; # success
|
return undef; # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
# Commits all staged changes. Changes can be staged using rcs_add,
|
||||||
# rcs_remove, and rcs_rename.
|
# rcs_remove, and rcs_rename.
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
my %params=@_;
|
||||||
|
|
||||||
error("rcs_commit_staged not implemented for mercurial"); # TODO
|
error("rcs_commit_staged not implemented for mercurial"); # TODO
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,32 +293,33 @@ sub rcs_prepedit ($) {
|
||||||
return get_rev();
|
return get_rev();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub commitauthor (@) {
|
||||||
|
my %params=@_;
|
||||||
|
|
||||||
|
if (defined $params{session}) {
|
||||||
|
if (defined $params{session}->param("name")) {
|
||||||
|
return "Web user: " . $params{session}->param("name");
|
||||||
|
}
|
||||||
|
elsif (defined $params{session}->remote_addr()) {
|
||||||
|
return "Web IP: " . $params{session}->remote_addr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Web: Anonymous";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub rcs_commit (@) {
|
||||||
# Tries to commit the page; returns undef on _success_ and
|
# Tries to commit the page; returns undef on _success_ and
|
||||||
# a version of the page with the rcs's conflict markers on failure.
|
# a version of the page with the rcs's conflict markers on failure.
|
||||||
# The file is relative to the srcdir.
|
# The file is relative to the srcdir.
|
||||||
my $file=shift;
|
my %params=@_;
|
||||||
my $message=shift;
|
|
||||||
my $rcstoken=shift;
|
|
||||||
my $user=shift;
|
|
||||||
my $ipaddr=shift;
|
|
||||||
my $emailuser=shift;
|
|
||||||
my $author;
|
|
||||||
|
|
||||||
if (defined $user) {
|
my $author=IkiWiki::possibly_foolish_untaint(commitauthor(%params)),
|
||||||
$author="Web user: " . $user;
|
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$author="Web IP: " . $ipaddr;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$author="Web: Anonymous";
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir $config{srcdir}
|
chdir $config{srcdir}
|
||||||
or error("Cannot chdir to $config{srcdir}: $!");
|
or error("Cannot chdir to $config{srcdir}: $!");
|
||||||
|
|
||||||
my ($oldrev)= $rcstoken=~ m/^($sha1_pattern)$/; # untaint
|
my ($oldrev) = $params{token} =~ m/^($sha1_pattern)$/; # untaint
|
||||||
my $rev = get_rev();
|
my $rev = get_rev();
|
||||||
if (defined $rev && defined $oldrev && $rev ne $oldrev) {
|
if (defined $rev && defined $oldrev && $rev ne $oldrev) {
|
||||||
my $automator = Monotone->new();
|
my $automator = Monotone->new();
|
||||||
|
@ -327,8 +328,8 @@ sub rcs_commit ($$$;$$$) {
|
||||||
# Something has been committed, has this file changed?
|
# Something has been committed, has this file changed?
|
||||||
my ($out, $err);
|
my ($out, $err);
|
||||||
$automator->setOpts("r", $oldrev, "r", $rev);
|
$automator->setOpts("r", $oldrev, "r", $rev);
|
||||||
($out, $err) = $automator->call("content_diff", $file);
|
($out, $err) = $automator->call("content_diff", $params{file});
|
||||||
debug("Problem committing $file") if ($err ne "");
|
debug("Problem committing $params{file}") if ($err ne "");
|
||||||
my $diff = $out;
|
my $diff = $out;
|
||||||
|
|
||||||
if ($diff) {
|
if ($diff) {
|
||||||
|
@ -337,11 +338,11 @@ sub rcs_commit ($$$;$$$) {
|
||||||
#
|
#
|
||||||
# first get the contents
|
# first get the contents
|
||||||
debug("File changed: forming branch");
|
debug("File changed: forming branch");
|
||||||
my $newfile=readfile("$config{srcdir}/$file");
|
my $newfile=readfile("$config{srcdir}/$params{file}");
|
||||||
|
|
||||||
# then get the old content ID from the diff
|
# then get the old content ID from the diff
|
||||||
if ($diff !~ m/^---\s$file\s+($sha1_pattern)$/m) {
|
if ($diff !~ m/^---\s$params{file}\s+($sha1_pattern)$/m) {
|
||||||
error("Unable to find previous file ID for $file");
|
error("Unable to find previous file ID for $params{file}");
|
||||||
}
|
}
|
||||||
my $oldFileID = $1;
|
my $oldFileID = $1;
|
||||||
|
|
||||||
|
@ -352,13 +353,13 @@ sub rcs_commit ($$$;$$$) {
|
||||||
my $branch = $1;
|
my $branch = $1;
|
||||||
|
|
||||||
# then put the new content into the DB (and record the new content ID)
|
# then put the new content into the DB (and record the new content ID)
|
||||||
my $newRevID = commit_file_to_new_rev($automator, $file, $oldFileID, $newfile, $oldrev, $branch, $author, $message);
|
my $newRevID = commit_file_to_new_rev($automator, $params{file}, $oldFileID, $newfile, $oldrev, $branch, $author, $params{message});
|
||||||
|
|
||||||
$automator->close();
|
$automator->close();
|
||||||
|
|
||||||
# if we made it to here then the file has been committed... revert the local copy
|
# if we made it to here then the file has been committed... revert the local copy
|
||||||
if (system("mtn", "--root=$config{mtnrootdir}", "revert", $file) != 0) {
|
if (system("mtn", "--root=$config{mtnrootdir}", "revert", $params{file}) != 0) {
|
||||||
debug("Unable to revert $file after merge on conflicted commit!");
|
debug("Unable to revert $params{file} after merge on conflicted commit!");
|
||||||
}
|
}
|
||||||
debug("Divergence created! Attempting auto-merge.");
|
debug("Divergence created! Attempting auto-merge.");
|
||||||
|
|
||||||
|
@ -407,7 +408,7 @@ sub rcs_commit ($$$;$$$) {
|
||||||
# for cleanup note, this relies on the fact
|
# for cleanup note, this relies on the fact
|
||||||
# that ikiwiki seems to call rcs_prepedit()
|
# that ikiwiki seems to call rcs_prepedit()
|
||||||
# again after we return
|
# again after we return
|
||||||
return readfile("$config{srcdir}/$file");
|
return readfile("$config{srcdir}/$params{file}");
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
@ -419,11 +420,12 @@ sub rcs_commit ($$$;$$$) {
|
||||||
|
|
||||||
if (system("mtn", "--root=$config{mtnrootdir}", "commit", "--quiet",
|
if (system("mtn", "--root=$config{mtnrootdir}", "commit", "--quiet",
|
||||||
"--author", $author, "--key", $config{mtnkey}, "-m",
|
"--author", $author, "--key", $config{mtnkey}, "-m",
|
||||||
IkiWiki::possibly_foolish_untaint($message), $file) != 0) {
|
IkiWiki::possibly_foolish_untaint($params{message}),
|
||||||
|
$params{file}) != 0) {
|
||||||
debug("Traditional commit failed! Returning data as conflict.");
|
debug("Traditional commit failed! Returning data as conflict.");
|
||||||
my $conflict=readfile("$config{srcdir}/$file");
|
my $conflict=readfile("$config{srcdir}/$params{file}");
|
||||||
if (system("mtn", "--root=$config{mtnrootdir}", "revert",
|
if (system("mtn", "--root=$config{mtnrootdir}", "revert",
|
||||||
"--quiet", $file) != 0) {
|
"--quiet", $params{file}) != 0) {
|
||||||
debug("monotone revert failed");
|
debug("monotone revert failed");
|
||||||
}
|
}
|
||||||
return $conflict;
|
return $conflict;
|
||||||
|
@ -439,32 +441,21 @@ sub rcs_commit ($$$;$$$) {
|
||||||
return undef # success
|
return undef # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
# Commits all staged changes. Changes can be staged using rcs_add,
|
||||||
# rcs_remove, and rcs_rename.
|
# rcs_remove, and rcs_rename.
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
my %params=@_;
|
||||||
|
|
||||||
# Note - this will also commit any spurious changes that happen to be
|
# Note - this will also commit any spurious changes that happen to be
|
||||||
# lying around in the working copy. There shouldn't be any, but...
|
# lying around in the working copy. There shouldn't be any, but...
|
||||||
|
|
||||||
chdir $config{srcdir}
|
chdir $config{srcdir}
|
||||||
or error("Cannot chdir to $config{srcdir}: $!");
|
or error("Cannot chdir to $config{srcdir}: $!");
|
||||||
|
|
||||||
my $author;
|
|
||||||
|
|
||||||
if (defined $user) {
|
|
||||||
$author="Web user: " . $user;
|
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$author="Web IP: " . $ipaddr;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$author="Web: Anonymous";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (system("mtn", "--root=$config{mtnrootdir}", "commit", "--quiet",
|
if (system("mtn", "--root=$config{mtnrootdir}", "commit", "--quiet",
|
||||||
"--author", $author, "--key", $config{mtnkey}, "-m",
|
"--author", IkiWiki::possibly_foolish_untaint(commitauthor(%params)),
|
||||||
IkiWiki::possibly_foolish_untaint($message)) != 0) {
|
"--key", $config{mtnkey}, "-m",
|
||||||
|
IkiWiki::possibly_foolish_untaint($params{message})) != 0) {
|
||||||
error("Monotone commit failed");
|
error("Monotone commit failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,11 @@ sub rcs_prepedit ($) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub rcs_commit (@) {
|
||||||
my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
|
|
||||||
return undef # success
|
return undef # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
|
||||||
return undef # success
|
return undef # success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,12 @@ sub sessioncgi ($$) {
|
||||||
$oldchoice=$session->param($choice_param);
|
$oldchoice=$session->param($choice_param);
|
||||||
if ($config{rcs}) {
|
if ($config{rcs}) {
|
||||||
IkiWiki::disable_commit_hook();
|
IkiWiki::disable_commit_hook();
|
||||||
IkiWiki::rcs_commit($pagesources{$page}, "poll vote ($choice)",
|
IkiWiki::rcs_commit(
|
||||||
IkiWiki::rcs_prepedit($pagesources{$page}),
|
file => $pagesources{$page},
|
||||||
$session->param("name"),
|
message => "poll vote ($choice)",
|
||||||
$session->remote_addr());
|
token => IkiWiki::rcs_prepedit($pagesources{$page}),
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
IkiWiki::rcs_update();
|
IkiWiki::rcs_update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,9 +213,10 @@ sub sessioncgi ($$) {
|
||||||
foreach my $file (@files) {
|
foreach my $file (@files) {
|
||||||
IkiWiki::rcs_remove($file);
|
IkiWiki::rcs_remove($file);
|
||||||
}
|
}
|
||||||
IkiWiki::rcs_commit_staged(gettext("removed"),
|
IkiWiki::rcs_commit_staged(
|
||||||
$session->param("name"),
|
message => gettext("removed"),
|
||||||
$session->remote_addr());
|
session => $session,
|
||||||
|
);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
IkiWiki::rcs_update();
|
IkiWiki::rcs_update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,9 +349,8 @@ sub sessioncgi ($$) {
|
||||||
$pagesources{$rename->{src}}=$rename->{destfile};
|
$pagesources{$rename->{src}}=$rename->{destfile};
|
||||||
}
|
}
|
||||||
IkiWiki::rcs_commit_staged(
|
IkiWiki::rcs_commit_staged(
|
||||||
sprintf(gettext("rename %s to %s"), $srcfile, $destfile),
|
message => sprintf(gettext("rename %s to %s"), $srcfile, $destfile),
|
||||||
$session->param("name"),
|
session => $session,
|
||||||
$session->remote_addr(),
|
|
||||||
) if $config{rcs};
|
) if $config{rcs};
|
||||||
|
|
||||||
# Then link fixups.
|
# Then link fixups.
|
||||||
|
|
|
@ -144,44 +144,50 @@ sub rcs_prepedit ($) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub commitmessage (@) {
|
||||||
|
my %params=@_;
|
||||||
|
|
||||||
|
if (defined $params{session}) {
|
||||||
|
if (defined $params{session}->param("name")) {
|
||||||
|
return "web commit by ".
|
||||||
|
$params{session}->param("name").
|
||||||
|
(length $params{message} ? ": $params{message}" : "");
|
||||||
|
}
|
||||||
|
elsif (defined $params{session}->remote_addr()) {
|
||||||
|
return "web commit from ".
|
||||||
|
$params{session}->remote_addr().
|
||||||
|
(length $params{message} ? ": $params{message}" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $params{message};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub rcs_commit (@) {
|
||||||
# Tries to commit the page; returns undef on _success_ and
|
# Tries to commit the page; returns undef on _success_ and
|
||||||
# a version of the page with the rcs's conflict markers on failure.
|
# a version of the page with the rcs's conflict markers on failure.
|
||||||
# The file is relative to the srcdir.
|
# The file is relative to the srcdir.
|
||||||
my $file=shift;
|
my %params=@_;
|
||||||
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" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-d "$config{srcdir}/.svn") {
|
if (-d "$config{srcdir}/.svn") {
|
||||||
# Check to see if the page has been changed by someone
|
# Check to see if the page has been changed by someone
|
||||||
# else since rcs_prepedit was called.
|
# else since rcs_prepedit was called.
|
||||||
my ($oldrev)=$rcstoken=~/^([0-9]+)$/; # untaint
|
my ($oldrev)=$params{token}=~/^([0-9]+)$/; # untaint
|
||||||
my $rev=svn_info("Revision", "$config{srcdir}/$file");
|
my $rev=svn_info("Revision", "$config{srcdir}/$params{file}");
|
||||||
if (defined $rev && defined $oldrev && $rev != $oldrev) {
|
if (defined $rev && defined $oldrev && $rev != $oldrev) {
|
||||||
# Merge their changes into the file that we've
|
# Merge their changes into the file that we've
|
||||||
# changed.
|
# changed.
|
||||||
if (system("svn", "merge", "--quiet", "-r$oldrev:$rev",
|
if (system("svn", "merge", "--quiet", "-r$oldrev:$rev",
|
||||||
"$config{srcdir}/$file", "$config{srcdir}/$file") != 0) {
|
"$config{srcdir}/$params{file}", "$config{srcdir}/$params{file}") != 0) {
|
||||||
warn("svn merge -r$oldrev:$rev failed\n");
|
warn("svn merge -r$oldrev:$rev failed\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system("svn", "commit", "--quiet",
|
if (system("svn", "commit", "--quiet",
|
||||||
"--encoding", "UTF-8", "-m",
|
"--encoding", "UTF-8", "-m",
|
||||||
IkiWiki::possibly_foolish_untaint($message),
|
IkiWiki::possibly_foolish_untaint(commitmessage(%params)),
|
||||||
$config{srcdir}) != 0) {
|
$config{srcdir}) != 0) {
|
||||||
my $conflict=readfile("$config{srcdir}/$file");
|
my $conflict=readfile("$config{srcdir}/$params{file}");
|
||||||
if (system("svn", "revert", "--quiet", "$config{srcdir}/$file") != 0) {
|
if (system("svn", "revert", "--quiet", "$config{srcdir}/$params{file}") != 0) {
|
||||||
warn("svn revert failed\n");
|
warn("svn revert failed\n");
|
||||||
}
|
}
|
||||||
return $conflict;
|
return $conflict;
|
||||||
|
@ -190,21 +196,14 @@ sub rcs_commit ($$$;$$$) {
|
||||||
return undef # success
|
return undef # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
# Commits all staged changes. Changes can be staged using rcs_add,
|
||||||
# rcs_remove, and rcs_rename.
|
# rcs_remove, and rcs_rename.
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
my %params=@_;
|
||||||
|
|
||||||
if (defined $user) {
|
|
||||||
$message="web commit by $user".(length $message ? ": $message" : "");
|
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
|
||||||
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (system("svn", "commit", "--quiet",
|
if (system("svn", "commit", "--quiet",
|
||||||
"--encoding", "UTF-8", "-m",
|
"--encoding", "UTF-8", "-m",
|
||||||
IkiWiki::possibly_foolish_untaint($message),
|
IkiWiki::possibly_foolish_untaint(commitmessage(%params)),
|
||||||
$config{srcdir}) != 0) {
|
$config{srcdir}) != 0) {
|
||||||
warn("svn commit failed\n");
|
warn("svn commit failed\n");
|
||||||
return 1; # failure
|
return 1; # failure
|
||||||
|
|
|
@ -90,7 +90,7 @@ sub gentag ($) {
|
||||||
if ($config{rcs}) {
|
if ($config{rcs}) {
|
||||||
IkiWiki::disable_commit_hook();
|
IkiWiki::disable_commit_hook();
|
||||||
IkiWiki::rcs_add($tagfile);
|
IkiWiki::rcs_add($tagfile);
|
||||||
IkiWiki::rcs_commit_staged($message, undef, undef);
|
IkiWiki::rcs_commit_staged(message => $message);
|
||||||
IkiWiki::enable_commit_hook();
|
IkiWiki::enable_commit_hook();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -98,19 +98,23 @@ sub rcs_prepedit ($) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit ($$$;$$$) {
|
sub rcs_commit (@) {
|
||||||
my $file=shift;
|
my %params=@_;
|
||||||
my $message=shift;
|
|
||||||
my $rcstoken=shift;
|
|
||||||
my $user=shift;
|
|
||||||
my $ipaddr=shift;
|
|
||||||
my $emailuser=shift;
|
|
||||||
|
|
||||||
if (defined $user) {
|
my ($file, $message, $rcstoken)=
|
||||||
$message="web commit by $user".(length $message ? ": $message" : "");
|
($params{file}, $params{message}, $params{token});
|
||||||
}
|
|
||||||
elsif (defined $ipaddr) {
|
if (defined $params{session}) {
|
||||||
$message="web commit from $ipaddr".(length $message ? ": $message" : "");
|
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}") {
|
if (-d "$config{srcdir}/{arch}") {
|
||||||
|
@ -140,10 +144,10 @@ sub rcs_commit ($$$;$$$) {
|
||||||
return undef # success
|
return undef # success
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rcs_commit_staged ($$$;$) {
|
sub rcs_commit_staged (@) {
|
||||||
# Commits all staged changes. Changes can be staged using rcs_add,
|
# Commits all staged changes. Changes can be staged using rcs_add,
|
||||||
# rcs_remove, and rcs_rename.
|
# rcs_remove, and rcs_rename.
|
||||||
my ($message, $user, $ipaddr, $emailuser)=@_;
|
my %params=@_;
|
||||||
|
|
||||||
error("rcs_commit_staged not implemented for tla"); # TODO
|
error("rcs_commit_staged not implemented for tla"); # TODO
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
ikiwiki (3.20100624) UNRELEASED; urgency=low
|
ikiwiki (3.20100624) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* API: Add new optional field usershort to rcs_recentchanges.
|
* API: Add new optional field usershort to rcs_recentchanges.
|
||||||
* API: rcs_commit and rcs_commit_staged are passed a new parameter
|
* API: rcs_commit and rcs_commit_staged are now passed named
|
||||||
that may contain the username component of the email address of
|
parameters.
|
||||||
the user making the commit.
|
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Wed, 23 Jun 2010 15:30:04 -0400
|
-- Joey Hess <joeyh@debian.org> Wed, 23 Jun 2010 15:30:04 -0400
|
||||||
|
|
||||||
|
|
|
@ -1051,18 +1051,20 @@ token, that will be passed into `rcs_commit` when committing. For example,
|
||||||
it might return the current revision ID of the file, and use that
|
it might return the current revision ID of the file, and use that
|
||||||
information later when merging changes.
|
information later when merging changes.
|
||||||
|
|
||||||
#### `rcs_commit($$$;$$$)`
|
#### `rcs_commit(@)`
|
||||||
|
|
||||||
|
Passed named parameters: `file`, `message`, `token` (from `rcs_prepedit`),
|
||||||
|
and `session` (optional).
|
||||||
|
|
||||||
Passed a file, message, token (from `rcs_prepedit`), user, ip address,
|
|
||||||
and optionally the username component of the committer's email address.
|
|
||||||
Should try to commit the file. Returns `undef` on *success* and a version
|
Should try to commit the file. Returns `undef` on *success* and a version
|
||||||
of the page with the rcs's conflict markers on failure.
|
of the page with the rcs's conflict markers on failure.
|
||||||
|
|
||||||
#### `rcs_commit_staged($$$;$)`
|
#### `rcs_commit_staged(@)`
|
||||||
|
|
||||||
Passed a message, user, ip address, and optionally the username component of
|
Passed named parameters: `message`, and `session` (optional).
|
||||||
the committer's email address. Should commit all staged changes.
|
|
||||||
Returns undef on success, and an error message on failure.
|
Should commit all staged changes. Returns undef on success, and an
|
||||||
|
error message on failure.
|
||||||
|
|
||||||
Changes can be staged by calls to `rcs_add`, `rcs_remove`, and
|
Changes can be staged by calls to `rcs_add`, `rcs_remove`, and
|
||||||
`rcs_rename`.
|
`rcs_rename`.
|
||||||
|
|
|
@ -59,7 +59,7 @@ foreach my $y ($startyear..$endyear) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IkiWiki::rcs_commit_staged(gettext("calendar update"), undef, undef)
|
IkiWiki::rcs_commit_staged(message => gettext("calendar update"))
|
||||||
if $config{rcs};
|
if $config{rcs};
|
||||||
|
|
||||||
exec("ikiwiki", "-setup", $setup, "-refresh");
|
exec("ikiwiki", "-setup", $setup, "-refresh");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Name: ikiwiki
|
Name: ikiwiki
|
||||||
Version: 3.20100623
|
Version: 3.20100624
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: A wiki compiler
|
Summary: A wiki compiler
|
||||||
|
|
||||||
|
|
108
po/ikiwiki.pot
108
po/ikiwiki.pot
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2010-06-10 15:02-0400\n"
|
"POT-Creation-Date: 2010-06-23 17:10-0400\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -52,7 +52,7 @@ msgstr ""
|
||||||
msgid "You are banned."
|
msgid "You are banned."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/CGI.pm:426 ../IkiWiki/CGI.pm:427 ../IkiWiki.pm:1316
|
#: ../IkiWiki/CGI.pm:426 ../IkiWiki/CGI.pm:427 ../IkiWiki.pm:1317
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -163,19 +163,19 @@ msgstr ""
|
||||||
msgid "prohibited by allowed_attachments"
|
msgid "prohibited by allowed_attachments"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/attachment.pm:141
|
#: ../IkiWiki/Plugin/attachment.pm:144
|
||||||
msgid "bad attachment filename"
|
msgid "bad attachment filename"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/attachment.pm:183
|
#: ../IkiWiki/Plugin/attachment.pm:188
|
||||||
msgid "attachment upload"
|
msgid "attachment upload"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/autoindex.pm:117
|
#: ../IkiWiki/Plugin/autoindex.pm:120
|
||||||
msgid "automatic index generation"
|
msgid "automatic index generation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/blogspam.pm:109
|
#: ../IkiWiki/Plugin/blogspam.pm:110
|
||||||
msgid ""
|
msgid ""
|
||||||
"Sorry, but that looks like spam to <a href=\"http://blogspam.net/"
|
"Sorry, but that looks like spam to <a href=\"http://blogspam.net/"
|
||||||
"\">blogspam</a>: "
|
"\">blogspam</a>: "
|
||||||
|
@ -248,19 +248,19 @@ msgstr ""
|
||||||
msgid "Added a comment: %s"
|
msgid "Added a comment: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/comments.pm:552 ../IkiWiki/Plugin/websetup.pm:272
|
#: ../IkiWiki/Plugin/comments.pm:554 ../IkiWiki/Plugin/websetup.pm:268
|
||||||
msgid "you are not logged in as an admin"
|
msgid "you are not logged in as an admin"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/comments.pm:603
|
#: ../IkiWiki/Plugin/comments.pm:605
|
||||||
msgid "Comment moderation"
|
msgid "Comment moderation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/comments.pm:641
|
#: ../IkiWiki/Plugin/comments.pm:645
|
||||||
msgid "comment moderation"
|
msgid "comment moderation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/comments.pm:790
|
#: ../IkiWiki/Plugin/comments.pm:802
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "%i comment"
|
msgid "%i comment"
|
||||||
msgid_plural "%i comments"
|
msgid_plural "%i comments"
|
||||||
|
@ -270,7 +270,7 @@ msgstr[1] ""
|
||||||
#. translators: Here "Comment" is a verb;
|
#. translators: Here "Comment" is a verb;
|
||||||
#. translators: the user clicks on it to
|
#. translators: the user clicks on it to
|
||||||
#. translators: post a comment.
|
#. translators: post a comment.
|
||||||
#: ../IkiWiki/Plugin/comments.pm:800
|
#: ../IkiWiki/Plugin/comments.pm:812
|
||||||
msgid "Comment"
|
msgid "Comment"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -305,9 +305,9 @@ msgstr ""
|
||||||
msgid "creating %s"
|
msgid "creating %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/editpage.pm:312 ../IkiWiki/Plugin/editpage.pm:334
|
#: ../IkiWiki/Plugin/editpage.pm:312 ../IkiWiki/Plugin/editpage.pm:332
|
||||||
#: ../IkiWiki/Plugin/editpage.pm:345 ../IkiWiki/Plugin/editpage.pm:390
|
#: ../IkiWiki/Plugin/editpage.pm:343 ../IkiWiki/Plugin/editpage.pm:388
|
||||||
#: ../IkiWiki/Plugin/editpage.pm:429
|
#: ../IkiWiki/Plugin/editpage.pm:430
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "editing %s"
|
msgid "editing %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -320,12 +320,12 @@ msgstr ""
|
||||||
msgid "match not specified"
|
msgid "match not specified"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/edittemplate.pm:64
|
#: ../IkiWiki/Plugin/edittemplate.pm:70
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "edittemplate %s registered for %s"
|
msgid "edittemplate %s registered for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/edittemplate.pm:125 ../IkiWiki/Plugin/inline.pm:339
|
#: ../IkiWiki/Plugin/edittemplate.pm:131 ../IkiWiki/Plugin/inline.pm:339
|
||||||
#: ../IkiWiki/Plugin/template.pm:44
|
#: ../IkiWiki/Plugin/template.pm:44
|
||||||
msgid "failed to process template:"
|
msgid "failed to process template:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -356,18 +356,18 @@ msgstr ""
|
||||||
msgid "%s is an attachment, not a page."
|
msgid "%s is an attachment, not a page."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/git.pm:687 ../IkiWiki/Plugin/git.pm:705
|
#: ../IkiWiki/Plugin/git.pm:724 ../IkiWiki/Plugin/git.pm:742
|
||||||
#: ../IkiWiki/Receive.pm:130
|
#: ../IkiWiki/Receive.pm:129
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "you are not allowed to change %s"
|
msgid "you are not allowed to change %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/git.pm:727
|
#: ../IkiWiki/Plugin/git.pm:764
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "you cannot act on a file with mode %s"
|
msgid "you cannot act on a file with mode %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/git.pm:731
|
#: ../IkiWiki/Plugin/git.pm:768
|
||||||
msgid "you are not allowed to change file modes"
|
msgid "you are not allowed to change file modes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ msgstr ""
|
||||||
msgid "more"
|
msgid "more"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/openid.pm:58
|
#: ../IkiWiki/Plugin/openid.pm:70
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to load openid module: "
|
msgid "failed to load openid module: "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -610,7 +610,7 @@ msgstr ""
|
||||||
msgid "rebuilding all pages to fix meta titles"
|
msgid "rebuilding all pages to fix meta titles"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:394 ../IkiWiki/Render.pm:769
|
#: ../IkiWiki/Plugin/po.pm:394 ../IkiWiki/Render.pm:784
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "building %s"
|
msgid "building %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -619,48 +619,48 @@ msgstr ""
|
||||||
msgid "updated PO files"
|
msgid "updated PO files"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:456
|
#: ../IkiWiki/Plugin/po.pm:455
|
||||||
msgid ""
|
msgid ""
|
||||||
"Can not remove a translation. If the master page is removed, however, its "
|
"Can not remove a translation. If the master page is removed, however, its "
|
||||||
"translations will be removed as well."
|
"translations will be removed as well."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:476
|
#: ../IkiWiki/Plugin/po.pm:475
|
||||||
msgid ""
|
msgid ""
|
||||||
"Can not rename a translation. If the master page is renamed, however, its "
|
"Can not rename a translation. If the master page is renamed, however, its "
|
||||||
"translations will be renamed as well."
|
"translations will be renamed as well."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:876
|
#: ../IkiWiki/Plugin/po.pm:875
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "POT file (%s) does not exist"
|
msgid "POT file (%s) does not exist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:890
|
#: ../IkiWiki/Plugin/po.pm:889
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to copy underlay PO file to %s"
|
msgid "failed to copy underlay PO file to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:899
|
#: ../IkiWiki/Plugin/po.pm:898
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to update %s"
|
msgid "failed to update %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:905
|
#: ../IkiWiki/Plugin/po.pm:904
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to copy the POT file to %s"
|
msgid "failed to copy the POT file to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:941
|
#: ../IkiWiki/Plugin/po.pm:940
|
||||||
msgid "N/A"
|
msgid "N/A"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:954
|
#: ../IkiWiki/Plugin/po.pm:953
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to translate %s"
|
msgid "failed to translate %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/po.pm:1038
|
#: ../IkiWiki/Plugin/po.pm:1037
|
||||||
msgid "removed obsolete PO files"
|
msgid "removed obsolete PO files"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ msgstr ""
|
||||||
msgid "Please select the attachments to remove."
|
msgid "Please select the attachments to remove."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/remove.pm:216
|
#: ../IkiWiki/Plugin/remove.pm:217
|
||||||
msgid "removed"
|
msgid "removed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ msgstr ""
|
||||||
msgid "rename %s to %s"
|
msgid "rename %s to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/rename.pm:576
|
#: ../IkiWiki/Plugin/rename.pm:577
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "update for rename of %s to %s"
|
msgid "update for rename of %s to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -988,26 +988,26 @@ msgstr ""
|
||||||
msgid "enable %s?"
|
msgid "enable %s?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/websetup.pm:276
|
#: ../IkiWiki/Plugin/websetup.pm:272
|
||||||
msgid "setup file for this wiki is not known"
|
msgid "setup file for this wiki is not known"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/websetup.pm:292
|
#: ../IkiWiki/Plugin/websetup.pm:288
|
||||||
msgid "main"
|
msgid "main"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/websetup.pm:435
|
#: ../IkiWiki/Plugin/websetup.pm:431
|
||||||
msgid ""
|
msgid ""
|
||||||
"The configuration changes shown below require a wiki rebuild to take effect."
|
"The configuration changes shown below require a wiki rebuild to take effect."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/websetup.pm:439
|
#: ../IkiWiki/Plugin/websetup.pm:435
|
||||||
msgid ""
|
msgid ""
|
||||||
"For the configuration changes shown below to fully take effect, you may need "
|
"For the configuration changes shown below to fully take effect, you may need "
|
||||||
"to rebuild the wiki."
|
"to rebuild the wiki."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/websetup.pm:476
|
#: ../IkiWiki/Plugin/websetup.pm:472
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "Error: %s exited nonzero (%s). Discarding setup changes."
|
msgid "Error: %s exited nonzero (%s). Discarding setup changes."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1017,7 +1017,7 @@ msgstr ""
|
||||||
msgid "cannot determine id of untrusted committer %s"
|
msgid "cannot determine id of untrusted committer %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Receive.pm:86
|
#: ../IkiWiki/Receive.pm:85
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "bad file name %s"
|
msgid "bad file name %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1034,47 +1034,47 @@ msgid ""
|
||||||
"allow this"
|
"allow this"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:311
|
#: ../IkiWiki/Render.pm:316
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "skipping bad filename %s"
|
msgid "skipping bad filename %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:327
|
#: ../IkiWiki/Render.pm:332
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "%s has multiple possible source pages"
|
msgid "%s has multiple possible source pages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:369
|
#: ../IkiWiki/Render.pm:372
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "querying %s for file creation and modification times.."
|
msgid "querying %s for file creation and modification times.."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:431
|
#: ../IkiWiki/Render.pm:446
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "removing obsolete %s"
|
msgid "removing obsolete %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:505
|
#: ../IkiWiki/Render.pm:520
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "building %s, which links to %s"
|
msgid "building %s, which links to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:514
|
#: ../IkiWiki/Render.pm:529
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "removing %s, no longer built by %s"
|
msgid "removing %s, no longer built by %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:597 ../IkiWiki/Render.pm:679
|
#: ../IkiWiki/Render.pm:612 ../IkiWiki/Render.pm:694
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "building %s, which depends on %s"
|
msgid "building %s, which depends on %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:692
|
#: ../IkiWiki/Render.pm:707
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "building %s, to update its backlinks"
|
msgid "building %s, to update its backlinks"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:821
|
#: ../IkiWiki/Render.pm:836
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "ikiwiki: cannot build %s"
|
msgid "ikiwiki: cannot build %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1179,31 +1179,31 @@ msgstr ""
|
||||||
msgid "cannot use multiple rcs plugins"
|
msgid "cannot use multiple rcs plugins"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:606
|
#: ../IkiWiki.pm:607
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to load external plugin needed for %s plugin: %s"
|
msgid "failed to load external plugin needed for %s plugin: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:1298
|
#: ../IkiWiki.pm:1299
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "preprocessing loop detected on %s at depth %i"
|
msgid "preprocessing loop detected on %s at depth %i"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:1993
|
#: ../IkiWiki.pm:1994
|
||||||
msgid "yes"
|
msgid "yes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:2070
|
#: ../IkiWiki.pm:2071
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "invalid sort type %s"
|
msgid "invalid sort type %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:2091
|
#: ../IkiWiki.pm:2092
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "unknown sort type %s"
|
msgid "unknown sort type %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:2227
|
#: ../IkiWiki.pm:2228
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "cannot match pages: %s"
|
msgid "cannot match pages: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
25
t/bazaar.t
25
t/bazaar.t
|
@ -24,11 +24,19 @@ IkiWiki::checkconfig();
|
||||||
|
|
||||||
system "bzr init $config{srcdir}";
|
system "bzr init $config{srcdir}";
|
||||||
|
|
||||||
|
use CGI::Session;
|
||||||
|
my $session=CGI::Session->new;
|
||||||
|
$session->param("name", "Joe User");
|
||||||
|
|
||||||
# Web commit
|
# Web commit
|
||||||
my $test1 = readfile("t/test1.mdwn");
|
my $test1 = readfile("t/test1.mdwn");
|
||||||
writefile('test1.mdwn', $config{srcdir}, $test1);
|
writefile('test1.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test1.mdwn");
|
IkiWiki::rcs_add("test1.mdwn");
|
||||||
IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo", "Joe User");
|
IkiWiki::rcs_commit(
|
||||||
|
file => "test1.mdwn",
|
||||||
|
message => "Added the first page",
|
||||||
|
token => "moo",
|
||||||
|
session => $session);
|
||||||
|
|
||||||
my @changes;
|
my @changes;
|
||||||
@changes = IkiWiki::rcs_recentchanges(3);
|
@changes = IkiWiki::rcs_recentchanges(3);
|
||||||
|
@ -66,7 +74,10 @@ ok($mtime >= time() - 20);
|
||||||
writefile('test3.mdwn', $config{srcdir}, $test1);
|
writefile('test3.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test3.mdwn");
|
IkiWiki::rcs_add("test3.mdwn");
|
||||||
IkiWiki::rcs_rename("test3.mdwn", "test4.mdwn");
|
IkiWiki::rcs_rename("test3.mdwn", "test4.mdwn");
|
||||||
IkiWiki::rcs_commit_staged("Added the 4th page", "moo", "Joe User");
|
IkiWiki::rcs_commit_staged(
|
||||||
|
message => "Added the 4th page",
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
|
|
||||||
@changes = IkiWiki::rcs_recentchanges(4);
|
@changes = IkiWiki::rcs_recentchanges(4);
|
||||||
|
|
||||||
|
@ -75,7 +86,10 @@ is($changes[0]{pages}[0]{"page"}, "test4");
|
||||||
|
|
||||||
ok(mkdir($config{srcdir}."/newdir"));
|
ok(mkdir($config{srcdir}."/newdir"));
|
||||||
IkiWiki::rcs_rename("test4.mdwn", "newdir/test5.mdwn");
|
IkiWiki::rcs_rename("test4.mdwn", "newdir/test5.mdwn");
|
||||||
IkiWiki::rcs_commit_staged("Added the 5th page", "moo", "Joe User");
|
IkiWiki::rcs_commit_staged(
|
||||||
|
message => "Added the 5th page",
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
|
|
||||||
@changes = IkiWiki::rcs_recentchanges(4);
|
@changes = IkiWiki::rcs_recentchanges(4);
|
||||||
|
|
||||||
|
@ -83,6 +97,9 @@ is($#changes, 3);
|
||||||
is($changes[0]{pages}[0]{"page"}, "newdir/test5");
|
is($changes[0]{pages}[0]{"page"}, "newdir/test5");
|
||||||
|
|
||||||
IkiWiki::rcs_remove("newdir/test5.mdwn");
|
IkiWiki::rcs_remove("newdir/test5.mdwn");
|
||||||
IkiWiki::rcs_commit_staged("Remove the 5th page", "moo", "Joe User");
|
IkiWiki::rcs_commit_staged(
|
||||||
|
message => "Remove the 5th page",
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
|
|
||||||
system "rm -rf $dir";
|
system "rm -rf $dir";
|
||||||
|
|
6
t/cvs.t
6
t/cvs.t
|
@ -46,7 +46,11 @@ system "cvs -d $cvsrepo co -d $config{srcdir} ikiwiki >/dev/null";
|
||||||
my $test1 = readfile("t/test1.mdwn");
|
my $test1 = readfile("t/test1.mdwn");
|
||||||
writefile('test1.mdwn', $config{srcdir}, $test1);
|
writefile('test1.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test1.mdwn");
|
IkiWiki::rcs_add("test1.mdwn");
|
||||||
IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo");
|
IkiWiki::rcs_commit(
|
||||||
|
files => "test1.mdwn",
|
||||||
|
message => "Added the first page",
|
||||||
|
token => "moo"
|
||||||
|
);
|
||||||
|
|
||||||
my @changes;
|
my @changes;
|
||||||
@changes = IkiWiki::rcs_recentchanges(3);
|
@changes = IkiWiki::rcs_recentchanges(3);
|
||||||
|
|
12
t/git.t
12
t/git.t
|
@ -38,7 +38,11 @@ is($changes[0]{pages}[0]{"page"}, ".gitignore");
|
||||||
my $test1 = readfile("t/test1.mdwn");
|
my $test1 = readfile("t/test1.mdwn");
|
||||||
writefile('test1.mdwn', $config{srcdir}, $test1);
|
writefile('test1.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test1.mdwn");
|
IkiWiki::rcs_add("test1.mdwn");
|
||||||
IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo");
|
IkiWiki::rcs_commit(
|
||||||
|
file => "test1.mdwn",
|
||||||
|
message => "Added the first page",
|
||||||
|
token => "moo",
|
||||||
|
);
|
||||||
|
|
||||||
@changes = IkiWiki::rcs_recentchanges(3);
|
@changes = IkiWiki::rcs_recentchanges(3);
|
||||||
|
|
||||||
|
@ -68,7 +72,7 @@ is($changes[1]{pages}[0]{"page"}, "test1");
|
||||||
writefile('test3.mdwn', $config{srcdir}, $test1);
|
writefile('test3.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test3.mdwn");
|
IkiWiki::rcs_add("test3.mdwn");
|
||||||
IkiWiki::rcs_rename("test3.mdwn", "test4.mdwn");
|
IkiWiki::rcs_rename("test3.mdwn", "test4.mdwn");
|
||||||
IkiWiki::rcs_commit_staged("Added the 4th page", "moo", "Joe User");
|
IkiWiki::rcs_commit_staged(message => "Added the 4th page");
|
||||||
|
|
||||||
@changes = IkiWiki::rcs_recentchanges(4);
|
@changes = IkiWiki::rcs_recentchanges(4);
|
||||||
|
|
||||||
|
@ -77,7 +81,7 @@ is($changes[0]{pages}[0]{"page"}, "test4");
|
||||||
|
|
||||||
ok(mkdir($config{srcdir}."/newdir"));
|
ok(mkdir($config{srcdir}."/newdir"));
|
||||||
IkiWiki::rcs_rename("test4.mdwn", "newdir/test5.mdwn");
|
IkiWiki::rcs_rename("test4.mdwn", "newdir/test5.mdwn");
|
||||||
IkiWiki::rcs_commit_staged("Added the 5th page", "moo", "Joe User");
|
IkiWiki::rcs_commit_staged(message => "Added the 5th page");
|
||||||
|
|
||||||
@changes = IkiWiki::rcs_recentchanges(4);
|
@changes = IkiWiki::rcs_recentchanges(4);
|
||||||
|
|
||||||
|
@ -85,6 +89,6 @@ is($#changes, 3);
|
||||||
is($changes[0]{pages}[0]{"page"}, "newdir/test5");
|
is($changes[0]{pages}[0]{"page"}, "newdir/test5");
|
||||||
|
|
||||||
IkiWiki::rcs_remove("newdir/test5.mdwn");
|
IkiWiki::rcs_remove("newdir/test5.mdwn");
|
||||||
IkiWiki::rcs_commit_staged("Remove the 5th page", "moo", "Joe User");
|
IkiWiki::rcs_commit_staged(message => "Remove the 5th page");
|
||||||
|
|
||||||
system "rm -rf $dir";
|
system "rm -rf $dir";
|
||||||
|
|
|
@ -22,13 +22,22 @@ $config{srcdir} = "$dir/repo";
|
||||||
IkiWiki::loadplugins();
|
IkiWiki::loadplugins();
|
||||||
IkiWiki::checkconfig();
|
IkiWiki::checkconfig();
|
||||||
|
|
||||||
|
use CGI::Session;
|
||||||
|
my $session=CGI::Session->new;
|
||||||
|
$session->param("name", "Joe User");
|
||||||
|
|
||||||
system "hg init $config{srcdir}";
|
system "hg init $config{srcdir}";
|
||||||
|
|
||||||
# Web commit
|
# Web commit
|
||||||
my $test1 = readfile("t/test1.mdwn");
|
my $test1 = readfile("t/test1.mdwn");
|
||||||
writefile('test1.mdwn', $config{srcdir}, $test1);
|
writefile('test1.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test1.mdwn");
|
IkiWiki::rcs_add("test1.mdwn");
|
||||||
IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo", "Joe User");
|
IkiWiki::rcs_commit(
|
||||||
|
file => "test1.mdwn",
|
||||||
|
message => "Added the first page",
|
||||||
|
token => "moo",
|
||||||
|
session => $session,
|
||||||
|
);
|
||||||
|
|
||||||
my @changes;
|
my @changes;
|
||||||
@changes = IkiWiki::rcs_recentchanges(3);
|
@changes = IkiWiki::rcs_recentchanges(3);
|
||||||
|
|
6
t/svn.t
6
t/svn.t
|
@ -36,7 +36,11 @@ system "svn co file://$svnrepo/trunk $config{srcdir} >/dev/null";
|
||||||
my $test1 = readfile("t/test1.mdwn");
|
my $test1 = readfile("t/test1.mdwn");
|
||||||
writefile('test1.mdwn', $config{srcdir}, $test1);
|
writefile('test1.mdwn', $config{srcdir}, $test1);
|
||||||
IkiWiki::rcs_add("test1.mdwn");
|
IkiWiki::rcs_add("test1.mdwn");
|
||||||
IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo");
|
IkiWiki::rcs_commit(
|
||||||
|
file => "test1.mdwn",
|
||||||
|
message => "Added the first page",
|
||||||
|
token => "moo",
|
||||||
|
);
|
||||||
|
|
||||||
my @changes;
|
my @changes;
|
||||||
@changes = IkiWiki::rcs_recentchanges(3);
|
@changes = IkiWiki::rcs_recentchanges(3);
|
||||||
|
|
Loading…
Reference in New Issue