* Mercurial backend improvements, including --get-ctime support.
parent
06137b95d4
commit
b20d4f6681
|
@ -107,6 +107,9 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
|
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num);
|
||||||
open (my $out, "@cmdline |");
|
open (my $out, "@cmdline |");
|
||||||
|
|
||||||
|
eval q{use Date::Parse};
|
||||||
|
error($@) if $@;
|
||||||
|
|
||||||
my @ret;
|
my @ret;
|
||||||
foreach my $info (mercurial_log($out)) {
|
foreach my $info (mercurial_log($out)) {
|
||||||
my @pages = ();
|
my @pages = ();
|
||||||
|
@ -135,7 +138,7 @@ sub rcs_recentchanges ($) { #{{{
|
||||||
rev => $info->{"changeset"},
|
rev => $info->{"changeset"},
|
||||||
user => $user,
|
user => $user,
|
||||||
committype => "mercurial",
|
committype => "mercurial",
|
||||||
when => $info->{"date"},
|
when => str2time($info->{"date"}),
|
||||||
message => [@message],
|
message => [@message],
|
||||||
pages => [@pages],
|
pages => [@pages],
|
||||||
};
|
};
|
||||||
|
@ -149,7 +152,24 @@ sub rcs_notify () { #{{{
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub rcs_getctime ($) { #{{{
|
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
|
1
|
||||||
|
|
|
@ -46,8 +46,9 @@ ikiwiki (1.34) UNRELEASED; urgency=low
|
||||||
* Add softwaresite example.
|
* Add softwaresite example.
|
||||||
* Add a poll plugin.
|
* Add a poll plugin.
|
||||||
* Add quick mode for archive page generation.
|
* Add quick mode for archive page generation.
|
||||||
|
* Mercurial backend improvements, including --get-ctime support.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 23 Nov 2006 17:13:32 -0500
|
-- Joey Hess <joeyh@debian.org> Sun, 26 Nov 2006 15:01:14 -0500
|
||||||
|
|
||||||
ikiwiki (1.33) unstable; urgency=low
|
ikiwiki (1.33) unstable; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
* Need to get post commit hook working (or an example of how to use it.)
|
* Need to get post commit hook working (or an example of how to use it.)
|
||||||
* Need --ctime support.
|
|
||||||
* rcs_notify is not implemented
|
* rcs_notify is not implemented
|
||||||
* Is the code sufficiently robust? It just warns when mercurial fails.
|
* Is the code sufficiently robust? It just warns when mercurial fails.
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
use Test::More tests => 10;
|
use Test::More tests => 11;
|
||||||
|
|
||||||
BEGIN { use_ok("IkiWiki"); }
|
BEGIN { use_ok("IkiWiki"); }
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ my $message = "Added the second page";
|
||||||
my $test2 = readfile("t/test2.mdwn");
|
my $test2 = readfile("t/test2.mdwn");
|
||||||
writefile('test2.mdwn', $config{srcdir}, $test2);
|
writefile('test2.mdwn', $config{srcdir}, $test2);
|
||||||
system "hg add -R $config{srcdir} $config{srcdir}/test2.mdwn";
|
system "hg add -R $config{srcdir} $config{srcdir}/test2.mdwn";
|
||||||
system "hg commit -R $config{srcdir} -u \"$user\" -m \"$message\"";
|
system "hg commit -R $config{srcdir} -u \"$user\" -m \"$message\" -d \"0 0\"";
|
||||||
|
|
||||||
@changes = IkiWiki::rcs_recentchanges(3);
|
@changes = IkiWiki::rcs_recentchanges(3);
|
||||||
|
|
||||||
|
@ -56,4 +56,7 @@ is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
|
||||||
|
|
||||||
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
|
is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
|
||||||
|
|
||||||
|
my $ctime = IkiWiki::rcs_getctime("test2.mdwn");
|
||||||
|
is($ctime, 0);
|
||||||
|
|
||||||
system "rm -rf $dir";
|
system "rm -rf $dir";
|
||||||
|
|
Loading…
Reference in New Issue