# # # patch "ChangeLog" # from [0eee131ff7f8d9bde34045d15191c8f5cbee6443] # to [8e9bd73b17a124e9ca73a3ec8c65f75cd15e5d4e] # # patch "diff_patch.cc" # from [ffa8406fe33c46599e4dba7bcda4f1040a1090f6] # to [130f530b183998cd8f860b5e6471a42fa3d52f2e] # # patch "lua.cc" # from [a83954e49ad8c287a39fa67408404ecac0ac7547] # to [46be8289e2ca1d6213289fba84c22e1f82dac091] # # patch "lua.hh" # from [532576dfba2360ab279d69e936455e5ee9f32427] # to [92d0d719602e0529c4ff56d4d1744f34e81c24ac] # # patch "std_hooks.lua" # from [f9dbc7677955dc51c63b98691eff0a297967b37d] # to [efa95818a151a349c981859891931c2ef6533e11] # ============================================================ --- ChangeLog 0eee131ff7f8d9bde34045d15191c8f5cbee6443 +++ ChangeLog 8e9bd73b17a124e9ca73a3ec8c65f75cd15e5d4e @@ -1,5 +1,13 @@ 2006-01-10 Nathaniel Smith + * std_hooks.lua: + * lua.cc (hook_merge2): + * diff_patch.cc (try_to_merge_files): Remove merge2 code, since we + no longer do merge2's. (We can always revive it if we add suture + support.) + +2006-01-10 Nathaniel Smith + * packet.cc (consume_file_delta): Remove unused 4-argument form. 2006-01-10 Nathaniel Smith ============================================================ --- diff_patch.cc ffa8406fe33c46599e4dba7bcda4f1040a1090f6 +++ diff_patch.cc 130f530b183998cd8f860b5e6471a42fa3d52f2e @@ -501,9 +501,9 @@ static void load_and_cache_roster(revision_id const & rid, - map > & rmap, - shared_ptr & rout, - app_state & app) + map > & rmap, + shared_ptr & rout, + app_state & app) { map >::const_iterator i = rmap.find(rid); if (i != rmap.end()) @@ -742,65 +742,6 @@ return false; } -bool -content_merger::try_to_merge_files(file_path const & left_path, - file_path const & right_path, - file_path const & merged_path, - file_id const & left_id, - file_id const & right_id, - file_id & merged_id) -{ - I(!null_id(left_id)); - I(!null_id(right_id)); - - file_data left_data, right_data; - data left_unpacked, right_unpacked, merged_unpacked; - - L(F("trying to merge %s <-> %s\n") - % left_id % right_id); - - if (left_id == right_id) - { - L(F("files are identical\n")); - merged_id = left_id; - return true; - } - - adaptor.get_version(left_path, left_id, left_data); - adaptor.get_version(right_path, right_id, right_data); - - left_unpacked = left_data.inner(); - right_unpacked = right_data.inner(); - - P(F("help required for 2-way merge\n" - "[ left] %s\n" - "[ right] %s\n" - "[ merged] %s\n") - % left_path - % right_path - % merged_path); - - if (app.lua.hook_merge2(left_path, right_path, merged_path, - left_unpacked, right_unpacked, merged_unpacked)) - { - hexenc tmp_id; - file_data merge_data; - - L(F("lua merge2 hook merged ok\n")); - calculate_ident(merged_unpacked, tmp_id); - file_id merged_fid(tmp_id); - merge_data = file_data(merged_unpacked); - - merged_id = merged_fid; - adaptor.record_merge(left_id, right_id, merged_fid, - left_data, merge_data); - return true; - } - - return false; -} - - // the remaining part of this file just handles printing out various // diff formats for the case where someone wants to *read* a diff // rather than apply it. ============================================================ --- lua.cc a83954e49ad8c287a39fa67408404ecac0ac7547 +++ lua.cc 46be8289e2ca1d6213289fba84c22e1f82dac091 @@ -1172,29 +1172,6 @@ bool -lua_hooks::hook_merge2(file_path const & left_path, - file_path const & right_path, - file_path const & merged_path, - data const & left, - data const & right, - data & result) -{ - string res; - bool ok = Lua(st) - .func("merge2") - .push_str(left_path.as_external()) - .push_str(right_path.as_external()) - .push_str(merged_path.as_external()) - .push_str(left()) - .push_str(right()) - .call(5,1) - .extract_str(res) - .ok(); - result = res; - return ok; -} - -bool lua_hooks::hook_merge3(file_path const & anc_path, file_path const & left_path, file_path const & right_path, ============================================================ --- lua.hh 532576dfba2360ab279d69e936455e5ee9f32427 +++ lua.hh 92d0d719602e0529c4ff56d4d1744f34e81c24ac @@ -73,12 +73,6 @@ // local repo hooks bool hook_ignore_file(file_path const & p); bool hook_ignore_branch(std::string const & branch); - bool hook_merge2(file_path const & left_path, - file_path const & right_path, - file_path const & merged_path, - data const & left, - data const & right, - data & result); bool hook_merge3(file_path const & anc_path, file_path const & left_path, file_path const & right_path, ============================================================ --- std_hooks.lua f9dbc7677955dc51c63b98691eff0a297967b37d +++ std_hooks.lua efa95818a151a349c981859891931c2ef6533e11 @@ -290,13 +290,6 @@ -- merger support -function merge2_meld_cmd(lfile, rfile) - return - function() - return execute("meld", lfile, rfile) - end -end - function merge3_meld_cmd(lfile, afile, rfile) return function() @@ -304,16 +297,6 @@ end end -function merge2_tortoise_cmd(lfile, rfile, outfile) - return - function() - return execute("tortoisemerge", - string.format("/theirs:%s", lfile), - string.format("/mine:%s", rfile), - string.format("/merged:%s", outfile)) - end -end - function merge3_tortoise_cmd(lfile, afile, rfile, outfile) return function() @@ -325,14 +308,6 @@ end end -function merge2_vim_cmd(vim, lfile, rfile, outfile) - return - function() - return execute(vim, "-f", "-d", "-c", string.format("file %s", outfile), - lfile, rfile) - end -end - function merge3_vim_cmd(vim, afile, lfile, rfile, outfile) return function() @@ -357,15 +332,6 @@ end end -function merge2_emacs_cmd(emacs, lfile, rfile, outfile) - local elisp = "(ediff-merge-files \"%s\" \"%s\" nil \"%s\")" - return - function() - return execute(emacs, "--eval", - string.format(elisp, lfile, rfile, outfile)) - end -end - function merge3_emacs_cmd(emacs, lfile, afile, rfile, outfile) local elisp = "(ediff-merge-files-with-ancestor \"%s\" \"%s\" \"%s\" nil \"%s\")" return @@ -375,17 +341,6 @@ end end -function merge2_xxdiff_cmd(left_path, right_path, merged_path, lfile, rfile, outfile) - return - function() - return execute("xxdiff", - "--title1", left_path, - "--title2", right_path, - lfile, rfile, - "--merged-filename", outfile) - end -end - function merge3_xxdiff_cmd(left_path, anc_path, right_path, merged_path, lfile, afile, rfile, outfile) return @@ -400,17 +355,6 @@ 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 @@ -425,14 +369,6 @@ 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() @@ -481,102 +417,6 @@ return existsonpath(program) == 0 end -function get_preferred_merge2_command (tbl) - local cmd = nil - local left_path = tbl.left_path - local right_path = tbl.right_path - local merged_path = tbl.merged_path - local lfile = tbl.lfile - local rfile = tbl.rfile - local outfile = tbl.outfile - - local editor = os.getenv("EDITOR") - if editor ~= nil then editor = string.lower(editor) else editor = "" end - - - 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 ("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 - if string.find(editor, "xemacs") and program_exists_in_path("xemacs") then - cmd = merge2_emacs_cmd ("xemacs", lfile, rfile, outfile) - elseif program_exists_in_path("emacs") then - cmd = merge2_emacs_cmd ("emacs", lfile, rfile, outfile) - end - elseif string.find(editor, "vim") ~= nil then - io.write (string.format("\nWARNING: 'vim' was choosen to perform external 2-way merge.\n".. - "You should merge all changes to *LEFT* file due to limitation of program\n".. - "arguments.\n\n")) - if os.getenv ("DISPLAY") ~= nil and program_exists_in_path ("gvim") then - cmd = merge2_vim_cmd ("gvim", lfile, rfile, outfile) - elseif program_exists_in_path ("vim") then - cmd = merge2_vim_cmd ("vim", lfile, rfile, outfile) - end - elseif program_exists_in_path ("meld") then - tbl.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".. - "arguments.\n\n")) - cmd = merge2_meld_cmd (lfile, rfile) - end - return cmd -end - -function merge2 (left_path, right_path, merged_path, left, right) - local ret = nil - local tbl = {} - - tbl.lfile = nil - tbl.rfile = nil - tbl.outfile = nil - tbl.meld_exists = false - - tbl.lfile = write_to_temporary_file (left) - tbl.rfile = write_to_temporary_file (right) - tbl.outfile = write_to_temporary_file ("") - - if tbl.lfile ~= nil and tbl.rfile ~= nil and tbl.outfile ~= nil - then - tbl.left_path = left_path - tbl.right_path = right_path - tbl.merged_path = merged_path - - local cmd = get_preferred_merge2_command (tbl) - - if cmd ~=nil - then - io.write (string.format(gettext("executing external 2-way merge command\n"))) - cmd () - if tbl.meld_exists - then - ret = read_contents_of_file (tbl.lfile, "r") - else - ret = read_contents_of_file (tbl.outfile, "r") - end - if string.len (ret) == 0 - then - ret = nil - end - else - io.write (string.format("No external 2-way merge command found.\n".. - "You may want to check that $EDITOR is set to an editor that supports 2-way merge,\n".. - "set this explicitly in your get_preferred_merge2_command hook,\n".. - "or add a 2-way merge program to your path.\n\n")) - end - end - - os.remove (tbl.lfile) - os.remove (tbl.rfile) - os.remove (tbl.outfile) - - return ret -end - function get_preferred_merge3_command (tbl) local cmd = nil local left_path = tbl.left_path