}
}
-sub rcs_getctime ($) {
- my ($file) = @_;
-
- # XXX filename passes through the shell here, should try to avoid
- # that just in case
- my @cmdline = ("bzr", "log", "--limit", '1', "$config{srcdir}/$file");
- open (my $out, "@cmdline |");
-
+sub extract_timestamp ($) {
+ my ($out) = @_;
my @log = bzr_log($out);
if (length @log < 1) {
return $ctime;
}
+sub rcs_getctime ($) {
+ my ($file) = @_;
+
+ # XXX filename passes through the shell here, should try to avoid
+ # that just in case
+ my @cmdline = ("bzr", "log", "--forward", "--limit", '1', "$config{srcdir}/$file");
+ open (my $out, "@cmdline |");
+ return extract_timestamp($out);
+}
+
sub rcs_getmtime ($) {
- error "rcs_getmtime is not implemented for bzr\n"; # TODO
+ my ($file) = @_;
+
+ # XXX filename passes through the shell here, should try to avoid
+ # that just in case
+ my @cmdline = ("bzr", "log", "--limit", '1', "$config{srcdir}/$file");
+ open (my $out, "@cmdline |");
+ return extract_timestamp($out);
}
1
}
}
}
-use Test::More tests => 16;
+use Test::More tests => 17;
BEGIN { use_ok("IkiWiki"); }
my $ctime = IkiWiki::rcs_getctime("test2.mdwn");
ok($ctime >= time() - 20);
+my $mtime = IkiWiki::rcs_getmtime("test2.mdwn");
+ok($mtime >= time() - 20);
+
writefile('test3.mdwn', $config{srcdir}, $test1);
IkiWiki::rcs_add("test3.mdwn");
IkiWiki::rcs_rename("test3.mdwn", "test4.mdwn");