/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

  • Committer: Andrew Bennetts
  • Date: 2008-11-27 06:29:56 UTC
  • mfrom: (3861 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3863.
  • Revision ID: andrew.bennetts@canonical.com-20081127062956-v0a19icwk85iosx4
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1035
1035
        implement it.
1036
1036
        """
1037
1037
        source = self.clone(from_relpath)
1038
 
        self.mkdir(to_relpath)
1039
1038
        target = self.clone(to_relpath)
 
1039
        target.mkdir('.')
 
1040
        source.copy_tree_to_transport(target)
 
1041
 
 
1042
    def copy_tree_to_transport(self, to_transport):
 
1043
        """Copy a subtree from one transport to another.
 
1044
 
 
1045
        self.base is used as the source tree root, and to_transport.base
 
1046
        is used as the target.  to_transport.base must exist (and be a
 
1047
        directory).
 
1048
        """
1040
1049
        files = []
1041
1050
        directories = ['.']
1042
1051
        while directories:
1043
1052
            dir = directories.pop()
1044
1053
            if dir != '.':
1045
 
                target.mkdir(dir)
1046
 
            for path in source.list_dir(dir):
 
1054
                to_transport.mkdir(dir)
 
1055
            for path in self.list_dir(dir):
1047
1056
                path = dir + '/' + path
1048
 
                stat = source.stat(path)
 
1057
                stat = self.stat(path)
1049
1058
                if S_ISDIR(stat.st_mode):
1050
1059
                    directories.append(path)
1051
1060
                else:
1052
1061
                    files.append(path)
1053
 
        source.copy_to(files, target)
 
1062
        self.copy_to(files, to_transport)
1054
1063
 
1055
1064
    def rename(self, rel_from, rel_to):
1056
1065
        """Rename a file or directory.