~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/weave.py

Basic BzrDir support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        return self._transport.get(self.filename(file_id))
68
68
 
69
69
    def _put(self, file_id, f):
70
 
        # less round trips to mkdir on failure than mkdir always
71
 
        try:
72
 
            return self._transport.put(self.filename(file_id), f, mode=self._file_mode)
73
 
        except NoSuchFile:
74
 
            if not self._prefixed:
75
 
                raise
76
 
            self._transport.mkdir(hash_prefix(file_id), mode=self._dir_mode)
77
 
            return self._transport.put(self.filename(file_id), f, mode=self._file_mode)
 
70
        if self._prefixed:
 
71
            try:
 
72
                self._transport.mkdir(hash_prefix(file_id), mode=self._dir_mode)
 
73
            except FileExists:
 
74
                pass
 
75
        return self._transport.put(self.filename(file_id), f, mode=self._file_mode)
78
76
 
79
77
    def get_weave(self, file_id, transaction):
80
78
        weave = transaction.map.find_weave(file_id)