]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/mercurial.pm
mercurial: Fix buggy getctime code.
[ikiwiki.git] / IkiWiki / Plugin / mercurial.pm
index 11fdec529373c6b430a8e77bebb2c0a3aa6972b7..a80bb2da59ddf91772bfa8928652fe1cff02f186 100644 (file)
@@ -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",
@@ -234,15 +236,13 @@ 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",
-               "--style", "default", "$config{srcdir}/$file");
-       open (my $out, "@cmdline |");
+               "--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;
        }
 
@@ -253,4 +253,8 @@ sub rcs_getctime ($) {
        return $ctime;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for mercurial\n"; # TODO
+}
+
 1