summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-26 20:01:43 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-26 20:01:43 +0000
commitb20d4f6681c0f2ccebc8ea2d75414d3d194c5188 (patch)
tree1ee88e32735ace7a639432d07bc6fd1bc4eca04b /IkiWiki
parent06137b95d419fd62a3c8065430fec302c2680454 (diff)
* Mercurial backend improvements, including --get-ctime support.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Rcs/mercurial.pm24
1 files changed, 22 insertions, 2 deletions
diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm
index da2beb7cd..67002ac57 100644
--- a/IkiWiki/Rcs/mercurial.pm
+++ b/IkiWiki/Rcs/mercurial.pm
@@ -107,6 +107,9 @@ sub rcs_recentchanges ($) { #{{{
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
open (my $out, "@cmdline |");
+ eval q{use Date::Parse};
+ error($@) if $@;
+
my @ret;
foreach my $info (mercurial_log($out)) {
my @pages = ();
@@ -135,7 +138,7 @@ sub rcs_recentchanges ($) { #{{{
rev => $info->{"changeset"},
user => $user,
committype => "mercurial",
- when => $info->{"date"},
+ when => str2time($info->{"date"}),
message => [@message],
pages => [@pages],
};
@@ -149,7 +152,24 @@ sub rcs_notify () { #{{{
} #}}}
sub rcs_getctime ($) { #{{{
- error "getctime not implemented";
+ 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', $file);
+ open (my $out, "@cmdline |");
+
+ my @log = mercurial_log($out);
+
+ if (length @log < 1) {
+ return 0;
+ }
+
+ eval q{use Date::Parse};
+ error($@) if $@;
+
+ my $ctime = str2time($log[0]->{"date"});
+ return $ctime;
} #}}}
1