# # patch "ChangeLog" # from [e261217ecb9f380f65ab4569ec5ed18b67cdcf95] # to [330f8fc3b411d8a5d825a033b7aa800e312c3353] # # patch "std_hooks.lua" # from [598cbe38dd953fe9133e5151caeae60e0d07ea95] # to [4ed8fde74ed25fbbc5e693d3acd81c468768fed0] # --- ChangeLog +++ ChangeLog @@ -1,3 +1,7 @@ +2005-05-09 rghetta + + * std_hooks.lua: Support kdiff3. + 2005-05-09 Matthew Gregan * lua.cc (loadstring, run_string): New parameter to identify the --- std_hooks.lua +++ std_hooks.lua @@ -232,6 +232,31 @@ end end +function merge2_kdiff3_cmd(left_path, right_path, merged_path, lfile, rfile, outfile) + return + function() + return execute("kdiff3", + "--L1", left_path, + "--L2", right_path, + lfile, rfile, + "-o", outfile) + end +end + +function merge3_kdiff3_cmd(left_path, anc_path, right_path, merged_path, + lfile, afile, rfile, outfile) + return + function() + return execute("kdiff3", + "--L1", anc_path, + "--L2", left_path, + "--L3", right_path, + afile, lfile, rfile, + "--merge", + "--o", outfile) + end +end + function write_to_temporary_file(data) tmp, filename = temp_file() if (tmp == nil) then @@ -272,7 +297,10 @@ outfile ~= nil then local cmd = nil - if program_exists_in_path("meld") then + if program_exists_in_path("kdiff3") then + cmd = merge2_kdiff3_cmd(left_path, right_path, merged_path, + lfile, rfile, outfile) + elseif program_exists_in_path("meld") then meld_exists = true io.write(string.format("\nWARNING: 'meld' was choosen to perform external 2-way merge.\n" .. "You should merge all changes to *LEFT* file due to limitation of program\n" .. @@ -335,7 +363,10 @@ outfile ~= nil then local cmd = nil - if program_exists_in_path("meld") then + if program_exists_in_path("kdiff3") then + cmd = merge3_kdiff3_cmd(left_path, anc_path, right_path, merged_path, + lfile, afile, rfile, outfile) + elseif program_exists_in_path("meld") then meld_exists = true io.write(string.format("\nWARNING: 'meld' was choosen to perform external 3-way merge.\n" .. "You should merge all changes to *CENTER* file due to limitation of program\n" ..