/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
351
351
        """
352
352
        raise NotImplementedError(self.external_url)
353
353
 
354
 
    def should_cache(self):
355
 
        """Return True if the data pulled across should be cached locally.
356
 
        """
357
 
        return False
358
 
 
359
354
    def _pump(self, from_file, to_file):
360
355
        """Most children will need to copy from one file-like 
361
356
        object or string to another one.
693
688
            yield self.get(relpath)
694
689
            count += 1
695
690
 
696
 
    @deprecated_method(zero_eleven)
697
 
    def put(self, relpath, f, mode=None):
698
 
        """Copy the file-like object into the location.
699
 
 
700
 
        :param relpath: Location to put the contents, relative to base.
701
 
        :param f:       File-like object.
702
 
        :param mode: The mode for the newly created file, 
703
 
                     None means just use the default
704
 
        """
705
 
        if isinstance(f, str):
706
 
            return self.put_bytes(relpath, f, mode=mode)
707
 
        else:
708
 
            return self.put_file(relpath, f, mode=mode)
709
 
 
710
691
    def put_bytes(self, relpath, bytes, mode=None):
711
692
        """Atomically put the supplied bytes into the given location.
712
693
 
794
775
                self.mkdir(parent_dir, mode=dir_mode)
795
776
                return self.put_file(relpath, f, mode=mode)
796
777
 
797
 
    @deprecated_method(zero_eleven)
798
 
    def put_multi(self, files, mode=None, pb=None):
799
 
        """Put a set of files into the location.
800
 
 
801
 
        :param files: A list of tuples of relpath, file object [(path1, file1), (path2, file2),...]
802
 
        :param pb:  An optional ProgressBar for indicating percent done.
803
 
        :param mode: The mode for the newly created files
804
 
        :return: The number of files copied.
805
 
        """
806
 
        def _put(path, f):
807
 
            if isinstance(f, str):
808
 
                self.put_bytes(path, f, mode=mode)
809
 
            else:
810
 
                self.put_file(path, f, mode=mode)
811
 
        return len(self._iterate_over(files, _put, pb, 'put', expand=True))
812
 
 
813
778
    def mkdir(self, relpath, mode=None):
814
779
        """Create a directory at the given path."""
815
780
        raise NotImplementedError(self.mkdir)
820
785
            self.mkdir(path, mode=mode)
821
786
        return len(self._iterate_over(relpaths, mkdir, pb, 'mkdir', expand=False))
822
787
 
823
 
    @deprecated_method(zero_eleven)
824
 
    def append(self, relpath, f, mode=None):
825
 
        """Append the text in the file-like object to the supplied location.
826
 
 
827
 
        returns the length of relpath before the content was written to it.
828
 
        
829
 
        If the file does not exist, it is created with the supplied mode.
830
 
        """
831
 
        return self.append_file(relpath, f, mode=mode)
832
 
 
833
788
    def append_file(self, relpath, f, mode=None):
834
789
        """Append bytes from a file-like object to a file at relpath.
835
790