[meld] Correctly start merge mode with output file for non-auto merges
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Correctly start merge mode with output file for non-auto merges
- Date: Thu, 14 Mar 2013 20:56:05 +0000 (UTC)
commit c300c6e6e1cf08fd674a78ced90d196ba95f398b
Author: Kai Willadsen <kai willadsen gmail com>
Date: Wed Mar 13 06:35:58 2013 +1000
Correctly start merge mode with output file for non-auto merges
meld/filediff.py | 11 ++++++++---
meld/meldwindow.py | 6 ++++--
2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 61541b9..b12d04f 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -936,8 +936,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
def set_merge_output_file(self, filename):
if len(self.textbuffer) < 2:
return
- self.textbuffer[1].data.savefile = os.path.abspath(filename)
- self.textbuffer[1].data.set_label(filename)
+ buf = self.textbuffer[1]
+ buf.data.savefile = os.path.abspath(filename)
+ buf.data.set_label(filename)
+ self.set_buffer_writable(buf, os.access(buf.data.savefile, os.W_OK))
self.fileentry[1].set_filename(os.path.abspath(filename))
self.recompute_label()
@@ -1061,7 +1063,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
nextbit = nextbit[0:-1]
t.buf.insert(t.buf.get_end_iter(), nextbit)
else:
- writable = os.access(t.filename, os.W_OK)
+ if t.buf.data.savefile:
+ writable = os.access(t.buf.data.savefile, os.W_OK)
+ else:
+ writable = os.access(t.filename, os.W_OK)
self.set_buffer_writable(t.buf, writable)
t.buf.data.encoding = t.codec[0]
if hasattr(t.file, "newlines"):
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 5f356f6..f6bf479 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -622,11 +622,13 @@ class MeldWindow(gnomeglade.Component):
doc.on_button_diff_clicked(None)
return doc
- def append_filediff(self, files):
+ def append_filediff(self, files, merge_output=None):
assert len(files) in (1, 2, 3)
doc = filediff.FileDiff(app.prefs, len(files))
self._append_page(doc, "text-x-generic")
doc.set_files(files)
+ if merge_output is not None:
+ doc.set_merge_output_file(merge_output)
return doc
def append_filemerge(self, files, merge_output=None):
@@ -666,7 +668,7 @@ class MeldWindow(gnomeglade.Component):
elif auto_merge:
return self.append_filemerge(paths, merge_output=merge_output)
else:
- return self.append_filediff(paths)
+ return self.append_filediff(paths, merge_output=merge_output)
def append_vcview(self, location, auto_compare=False):
doc = vcview.VcView(app.prefs)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]