bug 1361037, don't cache en-US reference, r=flod
Most of the time, we just run one locale at a time. Then caching
en-US doesn't help at all. Testing shows that even if we run
multiple locales, this doesn't win us much.
Subtle, but this is a shift from running compare-locales for
one project against a lot of locales, towards run all projects
against a single locale.
Which will happen later in this patch queue.
MozReview-Commit-ID: H61bItYOVQS
--- a/compare_locales/compare.py
+++ b/compare_locales/compare.py
@@ -363,17 +363,16 @@ class ContentComparer:
nl = re.compile('\n', re.M)
def __init__(self):
'''Create a ContentComparer.
observer is usually a instance of Observer. The return values
of the notify method are used to control the handling of missing
entities.
'''
- self.reference = dict()
self.observer = Observer()
self.other_observers = []
self.merge_stage = None
def add_observer(self, obs):
'''Add a non-filtering observer.
Results from the notify calls are ignored.
'''
@@ -439,25 +438,22 @@ class ContentComparer:
pass
def compare(self, ref_file, l10n):
try:
p = parser.getParser(ref_file.file)
except UserWarning:
# no comparison, XXX report?
return
- if ref_file not in self.reference:
- # we didn't parse this before
- try:
- p.readContents(ref_file.getContents())
- except Exception, e:
- self.notify('error', ref_file, str(e))
- return
- self.reference[ref_file] = p.parse()
- ref = self.reference[ref_file]
+ try:
+ p.readContents(ref_file.getContents())
+ except Exception, e:
+ self.notify('error', ref_file, str(e))
+ return
+ ref = p.parse()
ref_list = ref[1].keys()
ref_list.sort()
try:
p.readContents(l10n.getContents())
l10n_entities, l10n_map = p.parse()
l10n_ctx = p.ctx
except Exception, e:
self.notify('error', l10n, str(e))