# # patch "ChangeLog" # from [321bfa7b9d52da2e3b3dbe2eff53794d10630cb1] # to [d3e24bb1960a28fcdf6539ab28650760cf3f7f4c] # # patch "std_hooks.lua" # from [a5d4006c7e8837fcd3e816c309c4fb7bee69393a] # to [c8e8b4d4e236651d18100525e5d3efe69f090af0] # ======================================================================== --- ChangeLog 321bfa7b9d52da2e3b3dbe2eff53794d10630cb1 +++ ChangeLog d3e24bb1960a28fcdf6539ab28650760cf3f7f4c @@ -1,3 +1,8 @@ +2005-08-31 Marcel van der Boom + + * std_hooks.lua (execute_confirm): New function. + (merge2_opendiff_cmd, merge3_opendiff_cmd): Add. + 2005-08-31 Matthew Gregan * paths.cc (test_bookkeeping_path, test_system_path): Second ======================================================================== --- std_hooks.lua a5d4006c7e8837fcd3e816c309c4fb7bee69393a +++ std_hooks.lua c8e8b4d4e236651d18100525e5d3efe69f090af0 @@ -19,8 +19,17 @@ return ret end +-- Wrapper around execute to let user confirm in the case where a subprocess +-- returns immediately +-- This is needed to work around some brokenness with some merge tools +-- (e.g. on OS X) +function execute_confirm(path, ...) + execute(path, unpack(arg)) + print("Press enter when the subprocess has completed") + io.read() + return ret +end - -- attributes are persistent metadata about files (such as execute -- bit, ACLs, various special flags) which we want to have set and -- re-set any time the files are modified. the attributes themselves @@ -292,8 +301,8 @@ -- the merge to proceed since they can appear in the files (and I saw -- that). --pasky if execute(merge, lfile, afile, rfile) == 0 then - copy_text_file(lfile, outfile); - return 0 + copy_text_file(lfile, outfile); + return 0 end return execute(vim, "-f", "-c", string.format("file %s", outfile), lfile) @@ -369,6 +378,22 @@ end end +function merge2_opendiff_cmd(left_path, right_path, merged_path, lfile, rfile, outfile) + return + function() + -- As opendiff immediately returns, let user confirm manually + return execute_confirm("opendiff",lfile,rfile,"-merge",outfile) + end +end + +function merge3_opendiff_cmd(left_path, anc_path, right_path, merged_path, lfile, afile, rfile, outfile) + return + function() + -- As opendiff immediately returns, let user confirm manually + execute_confirm("opendiff",lfile,rfile,"-ancestor",afile,"-merge",outfile) + end +end + function write_to_temporary_file(data) tmp, filename = temp_file() if (tmp == nil) then @@ -426,6 +451,8 @@ cmd = merge2_kdiff3_cmd (left_path, right_path, merged_path, lfile, rfile, outfile) elseif program_exists_in_path ("xxdiff") then cmd = merge2_xxdiff_cmd (left_path, right_path, merged_path, lfile, rfile, outfile) + elseif program_exists_in_path ("opendiff") then + cmd = merge2_opendiff_cmd (left_path, right_path, merged_path, lfile, rfile, outfile) elseif program_exists_in_path ("TortoiseMerge") then cmd = merge2_tortoise_cmd(lfile, rfile, outfile) elseif string.find(editor, "emacs") ~= nil or string.find(editor, "gnu") ~= nil then @@ -530,6 +557,8 @@ cmd = merge3_kdiff3_cmd (left_path, anc_path, right_path, merged_path, lfile, afile, rfile, outfile) elseif program_exists_in_path ("xxdiff") then cmd = merge3_xxdiff_cmd (left_path, anc_path, right_path, merged_path, lfile, afile, rfile, outfile) + elseif program_exists_in_path ("opendiff") then + cmd = merge3_opendiff_cmd (left_path, anc_path, right_path, merged_path, lfile, afile, rfile, outfile) elseif program_exists_in_path ("TortoiseMerge") then cmd = merge3_tortoise_cmd(lfile, afile, rfile, outfile) elseif string.find(editor, "emacs") ~= nil or string.find(editor, "gnu") ~= nil then