Advertisement
Guest User

mercurial_wrapper_setup_light.patch

a guest
Jul 20th, 2011
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.38 KB | None | 0 0
  1. diff -r 8faf136ca94f Setup/Automator.pm
  2. --- a/Setup/Automator.pm    Tue Jul 19 21:04:13 2011 +0200
  3. +++ b/Setup/Automator.pm    Wed Jul 20 15:33:21 2011 +0200
  4. @@ -75,8 +75,7 @@
  5.             print STDERR "warning: do not know how to set up the bzr_wrapper hook!\n";
  6.         }
  7.         elsif ($config{rcs} eq 'mercurial') {
  8. -           # TODO
  9. -           print STDERR "warning: do not know how to set up the mercurial_wrapper hook!\n";
  10. +           $config{mercurial_wrapper}=$config{srcdir}."/.hg/ikiwiki-wrapper";
  11.         }
  12.         elsif ($config{rcs} eq 'tla') {
  13.             # TODO
  14. @@ -187,6 +186,22 @@
  15.         die "ikiwiki --wrappers --setup $config{dumpsetup} failed";
  16.     }
  17.  
  18. +   # Setup initial config file for Mercurial to hook up the wrapper.
  19. +   if ($config{rcs} eq 'mercurial' && exists $config{mercurial_wrapper}
  20. +       && length $config{mercurial_wrapper}) {
  21. +       # Use a relative path to avoid having to manually change the
  22. +       # autogenerated hgrc if the user changes $config{srcdir}.
  23. +       use File::Spec;
  24. +       my $mercurial_wrapper_relpath=File::Spec->abs2rel($config{mercurial_wrapper}, $config{srcdir});
  25. +       open (HGRC, '>', $config{srcdir}.'/.hg/hgrc');
  26. +       print HGRC <<EOF;
  27. +[hooks]
  28. +post-commit.ikiwiki = $mercurial_wrapper_relpath
  29. +incoming.ikiwiki = $mercurial_wrapper_relpath
  30. +EOF
  31. +       close (HGRC);
  32. +   }
  33. +
  34.     # Add it to the wikilist.
  35.     mkpath("$ENV{HOME}/.ikiwiki");
  36.     open (WIKILIST, ">>$ENV{HOME}/.ikiwiki/wikilist") || die "$ENV{HOME}/.ikiwiki/wikilist: $!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement