6 $dir = "/tmp/ikiwiki-test-hg.$$";
9 if (! -x $hg || ! mkdir($dir)) {
11 use Test::More skip_all => "hg not available or could not make test dir"
15 use Test::More tests => 11;
17 BEGIN { use_ok("IkiWiki"); }
19 %config=IkiWiki::defaultconfig();
20 $config{rcs} = "mercurial";
21 $config{srcdir} = "$dir/repo";
22 IkiWiki::checkconfig();
24 system "hg init $config{srcdir}";
27 my $test1 = readfile("t/test1.mdwn");
28 writefile('test1.mdwn', $config{srcdir}, $test1);
29 IkiWiki::rcs_add("test1.mdwn");
30 IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo", "Joe User");
33 @changes = IkiWiki::rcs_recentchanges(3);
36 is($changes[0]{message}[0]{"line"}, "Added the first page");
37 is($changes[0]{pages}[0]{"page"}, "test1.mdwn");
38 is($changes[0]{user}, "Joe User");
41 my $username = "Foo Bar";
42 my $user = "$username <foo.bar\@example.com>";
43 my $message = "Added the second page";
45 my $test2 = readfile("t/test2.mdwn");
46 writefile('test2.mdwn', $config{srcdir}, $test2);
47 system "hg add -R $config{srcdir} $config{srcdir}/test2.mdwn";
48 system "hg commit -R $config{srcdir} -u \"$user\" -m \"$message\" -d \"0 0\"";
50 @changes = IkiWiki::rcs_recentchanges(3);
53 is($changes[0]{message}[0]{"line"}, $message);
54 is($changes[0]{user}, $username);
55 is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
57 is($changes[1]{pages}[0]{"page"}, "test1.mdwn");
60 local $TODO = "hg behavior change seems to have broken this";
61 my $ctime = IkiWiki::rcs_getctime("test2.mdwn");