diff -r 8faf136ca94f Setup/Automator.pm --- a/Setup/Automator.pm Tue Jul 19 21:04:13 2011 +0200 +++ b/Setup/Automator.pm Wed Jul 20 15:33:21 2011 +0200 @@ -75,8 +75,7 @@ print STDERR "warning: do not know how to set up the bzr_wrapper hook!\n"; } elsif ($config{rcs} eq 'mercurial') { - # TODO - print STDERR "warning: do not know how to set up the mercurial_wrapper hook!\n"; + $config{mercurial_wrapper}=$config{srcdir}."/.hg/ikiwiki-wrapper"; } elsif ($config{rcs} eq 'tla') { # TODO @@ -187,6 +186,22 @@ die "ikiwiki --wrappers --setup $config{dumpsetup} failed"; } + # Setup initial config file for Mercurial to hook up the wrapper. + if ($config{rcs} eq 'mercurial' && exists $config{mercurial_wrapper} + && length $config{mercurial_wrapper}) { + # Use a relative path to avoid having to manually change the + # autogenerated hgrc if the user changes $config{srcdir}. + use File::Spec; + my $mercurial_wrapper_relpath=File::Spec->abs2rel($config{mercurial_wrapper}, $config{srcdir}); + open (HGRC, '>', $config{srcdir}.'/.hg/hgrc'); + print HGRC <>$ENV{HOME}/.ikiwiki/wikilist") || die "$ENV{HOME}/.ikiwiki/wikilist: $!";