~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        """
139
139
        return bzrdir.BzrDir.create_standalone_workingtree(base).branch
140
140
 
 
141
    @deprecated_function(zero_eight)
141
142
    def setup_caching(self, cache_root):
142
143
        """Subclasses that care about caching should override this, and set
143
144
        up cached stores located under cache_root.
 
145
        
 
146
        NOTE: This is unused.
144
147
        """
145
 
        # seems to be unused, 2006-01-13 mbp
146
 
        warn('%s is deprecated' % self.setup_caching)
147
 
        self.cache_root = cache_root
 
148
        pass
148
149
 
149
150
    def get_config(self):
150
151
        return bzrlib.config.BranchConfig(self)
363
364
            return None
364
365
        if history is None:
365
366
            history = self.revision_history()
366
 
        elif revno <= 0 or revno > len(history):
 
367
        if revno <= 0 or revno > len(history):
367
368
            raise bzrlib.errors.NoSuchRevision(self, revno)
368
369
        return history[revno - 1]
369
370
 
839
840
            raise errors.UninitializableFormat(self)
840
841
        mutter('creating branch reference in %s', a_bzrdir.transport.base)
841
842
        branch_transport = a_bzrdir.get_branch_transport(self)
842
 
        # FIXME rbc 20060209 one j-a-ms encoding branch lands this str() cast is not needed.
843
 
        branch_transport.put('location', StringIO(str(target_branch.bzrdir.root_transport.base)))
844
 
        branch_transport.put('format', StringIO(self.get_format_string()))
 
843
        branch_transport.put_bytes('location',
 
844
            target_branch.bzrdir.root_transport.base)
 
845
        branch_transport.put_bytes('format', self.get_format_string())
845
846
        return self.open(a_bzrdir, _found=True)
846
847
 
847
848
    def __init__(self):
958
959
 
959
960
    __repr__ = __str__
960
961
 
961
 
    def __del__(self):
962
 
        # TODO: It might be best to do this somewhere else,
963
 
        # but it is nice for a Branch object to automatically
964
 
        # cache it's information.
965
 
        # Alternatively, we could have the Transport objects cache requests
966
 
        # See the earlier discussion about how major objects (like Branch)
967
 
        # should never expect their __del__ function to run.
968
 
        # XXX: cache_root seems to be unused, 2006-01-13 mbp
969
 
        if hasattr(self, 'cache_root') and self.cache_root is not None:
970
 
            try:
971
 
                osutils.rmtree(self.cache_root)
972
 
            except:
973
 
                pass
974
 
            self.cache_root = None
975
 
 
976
962
    def _get_base(self):
977
963
        return self._base
978
964
 
1248
1234
                        "use bzrlib.urlutils.escape")
1249
1235
                    
1250
1236
            url = urlutils.relative_url(self.base, url)
1251
 
            self.control_files.put('parent', url + '\n')
 
1237
            self.control_files.put('parent', StringIO(url + '\n'))
1252
1238
 
1253
1239
    @deprecated_function(zero_nine)
1254
1240
    def tree_config(self):