~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/v4.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-28 20:21:47 UTC
  • mto: This revision was merged to the branch mainline in revision 4588.
  • Revision ID: john@arbash-meinel.com-20090728202147-g2oqb05uvkt85jh8
remove the counters, etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
506
506
    target = property(_get_target)
507
507
 
508
508
 
509
 
_counters = {}
510
 
def update_counter(name, adjust):
511
 
    _counters[name] = _counters.get(name, 0) + 1
512
 
 
513
 
 
514
509
class RevisionInstaller(object):
515
510
    """Installs revisions into a repository"""
516
511
 
612
607
        cached_parent_texts = {}
613
608
        remaining_parent_ids = []
614
609
        for parent_id in parent_ids:
615
 
            update_counter('parents', 1)
616
610
            p_text = inventory_text_cache.get(parent_id, None)
617
611
            if p_text is None:
618
 
                update_counter('missing parent text', 1)
619
612
                remaining_parent_ids.append(parent_id)
620
613
            else:
621
 
                update_counter('cached parent text', 1)
622
614
                cached_parent_texts[parent_id] = p_text
623
615
        ghosts = ()
624
616
        # TODO: Use inventory_cache to grab inventories we already have in
688
680
                inventory_text_cache[revision_id] = inv_text
689
681
                target_inv = self._source_serializer.read_inventory_from_string(
690
682
                    inv_text)
691
 
                # TODO: we might try caching the parent inventories themselves,
692
 
                #       and then using inv._make_delta and
693
 
                #       add_inventory_by_delta instead of always using
694
 
                #       add_inventory
695
683
                self._handle_root(target_inv, parent_ids)
696
684
                parent_inv = None
697
685
                if parent_ids:
698
686
                    parent_inv = inventory_cache.get(parent_ids[0], None)
699
687
                try:
700
688
                    if parent_inv is None:
701
 
                        update_counter('missing parent inv', 1)
702
689
                        self._repository.add_inventory(revision_id, target_inv,
703
690
                                                       parent_ids)
704
691
                    else:
705
 
                        update_counter('cached parent inv', 1)
706
692
                        delta = target_inv._make_delta(parent_inv)
707
693
                        self._repository.add_inventory_by_delta(parent_ids[0],
708
694
                            delta, revision_id, parent_ids)
711
697
                inventory_cache[revision_id] = target_inv
712
698
        finally:
713
699
            pb.finished()
714
 
            import pprint
715
 
            pprint.pprint(_counters)
716
700
 
717
701
    def _handle_root(self, target_inv, parent_ids):
718
702
        revision_id = target_inv.revision_id