439
439
# not present in one of those inventories is unnecessary but not
440
440
# harmful because we are filtering by the revision id marker in the
441
441
# inventory lines : we only select file ids altered in one of those
442
unescape_revid_cache = {}
443
unescape_fileid_cache = {}
445
442
# revisions. We don't need to see all lines in the inventory because
446
443
# only those added in an inventory in rev X can contain a revision=X
445
unescape_revid_cache = {}
446
unescape_fileid_cache = {}
448
# Move several functions to be local variables, since this is a long
450
search = self._file_ids_altered_regex.search
451
unescape = _unescape_xml_cached
452
setdefault = result.setdefault
448
453
pb = ui.ui_factory.nested_progress_bar()
450
455
for line in w.iter_lines_added_or_present_in_versions(
451
selected_revision_ids, pb=pb):
452
match = self._file_ids_altered_regex.search(line)
456
selected_revision_ids, pb=pb):
453
458
if match is None:
455
460
file_id, revision_id = match.group('file_id', 'revision_id')
456
revision_id = _unescape_xml_cached(revision_id,
457
unescape_revid_cache)
461
revision_id = unescape(revision_id, unescape_revid_cache)
458
462
if revision_id in selected_revision_ids:
459
file_id = _unescape_xml_cached(file_id,
460
unescape_fileid_cache)
461
result.setdefault(file_id, set()).add(revision_id)
463
file_id = unescape(file_id, unescape_fileid_cache)
464
setdefault(file_id, set()).add(revision_id)