~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

Merge transaction finalisation and ensure iter_lines_added_or_present in knits does a old-to-new read in the knit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
675
675
                # from running this test
676
676
                pass
677
677
        return result
 
678
 
 
679
 
 
680
class TransportLogger(object):
 
681
    """Adapt a transport to get clear logging data on api calls.
 
682
    
 
683
    Feel free to extend to log whatever calls are of interest.
 
684
    """
 
685
 
 
686
    def __init__(self, adapted):
 
687
        self._adapted = adapted
 
688
        self._calls = []
 
689
 
 
690
    def get(self, name):
 
691
        self._calls.append((name,))
 
692
        return self._adapted.get(name)
 
693
 
 
694
    def __getattr__(self, name):
 
695
        """Thunk all undefined access through to self._adapted."""
 
696
        # raise AttributeError, name 
 
697
        return getattr(self._adapted, name)
 
698
 
 
699
    def readv(self, name, offsets):
 
700
        self._calls.append((name, offsets))
 
701
        return self._adapted.readv(name, offsets)
678
702
        
679
703
 
680
704
# None is the default transport, for things with no url scheme