[PATCH] Fix auto merge
- From: Piotr Piastucki <leech miranda gmail com>
- To: meld-list <meld-list gnome org>
- Subject: [PATCH] Fix auto merge
- Date: Mon, 28 Feb 2011 08:07:44 +0100
Hi,
It looks like auto-merge mode has been broken since commit 0463dbe092c19ce8b6e54f56a726cc698b5a466d, because of an empty text buffer used for file comparison in _merge_files method.
I have also spotted another bug in merge module where an undefined variable is used.
The attached patch fixes both issues and slightly simplifies the code in filemerge module.
Regards,
Piotr
From 61f0b8eb968659de9ff42041f8426f3bca4e0697 Mon Sep 17 00:00:00 2001
From: Piotr Piastucki <the_leech users berlios de>
Date: Sun, 27 Feb 2011 23:01:27 +0100
Subject: [PATCH 3/3] Fix auto-merge
This commit fixes auto-merge mode by using correct set of text buffers in file comparison.
It also fixes a bug in merge module where an udefined variable was used.
---
meld/filemerge.py | 8 ++++----
meld/merge.py | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/meld/filemerge.py b/meld/filemerge.py
index 48f56bf..aaf7113 100644
--- a/meld/filemerge.py
+++ b/meld/filemerge.py
@@ -61,14 +61,14 @@ class FileMerge(filediff.FileDiff):
if buf == self.hidden_textbuffer:
buf = self.textbuffer[1]
yesno = True
- pane = self.textbuffer.index(buf)
- self.bufferdata[pane].writable = yesno
- self.recompute_label()
+ filediff.FileDiff.set_buffer_writable(self, buf, yesno)
def _merge_files(self):
yield _("[%s] Computing differences") % self.label_text
panetext = []
- for b in self.textbuffer[:self.num_panes]:
+ textbuffer = self.textbuffer[:]
+ textbuffer[1] = self.hidden_textbuffer
+ for b in textbuffer[:self.num_panes]:
start, end = b.get_bounds()
text = unicode(b.get_text(start, end, False), 'utf8')
panetext.append(text)
diff --git a/meld/merge.py b/meld/merge.py
index b1596c3..9e47f10 100644
--- a/meld/merge.py
+++ b/meld/merge.py
@@ -125,10 +125,10 @@ class AutoMergeDiffer(diffutil.Differ):
if seq0:
out0 = ('conflict', i0, seq0[2], seq0[3], seq0[4])
- out1 = ('conflict', i1, i1 + seq0[2] - i0, end1, end1 + seq0[2] - i0)
+ out1 = ('conflict', i0, seq0[2], end1, end1 + seq0[2] - i0)
yield out0, out1
elif seq1:
- out0 = ('conflict', i0, i0 + seq1[2] - i1, end0, end0 + seq2[2] - i1)
+ out0 = ('conflict', i1, seq1[2], end0, end0 + seq1[2] - i1)
out1 = ('conflict', i1, seq1[2], seq1[3], seq1[4])
yield out0, out1
return
--
1.7.1
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]