6 $dir = "/tmp/ikiwiki-test-hg.$$";
11 use Test::More skip_all => "hg not available"
18 use Test::More tests => 11;
20 BEGIN { use_ok("IkiWiki"); }
22 %config=IkiWiki::defaultconfig();
23 $config{rcs} = "mercurial";
24 $config{srcdir} = "$dir/repo";
25 IkiWiki::loadplugins();
26 IkiWiki::checkconfig();
29 my $session=CGI::Session->new;
30 $session->param("name", "Joe User");
32 system "hg init $config{srcdir}";
35 my $test1 = readfile("t/test1.mdwn");
36 writefile('test1.mdwn', $config{srcdir}, $test1);
37 IkiWiki::rcs_add("test1.mdwn");
40 message => "Added the first page",
46 @changes = IkiWiki::rcs_recentchanges(3);
49 is($changes[0]{message}[0]{"line"}, "Added the first page");
50 is($changes[0]{pages}[0]{"page"}, "test1");
51 is($changes[0]{user}, "Joe User");
54 my $username = "Foo Bar";
55 my $user = "$username <foo.bar\@example.com>";
56 my $message = "Added the second page";
58 my $test2 = readfile("t/test2.mdwn");
59 writefile('test2.mdwn', $config{srcdir}, $test2);
60 system "hg add -R $config{srcdir} $config{srcdir}/test2.mdwn";
61 system "hg commit -R $config{srcdir} -u \"$user\" -m \"$message\" -d \"0 0\"";
63 @changes = IkiWiki::rcs_recentchanges(3);
66 is($changes[0]{message}[0]{"line"}, $message);
67 is($changes[0]{user}, $username);
68 is($changes[0]{pages}[0]{"page"}, "test2");
70 is($changes[1]{pages}[0]{"page"}, "test1");
72 my $ctime = IkiWiki::rcs_getctime("test2.mdwn");