[meld] Fix bug where cached comparison results were used for differing filters
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Fix bug where cached comparison results were used for differing filters
- Date: Sat, 5 Feb 2011 22:55:09 +0000 (UTC)
commit 2de2fe9ff0bd4904efadb2dd74c80edbe073383a
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jan 9 10:28:00 2011 +1000
Fix bug where cached comparison results were used for differing filters
meld/dirdiff.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 62a736d..4ac757e 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -84,6 +84,7 @@ def _files_same(files, regexes):
return Same
files = tuple(files)
+ regexes = tuple(regexes)
stats = tuple([StatItem._make(os.stat(f)) for f in files])
# If all entries are directories, they are considered to be the same
@@ -99,7 +100,7 @@ def _files_same(files, regexes):
return Different
# Check the cache before doing the expensive comparison
- cache = _cache.get(files)
+ cache = _cache.get((files, regexes))
if cache and cache.stats == stats:
return cache.result
@@ -115,7 +116,7 @@ def _files_same(files, regexes):
# Rough test to see whether files are binary. If files are guessed
# to be binary, we unset regexes for speed and space reasons.
if any(["\0" in d for d in data]):
- regexes = []
+ regexes = tuple()
while True:
if all_same(data):
@@ -151,7 +152,7 @@ def _files_same(files, regexes):
contents = [re.sub(r, "", c) for c in contents]
result = SameFiltered if all_same(contents) else Different
- _cache[files] = CacheResult(stats, result)
+ _cache[(files, regexes)] = CacheResult(stats, result)
return result
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]