X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/21add7ffa87a5e622d18bdbb24c638c15bdb3800..d5c680e693def6d59fcb7c8831356d5acad14cae:/IkiWiki/Plugin/mercurial.pm diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index 82423286d..a80bb2da5 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -20,6 +20,7 @@ sub import { hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime); } sub checkconfig () { @@ -36,6 +37,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => undef, + section => "rcs", }, mercurial_wrapper => { type => "string", @@ -217,7 +219,7 @@ sub rcs_recentchanges ($) { push @ret, { rev => $info->{"changeset"}, user => $user, - committype => "mercurial", + committype => "hg", when => str2time($info->{"date"}), message => [@message], pages => [@pages], @@ -234,23 +236,25 @@ sub rcs_diff ($) { sub rcs_getctime ($) { my ($file) = @_; - # 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', - "--style", "default", "$config{srcdir}/$file"); - open (my $out, "@cmdline |"); + my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", + "--style", "default", $file); + open (my $out, "-|", @cmdline); - my @log = mercurial_log($out); + my @log = (mercurial_log($out)); - if (length @log < 1) { + if (@log < 1) { return 0; } eval q{use Date::Parse}; error($@) if $@; - my $ctime = str2time($log[0]->{"date"}); + my $ctime = str2time($log[$#log]->{"date"}); return $ctime; } +sub rcs_getmtime ($) { + error "rcs_getmtime is not implemented for mercurial\n"; # TODO +} + 1