[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Support meld merge tool
From: |
Wojciech Miłkowski |
Subject: |
[Monotone-devel] Support meld merge tool |
Date: |
Mon, 17 Jan 2005 21:25:44 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041208) |
Hello,
I have just rewritten merge2() and merge3() lua hooks to support
interesting (and easy to use) merge tool called meld
(http://meld.sourceforge.net/).
If someone find it useful I attach '.monotonerc' that supports it.
There's one disadvantage because of limitation in program command line.
You can put 3 names of files to perform 3-way merge, but you cannot
qualify output one, so I decided arbitrary to choose left file in 2-way
merge and center (ancestry) file to in case of 3-way merge.
There's warning generated on console to notice that.
Have a fun
Wojtek
----------------------------------------------------------------------
Najlepsze auto, najlepsze moto... >>> http://link.interia.pl/f1841
-- merger support
function merge2_meld_cmd(lfile, rfile)
local cmd_fmt = "meld %s %s"
return string.format(cmd_fmt, lfile, rfile)
end
function merge3_meld_cmd(lfile, afile, rfile)
local cmd_fmt = "meld %s %s %s"
return string.format(cmd_fmt, lfile, afile, rfile)
end
function merge2(left_path, right_path, merged_path, left, right)
local lfile = nil
local rfile = nil
local outfile = nil
local data = nil
local meld_exists = false
lfile = write_to_temporary_file(left)
rfile = write_to_temporary_file(right)
outfile = write_to_temporary_file("")
if lfile ~= nil and
rfile ~= nil and
outfile ~= nil
then
local cmd = nil
if program_exists_in_path("meld") then
meld_exists = true
io.write(string.format("\nWARNING: 'meld' was choosen to perform
external 2-way merge.\nYou should merge all changes to *LEFT* file due to
limitation of program\narguments.\n\n"))
cmd = merge2_meld_cmd(lfile, rfile)
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("emacs") then
cmd = merge2_emacs_cmd("emacs", lfile, rfile, outfile)
elseif program_exists_in_path("xemacs") then
cmd = merge2_emacs_cmd("xemacs", lfile, rfile, outfile)
end
if cmd ~= nil
then
io.write(string.format("executing external 2-way merge command: %s\n",
cmd))
os.execute(cmd)
if meld_exists then
data = read_contents_of_file(lfile)
else
data = read_contents_of_file(outfile)
end
if string.len(data) == 0
then
data = nil
end
else
io.write("no external 2-way merge command found\n")
end
end
os.remove(lfile)
os.remove(rfile)
os.remove(outfile)
return data
end
function merge3(anc_path, left_path, right_path, merged_path, ancestor, left,
right)
local afile = nil
local lfile = nil
local rfile = nil
local outfile = nil
local data = nil
local meld_exists = false
lfile = write_to_temporary_file(left)
afile = write_to_temporary_file(ancestor)
rfile = write_to_temporary_file(right)
outfile = write_to_temporary_file("")
if lfile ~= nil and
rfile ~= nil and
afile ~= nil and
outfile ~= nil
then
local cmd = nil
if program_exists_in_path("meld") then
meld_exists = true
io.write(string.format("\nWARNING: 'meld' was choosen to perform
external 3-way merge.\nYou should merge all changes to *CENTER* file due to
limitation of program\narguments.\n\n"))
cmd = merge3_meld_cmd(lfile, afile, rfile)
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("emacs") then
cmd = merge3_emacs_cmd("emacs", lfile, afile, rfile, outfile)
elseif program_exists_in_path("xemacs") then
cmd = merge3_emacs_cmd("xemacs", lfile, afile, rfile, outfile)
end
if cmd ~= nil
then
io.write(string.format("executing external 3-way merge command: %s\n",
cmd))
os.execute(cmd)
if meld_exists then
data = read_contents_of_file(afile)
else
data = read_contents_of_file(outfile)
end
if string.len(data) == 0
then
data = nil
end
else
io.write("no external 3-way merge command found\n")
end
end
os.remove(lfile)
os.remove(rfile)
os.remove(afile)
os.remove(outfile)
return data
end
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-devel] Support meld merge tool,
Wojciech Miłkowski <=