7 use open qw{:utf8 :std};
11 sub mercurial_log($) {
19 if (/^description:/) {
23 # slurp everything as the description text
24 # until the next changeset
36 $infos[$#infos]{$key} = $value;
40 ($key, $value) = split /: +/, $line, 2;
42 if ($key eq "changeset") {
45 # remove the revision index, which is strictly
46 # local to the repository
50 $infos[$#infos]{$key} = $value;
57 sub rcs_update () { #{{{
58 my @cmdline = ("hg", "-R", "$config{srcdir}", "update");
59 if (system(@cmdline) != 0) {
60 warn "'@cmdline' failed: $!";
64 sub rcs_prepedit ($) { #{{{
68 sub rcs_commit ($$$) { #{{{
69 my ($file, $message, $rcstoken) = @_;
71 $message = possibly_foolish_untaint($message);
73 my @cmdline = ("hg", "-R", "$config{srcdir}", "commit", "-m", "$message");
74 if (system(@cmdline) != 0) {
75 warn "'@cmdline' failed: $!";
78 return undef; # success
81 sub rcs_add ($) { # {{{
84 my @cmdline = ("hg", "-R", "$config{srcdir}", "add", "$file");
85 if (system(@cmdline) != 0) {
86 warn "'@cmdline' failed: $!";
90 sub rcs_recentchanges ($) { #{{{
93 eval q{use CGI 'escapeHTML'};
95 my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
96 open (my $out, "@cmdline |");
99 foreach my $info (mercurial_log($out)) {
103 foreach my $msgline (split(/\n/, $info->{description})) {
104 push @message, { line => $msgline };
107 foreach my $file (split / /,$info->{files}) {
108 my $diffurl = $config{'diffurl'};
109 $diffurl =~ s/\[\[file\]\]/$file/go;
110 $diffurl =~ s/\[\[r2\]\]/$info->{changeset}/go;
113 page => pagename($file),
118 my $user = $info->{"user"};
119 $user =~ s/\s*<.*>\s*$//;
123 rev => $info->{"changeset"},
125 committype => "mercurial",
126 when => $info->{"date"},
127 message => [@message],
135 sub rcs_notify () { #{{{
139 sub rcs_getctime ($) { #{{{
140 error "getctime not implemented";