#!/usr/bin/perl
+package IkiWiki;
+
use warnings;
use strict;
use IkiWiki;
use Encode;
use open qw{:utf8 :std};
-package IkiWiki;
-
sub mercurial_log($) {
my $out = shift;
my @infos;
}
sub rcs_update () { #{{{
- my @cmdline = ("hg", "-R", "$config{srcdir}", "update");
+ my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "update");
if (system(@cmdline) != 0) {
warn "'@cmdline' failed: $!";
}
$user = possibly_foolish_untaint($user);
}
elsif (defined $ipaddr) {
- $user = "Anonymous from $ipaddr";
+ $user = "Anonymous from ".possibly_foolish_untaint($ipaddr);
}
else {
$user = "Anonymous";
}
$message = possibly_foolish_untaint($message);
+ if (! length $message) {
+ $message = "no message given";
+ }
- my @cmdline = ("hg", "-R", "$config{srcdir}", "commit",
- "-m", "$message", "-u", "$user");
+ my @cmdline = ("hg", "-q", "-R", $config{srcdir}, "commit",
+ "-m", $message, "-u", $user);
if (system(@cmdline) != 0) {
warn "'@cmdline' failed: $!";
}
return undef; # success
} #}}}
+sub rcs_commit_staged ($$$) {
+ # Commits all staged changes. Changes can be staged using rcs_add,
+ # rcs_remove, and rcs_rename.
+ my ($message, $user, $ipaddr)=@_;
+
+ error("rcs_commit_staged not implemented for mercurial"); # TODO
+}
+
sub rcs_add ($) { # {{{
my ($file) = @_;
- my @cmdline = ("hg", "-R", "$config{srcdir}", "add", "$file");
+ my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "add", "$config{srcdir}/$file");
if (system(@cmdline) != 0) {
warn "'@cmdline' failed: $!";
}
} #}}}
+sub rcs_remove ($) { # {{{
+ my ($file) = @_;
+
+ error("rcs_remove not implemented for mercurial"); # TODO
+} #}}}
+
+sub rcs_rename ($$) { # {{{
+ my ($src, $dest) = @_;
+
+ error("rcs_rename not implemented for mercurial"); # TODO
+} #}}}
+
sub rcs_recentchanges ($) { #{{{
my ($num) = @_;
- eval q{use CGI 'escapeHTML'};
- error($@) if $@;
-
- my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
+ my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num,
+ "--style", "default");
open (my $out, "@cmdline |");
eval q{use Date::Parse};
return @ret;
} #}}}
-sub rcs_notify () { #{{{
+sub rcs_diff ($) { #{{{
# TODO
} #}}}
# XXX filename passes through the shell here, should try to avoid
# that just in case
- my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", '1', $file);
+ my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", '1',
+ "--style", "default", "$config{srcdir}/$file");
open (my $out, "@cmdline |");
my @log = mercurial_log($out);