# # # patch "ChangeLog" # from [98ba41051c8110e18f297faec7327b5b028bc204] # to [b2f1cb9e631fe070f38cb30826c1fd55b27ae099] # # patch "std_hooks.lua" # from [bd7e1c41b16b89860407930bc4a53f109fd6f8f4] # to [eb8ff0f111c7d7ac911e2f3840ede5575acb2cf7] # ============================================================ --- ChangeLog 98ba41051c8110e18f297faec7327b5b028bc204 +++ ChangeLog b2f1cb9e631fe070f38cb30826c1fd55b27ae099 @@ -1,5 +1,14 @@ 2006-05-29 Richard Levitte + * std_hooks.lua (merge3_*_cmd): Make all the merge3 merge helpers + check the returned exit code of the merge program and generate an + error message if it fails. + (execute_confirm): Don't output an error message, that's the + caller's responsability. + (merge3): Follow the way the check of exit code is done elsewhere. + +2006-05-29 Richard Levitte + * std_hooks.lua (merge3): Check the exit code from the merging program to detect failure. We could do that by strictly checking if the output file exists, but since some programs, like meld, ============================================================ --- std_hooks.lua bd7e1c41b16b89860407930bc4a53f109fd6f8f4 +++ std_hooks.lua eb8ff0f111c7d7ac911e2f3840ede5575acb2cf7 @@ -28,7 +28,6 @@ if (ret ~= 0) then - io.write(string.format(gettext("Error running '%s'\n"), path)) print(gettext("Press enter")) else print(gettext("Press enter when the subprocess has completed")) @@ -289,26 +288,40 @@ function merge3_meld_cmd(lfile, afile, rfile) return function() - return execute("meld", lfile, afile, rfile) + local path = "meld" + local ret = execute(path, lfile, afile, rfile) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), path)) + end + return ret end end function merge3_tortoise_cmd(lfile, afile, rfile, outfile) return function() - return execute("tortoisemerge", - string.format("/base:%s", afile), - string.format("/theirs:%s", lfile), - string.format("/mine:%s", rfile), - string.format("/merged:%s", outfile)) + local path = "tortoisemerge" + local ret = execute(path, + string.format("/base:%s", afile), + string.format("/theirs:%s", lfile), + string.format("/mine:%s", rfile), + string.format("/merged:%s", outfile)) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), path)) + end + return ret end end function merge3_vim_cmd(vim, afile, lfile, rfile, outfile) return function() - return execute(vim, "-f", "-d", "-c", string.format("file %s", outfile), - afile, lfile, rfile) + local ret = execute(vim, "-f", "-d", "-c", string.format("file %s", outfile), + afile, lfile, rfile) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), vim)) + end + return ret end end @@ -323,8 +336,12 @@ copy_text_file(lfile, outfile); return 0 end - return execute(vim, "-f", "-c", string.format("file %s", outfile), - lfile) + local ret = execute(vim, "-f", "-c", string.format("file %s", outfile), + lfile) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), vim)) + end + return ret end end @@ -332,8 +349,12 @@ local elisp = "(ediff-merge-files-with-ancestor \"%s\" \"%s\" \"%s\" nil \"%s\")" return function() - return execute(emacs, "--eval", - string.format(elisp, lfile, rfile, afile, outfile)) + local ret = execute(emacs, "--eval", + string.format(elisp, lfile, rfile, afile, outfile)) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), emacs)) + end + return ret end end @@ -341,14 +362,19 @@ lfile, afile, rfile, outfile) return function() - return execute("xxdiff", - "--title1", left_path, - "--title2", right_path, - "--title3", merged_path, - lfile, afile, rfile, - "--merge", - "--merged-filename", outfile, - "--exit-with-merge-status") + local path = "xxdiff" + local ret execute(path, + "--title1", left_path, + "--title2", right_path, + "--title3", merged_path, + lfile, afile, rfile, + "--merge", + "--merged-filename", outfile, + "--exit-with-merge-status") + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), path)) + end + return ret end end @@ -356,21 +382,34 @@ lfile, afile, rfile, outfile) return function() - return execute("kdiff3", - "--L1", anc_path, - "--L2", left_path, - "--L3", right_path, - afile, lfile, rfile, - "--merge", - "--o", outfile) + local path = "kdiff3" + local ret = execute(path, + "--L1", anc_path, + "--L2", left_path, + "--L3", right_path, + afile, lfile, rfile, + "--merge", + "--o", outfile) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), path)) + end + return ret end end function merge3_opendiff_cmd(left_path, anc_path, right_path, merged_path, lfile, afile, rfile, outfile) return function() + local path = "opendiff" -- As opendiff immediately returns, let user confirm manually - execute_confirm("opendiff",lfile,rfile,"-ancestor",afile,"-merge",outfile) + local ret = execute_confirm(path, + lfile,rfile, + "-ancestor",afile, + "-merge",outfile) + if (ret ~= 0) then + io.write(string.format(gettext("Error running merger '%s'\n"), path)) + end + return ret end end @@ -496,10 +535,11 @@ if cmd ~=nil then io.write (string.format(gettext("executing external 3-way merge command\n"))) - ret = nil -- cmd() return 0 on success. - if cmd () == 0 + if cmd () ~= 0 then + ret = nil + else if tbl.meld_exists then ret = read_contents_of_file (tbl.afile, "r")