~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Deprecate LockableFiles.put_utf8

Show diffs side-by-side

added added

removed removed

Lines of Context:
917
917
        control_files.create_lock()
918
918
        control_files.lock_write()
919
919
        if set_format:
920
 
            control_files.put_utf8('format', self.get_format_string())
 
920
            utf8_files += [('format', self.get_format_string())]
921
921
        try:
922
 
            for file, content in utf8_files:
923
 
                control_files.put_utf8(file, content)
 
922
            for (filename, content) in utf8_files:
 
923
                branch_transport.put_bytes(
 
924
                    filename, content,
 
925
                    mode=control_files._file_mode)
924
926
        finally:
925
927
            control_files.unlock()
926
928
        return self.open(a_bzrdir, _found=True)
966
968
        """True if this format supports tags stored in the branch"""
967
969
        return False  # by default
968
970
 
969
 
    # XXX: Probably doesn't really belong here -- mbp 20070212
970
 
    def _initialize_control_files(self, a_bzrdir, utf8_files, lock_filename,
971
 
            lock_class):
972
 
        branch_transport = a_bzrdir.get_branch_transport(self)
973
 
        control_files = lockable_files.LockableFiles(branch_transport,
974
 
            lock_filename, lock_class)
975
 
        control_files.create_lock()
976
 
        control_files.lock_write()
977
 
        try:
978
 
            for filename, content in utf8_files:
979
 
                control_files.put_utf8(filename, content)
980
 
        finally:
981
 
            control_files.unlock()
982
 
 
983
971
 
984
972
class BranchHooks(Hooks):
985
973
    """A dictionary mapping hook name to a list of callables for branch hooks.
1814
1802
        :param location: URL to the target branch
1815
1803
        """
1816
1804
        if location:
1817
 
            self.control_files.put_utf8('bound', location+'\n')
 
1805
            self._transport.put_bytes('bound', location+'\n')
1818
1806
        else:
1819
1807
            try:
1820
1808
                self._transport.delete('bound')
2222
2210
        new_branch.tags._set_tag_dict({})
2223
2211
 
2224
2212
        # Copying done; now update target format
2225
 
        new_branch.control_files.put_utf8('format',
2226
 
            format.get_format_string())
 
2213
        new_branch._transport.put_bytes('format',
 
2214
            format.get_format_string(),
 
2215
            mode=new_branch.control_files._file_mode)
2227
2216
 
2228
2217
        # Clean up old files
2229
2218
        new_branch.control_files._transport.delete('revision-history')