~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-12-18 18:42:17 UTC
  • mfrom: (2163.1.9 fileids_altered_merged)
  • Revision ID: pqm@pqm.ubuntu.com-20061218184217-352721d83a142886
(John Arbash Meinel) tweak KnitContent to return unannotated data when we don't need it, saving 300ms during parsing of inventory.knit

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 = {}
444
 
 
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
447
444
        # line.
 
445
        unescape_revid_cache = {}
 
446
        unescape_fileid_cache = {}
 
447
 
 
448
        # Move several functions to be local variables, since this is a long
 
449
        # running loop.
 
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()
449
454
        try:
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):
 
457
                match = search(line)
453
458
                if match is None:
454
459
                    continue
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)
462
465
        finally:
463
466
            pb.finished()
464
467
        return result