diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-08-21 03:31:27 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-08-21 03:31:27 +0000 |
commit | 62a4ea821dc02bf2f48fbd822f409de35eb68ced (patch) | |
tree | 2097012e7cddc076c91fffc3e9f0b12707ddb649 | |
parent | 4fcf25a8200a25a850f095ac90b5ac9f4e395664 (diff) |
move enormous data block to __DATA__
-rw-r--r-- | IkiWiki/Rcs/monotone.pm | 113 |
1 files changed, 59 insertions, 54 deletions
diff --git a/IkiWiki/Rcs/monotone.pm b/IkiWiki/Rcs/monotone.pm index 0435dc45c..4709dc04f 100644 --- a/IkiWiki/Rcs/monotone.pm +++ b/IkiWiki/Rcs/monotone.pm @@ -129,59 +129,9 @@ sub check_mergerc() { my $mergerc = $config{mtnmergerc}; if (! -r $mergerc ) { warn("$mergerc doesn't exist. Creating file with default mergers."); - open(DATA, ">$mergerc") or error("can't open $mergerc $!"); - my $defaultrc = "". -" function local_execute_redirected(stdin, stdout, stderr, path, ...)\n". -" local pid\n". -" local ret = -1\n". -" io.flush();\n". -" pid = spawn_redirected(stdin, stdout, stderr, path, unpack(arg))\n". -" if (pid ~= -1) then ret, pid = wait(pid) end\n". -" return ret\n". -" end\n". -" if (not execute_redirected) then -- use standard function if available\n". -" execute_redirected = local_execute_redirected\n". -" end\n". -" if (not mergers.fail) then -- use standard merger if available\n". -" mergers.fail = {\n". -" cmd = function (tbl) return false end,\n". -" available = function () return true end,\n". -" wanted = function () return true end\n". -" }\n". -" end\n". -" mergers.diffutils_force = {\n". -" cmd = function (tbl)\n". -" local ret = execute_redirected(\n". -" \"\",\n". -" tbl.outfile,\n". -" \"\",\n". -" \"diff3\",\n". -" \"--merge\",\n". -" \"--show-overlap\",\n". -" \"--label\", string.format(\"[Yours]\", tbl.left_path ),\n". -" \"--label\", string.format(\"[Original]\", tbl.anc_path ),\n". -" \"--label\", string.format(\"[Theirs]\", tbl.right_path),\n". -" tbl.lfile,\n". -" tbl.afile,\n". -" tbl.rfile\n". -" )\n". -" if (ret > 1) then\n". -" io.write(gettext(\"Error running GNU diffutils 3-way difference tool 'diff3'\"))\n". -" return false\n". -" end\n". -" return tbl.outfile\n". -" end,\n". -" available =\n". -" function ()\n". -" return program_exists_in_path(\"diff3\");\n". -" end,\n". -" wanted =\n". -" function ()\n". -" return true\n". -" end\n". -" }\n"; - print DATA $defaultrc; - close(DATA); + open(my $out, ">$mergerc") or error("can't open $mergerc: $!"); + print $out <DATA>; + close $out; } } @@ -351,7 +301,7 @@ sub rcs_commit ($$$;$$) { warn("Auto-merge failed. Using diff-merge to add conflict markers."); $ENV{MTN_MERGE}="diffutils_force"; - my $mergeResult = mtn_merge($newRevID, $rev, $branch, $author, "Merge parallel conflicting web edits (adding inline conflict markers).\nThis revision should be cleaned up manually."); + $mergeResult = mtn_merge($newRevID, $rev, $branch, $author, "Merge parallel conflicting web edits (adding inline conflict markers).\nThis revision should be cleaned up manually."); $ENV{MTN_MERGE}=""; if (!defined($mergeResult)) { @@ -619,3 +569,58 @@ sub rcs_getctime ($) { debug("found ctime ".localtime($date)." for $file"); return $date; } + +1 + +# default mergerc content +__DATA__ + function local_execute_redirected(stdin, stdout, stderr, path, ...) + local pid + local ret = -1 + io.flush(); + pid = spawn_redirected(stdin, stdout, stderr, path, unpack(arg)) + if (pid ~= -1) then ret, pid = wait(pid) end + return ret + end + if (not execute_redirected) then -- use standard function if available + execute_redirected = local_execute_redirected + end + if (not mergers.fail) then -- use standard merger if available + mergers.fail = { + cmd = function (tbl) return false end, + available = function () return true end, + wanted = function () return true end + } + end + mergers.diffutils_force = { + cmd = function (tbl) + local ret = execute_redirected( + "", + tbl.outfile, + "", + "diff3", + "--merge", + "--show-overlap", + "--label", string.format("[Yours]", tbl.left_path ), + "--label", string.format("[Original]", tbl.anc_path ), + "--label", string.format("[Theirs]", tbl.right_path), + tbl.lfile, + tbl.afile, + tbl.rfile + ) + if (ret > 1) then + io.write(gettext("Error running GNU diffutils 3-way difference tool 'diff3'")) + return false + end + return tbl.outfile + end, + available = + function () + return program_exists_in_path("diff3"); + end, + wanted = + function () + return true + end + } +EOF |