# # patch "ChangeLog" # from [cc41b9fb9a5fe98fb1b9337fe913a75d760a89d8] # to [15a4c07e2c8deb7fbd722aa5df4cf9be5a8121b9] # # patch "std_hooks.lua" # from [b6bde98342f50a4bd4f89e236849bdea43399397] # to [0408707bb6b97eae7f8da61af7b35364dbd5a189] # ======================================================================== --- ChangeLog cc41b9fb9a5fe98fb1b9337fe913a75d760a89d8 +++ ChangeLog 15a4c07e2c8deb7fbd722aa5df4cf9be5a8121b9 @@ -1,5 +1,12 @@ 2005-08-26 Nathaniel Smith + * std_hooks.lua: Check for both "vi" and "notepad.exe" as fallback + editors. If no editor was found, print a helpful message instead + of just running "vi" anyway. Print a message if the editor exited + with error. + +2005-08-26 Nathaniel Smith + * file_io.cc (mkdir_p, make_dir_for): Increase error checking. * commands.cc (checkout): Make sure that checkout target directory does not already exist. Also use system_path more uniformly. ======================================================================== --- std_hooks.lua b6bde98342f50a4bd4f89e236849bdea43399397 +++ std_hooks.lua 0408707bb6b97eae7f8da61af7b35364dbd5a189 @@ -138,12 +138,20 @@ end function edit_comment(basetext, user_log_message) - local exe = "vi" + local exe = nil + if (program_exists_in_path("vi")) then exe = "vi" end + if (program_exists_in_path("notepad.exe")) then exe = "notepad.exe" end local visual = os.getenv("VISUAL") if (visual ~= nil) then exe = visual end local editor = os.getenv("EDITOR") if (editor ~= nil) then exe = editor end + if (exe == nil) then + io.write("Could not find editor to enter commit message\n" + .. "Try setting the environment variable EDITOR\n") + return nil + end + local tmp, tname = temp_file() if (tmp == nil) then return nil end basetext = "MT: " .. string.gsub(basetext, "\n", "\nMT: ") .. "\n" @@ -152,6 +160,8 @@ io.close(tmp) if (execute(exe, tname) ~= 0) then + io.write(string.format("Error running editor '%s' to enter log message\n", + exe)) os.remove(tname) return nil end