~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-17 21:57:11 UTC
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050917215711-9fa31e650a1f2fd8
Got HttpTransport tests to pass. Check for EAGAIN, pass permit_failure around, etc

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
 
195
195
    def __del__(self):
196
196
        if self._lock_mode or self._lock:
197
 
            from bzrlib.warnings import warn
198
 
            warn("branch %r was not explicitly unlocked" % self)
 
197
            from bzrlib.trace import warning
 
198
            warning("branch %r was not explicitly unlocked" % self)
199
199
            self._lock.unlock()
200
200
 
201
201
        # TODO: It might be best to do this somewhere else,
205
205
        # See the earlier discussion about how major objects (like Branch)
206
206
        # should never expect their __del__ function to run.
207
207
        if hasattr(self, 'cache_root') and self.cache_root is not None:
208
 
            #from warnings import warn
209
 
            #warn("branch %r auto-cleanup of cache files" % self)
210
208
            try:
211
209
                import shutil
212
210
                shutil.rmtree(self.cache_root)
754
752
 
755
753
    get_inventory_xml_file = get_inventory_xml
756
754
            
757
 
    def get_inventories(self, inventory_ids, pb=None, ignore_missing=False):
 
755
    def get_inventories(self, inventory_ids, pb=None, permit_failure=False):
758
756
        """Get Inventory objects by id
759
757
        """
760
 
        from bzrlib.inventory import Inventory
761
 
 
762
758
        # See the discussion in get_revisions for why
763
759
        # we don't use a try/finally block here
764
760
        self.lock_read()
765
 
        for f in self.inventory_store.get(inventory_ids, pb=pb, ignore_missing=ignore_missing):
 
761
        for f in self.inventory_store.get(inventory_ids,
 
762
                permit_failure=permit_failure, pb=pb):
766
763
            if f is not None:
767
764
                # TODO: Possibly put a try/except around this to handle
768
765
                # read serialization errors
769
766
                r = bzrlib.xml.serializer_v4.read_inventory(f)
770
767
                yield r
771
 
            elif ignore_missing:
 
768
            elif permit_failure:
772
769
                yield None
773
770
            else:
774
771
                raise bzrlib.errors.NoSuchRevision(self, revision_id)
953
950
                
954
951
        # This entire next section is generally done
955
952
        # with either generators, or bulk updates
956
 
        inventories = other.get_inventories(revision_ids, ignore_missing=True)
 
953
        inventories = other.get_inventories(revision_ids, permit_failure=True)
957
954
        needed_texts = set()
958
955
 
959
956
        failures = set()