diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-08-21 03:22:45 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-08-21 03:22:45 +0000 |
commit | 4fcf25a8200a25a850f095ac90b5ac9f4e395664 (patch) | |
tree | 4f829876a694743f3c816e834db340961ae658e1 | |
parent | 50e1b43408e85fd2350b9df50e4ceb0c6a495a4f (diff) |
remove the mtnbinpath config option; users should use PATH if they need
this kind of thing.
change formatting of some quotes
-rw-r--r-- | IkiWiki/Rcs/monotone.pm | 41 | ||||
-rw-r--r-- | doc/ikiwiki.setup | 21 |
2 files changed, 28 insertions, 34 deletions
diff --git a/IkiWiki/Rcs/monotone.pm b/IkiWiki/Rcs/monotone.pm index 97b263aef..0435dc45c 100644 --- a/IkiWiki/Rcs/monotone.pm +++ b/IkiWiki/Rcs/monotone.pm @@ -1,12 +1,4 @@ #!/usr/bin/perl -# Monotone revision control. -# http://monotone.ca/ - -# This requires the Monotone perl module from the monotone contrib/ directory to be installed. -# In particlar, we require version 0.03 or higher of that module. -# It is available from the monotone source repository at: -# http://viewmtn.angrygoats.net/branch/changes/net.venge.monotone - use warnings; use strict; use IkiWiki; @@ -16,12 +8,9 @@ use Date::Format qw(time2str); package IkiWiki; -my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate sha1sums +my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate sha1sums sub check_config() { - if (!defined($config{srcdir})) { - error("Ikiwiki srcdir not defined!"); - } if (!defined($config{mtnrootdir})) { $config{mtnrootdir} = $config{srcdir}; } @@ -303,11 +292,15 @@ sub rcs_commit ($$$;$$) { #$automator->setOpts("-r", $oldrev, "-r", $rev); #my ($out, $err) = $automator->call("content_diff", $file); #debug("Problem committing $file") if ($err ne ""); + # FIXME: use of $file in these backticks is not wise from a + # security POV. Probably safe, but should be avoided + # anyway. my $diff = `mtn --root=$config{mtnrootdir} au content_diff -r $oldrev -r $rev $file`; # was just $out; if ($diff) { # this file has changed - # commit a revision with just this file changed off the old revision + # commit a revision with just this file changed off + # the old revision # first get the contents warn("File changed: forming branch\n"); my $newfile=readfile("$config{srcdir}/$file"); @@ -330,7 +323,7 @@ sub rcs_commit ($$$;$$) { $automator->close(); # if we made it to here then the file has been committed... revert the local copy - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "revert", $file) != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "revert", $file) != 0) { warn("Unable to revert $file after merge on conflicted commit!"); } warn("Divergence created! Attempting auto-merge."); @@ -344,14 +337,14 @@ sub rcs_commit ($$$;$$) { # push any changes so far if (defined($config{mtnsync}) && $config{mtnsync}) { - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "push", "--quiet", "--ticker=none", "--key", $config{mtnkey}) != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "push", "--quiet", "--ticker=none", "--key", $config{mtnkey}) != 0) { warn("monotone push failed\n"); } } if (defined($mergeResult)) { # everything is merged - bring outselves up to date - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "update", "-r", $mergeResult) != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "update", "-r", $mergeResult) != 0) { warn("Unable to update to rev $mergeResult after merge on conflicted commit!"); } } else { @@ -370,7 +363,7 @@ sub rcs_commit ($$$;$$) { } # suspend this revision because it has conflict markers... - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "update", "-r", $mergeResult) != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "update", "-r", $mergeResult) != 0) { warn("Unable to update to rev $mergeResult after conflict-enhanced merge on conflicted commit!"); } @@ -386,17 +379,17 @@ sub rcs_commit ($$$;$$) { # if we reached here then the file we're looking at hasn't changed since $oldrev. Commit it. - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "commit", "--quiet", "--author", $author, "--key", $config{mtnkey}, + if (system("mtn", "--root=$config{mtnrootdir}", "commit", "--quiet", "--author", $author, "--key", $config{mtnkey}, "-m", possibly_foolish_untaint($message), $file) != 0) { warn("Traditional commit failed!\nReturning data as conflict.\n"); my $conflict=readfile("$config{srcdir}/$file"); - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "revert", "--quiet", $file) != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "revert", "--quiet", $file) != 0) { warn("monotone revert failed\n"); } return $conflict; } if (defined($config{mtnsync}) && $config{mtnsync}) { - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "sync", "--quiet", "--ticker=none", "--key", $config{mtnkey}) != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "sync", "--quiet", "--ticker=none", "--key", $config{mtnkey}) != 0) { warn("monotone sync failed\n"); } } @@ -410,7 +403,7 @@ sub rcs_add ($) { check_config(); - if (system($config{mtnbinpath}, "--root=$config{mtnrootdir}", "add", "--quiet", "$config{srcdir}/$file") != 0) { + if (system("mtn", "--root=$config{mtnrootdir}", "add", "--quiet", "$config{srcdir}/$file") != 0) { error("Monotone add failed"); } } @@ -450,7 +443,7 @@ sub rcs_recentchanges ($) { my $child = open(MTNLOG, "-|"); if (! $child) { - exec($config{mtnbinpath}, "log", "--root=$config{mtnrootdir}", "--no-graph", "--brief") || error("mtn log failed to run"); + exec("mtn", "log", "--root=$config{mtnrootdir}", "--no-graph", "--brief") || error("mtn log failed to run"); } my $line; @@ -571,7 +564,7 @@ sub rcs_notify () { return $message; }, sub { - `$config{mtnbinpath} --root=$config{mtnrootdir} au content_diff -r $rev`; + `mtn --root=$config{mtnrootdir} au content_diff -r $rev`; }, $user, @changed_pages); } @@ -584,7 +577,7 @@ sub rcs_getctime ($) { my $child = open(MTNLOG, "-|"); if (! $child) { - exec($config{mtnbinpath}, "log", "--root=$config{mtnrootdir}", "--no-graph", "--brief", $file) || error("mtn log $file failed to run"); + exec("mtn", "log", "--root=$config{mtnrootdir}", "--no-graph", "--brief", $file) || error("mtn log $file failed to run"); } my $firstRev; diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index 864dc928f..897e8bc61 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -46,16 +46,17 @@ use IkiWiki::Setup::Standard { # Monotone stuff #rcs => "monotone", #mtnkey => "web\@machine.company.com", - # Monotone options - #mtnsync => 0, # set this if you want the wiki to sync on update and commit - #mtnrootdir => "path/to/root/of/workspace", # The path to your workspace (defaults to the srcdir itself) - # e.g. use if your srcdir is a subdirectory of the workspace - #mtnbinpath => "path/to/montone/binary", # by default we just use "mtn" and assume it is in your path. - #mtnmergerc => "path/to/mergerc", # this is a monotone lua hook file used by ikiwiki for - # inserting conflict markers. By default we use - # mtnrootdir/_MTN/mergerc. This hook will be populated with - # default code the first time you use ikiwiki. You can - # change it to alter how conflict markers are inserted. + # Set if you want the wiki to sync on update and commit. + #mtnsync => 0, + # The path to your workspace (defaults to the srcdir itself) + # e.g. use if your srcdir is a subdirectory of the workspace. + #mtnrootdir => "path/to/root/of/workspace", + # This is a monotone lua hook file used by ikiwiki for + # inserting conflict markers. By default it will use + # mtnrootdir/_MTN/mergerc. This hook will be populated with + # default code the first time you use ikiwiki. You can + # change it to alter how conflict markers are inserted. + #mtnmergerc => "path/to/mergerc", wrappers => [ #{ |