~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-15 07:34:16 UTC
  • mfrom: (3882.7.17 progress)
  • Revision ID: pqm@pqm.ubuntu.com-20090115073416-vnzvkab4dfesetj0
(mbp) transport-based progress bars

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    errors,
42
42
    osutils,
43
43
    symbol_versioning,
 
44
    ui,
44
45
    urlutils,
45
46
    )
46
47
""")
382
383
        except TypeError: # We can't tell how many, because relpaths is a generator
383
384
            return None
384
385
 
 
386
    def _report_activity(self, bytes, direction):
 
387
        """Notify that this transport has activity.
 
388
 
 
389
        Implementations should call this from all methods that actually do IO.
 
390
        Be careful that it's not called twice, if one method is implemented on
 
391
        top of another.
 
392
 
 
393
        :param bytes: Number of bytes read or written.
 
394
        :param direction: 'read' or 'write' or None.
 
395
        """
 
396
        ui.ui_factory.report_transport_activity(self, bytes, direction)
 
397
 
385
398
    def _update_pb(self, pb, msg, count, total):
386
399
        """Update the progress bar based on the current count
387
400
        and total available, total may be None if it was
568
581
 
569
582
        :param relpath: The relative path to the file
570
583
        """
571
 
        return self.get(relpath).read()
 
584
        f = self.get(relpath)
 
585
        try:
 
586
            return f.read()
 
587
        finally:
 
588
            f.close()
572
589
 
573
590
    @deprecated_method(one_four)
574
591
    def get_smart_client(self):