~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/versioned/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-06-25 10:36:36 UTC
  • mfrom: (3350.6.12 versionedfiles)
  • Revision ID: pqm@pqm.ubuntu.com-20080625103636-6kxh4e1gmyn82f50
(mbp for robertc) VersionedFiles refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
                if relpath.endswith(suffix):
70
70
                    # TODO: use standard remove_suffix function
71
71
                    escaped_id = os.path.basename(relpath[:-len(suffix)])
72
 
                    file_id = self._unescape(escaped_id)
 
72
                    file_id = self._mapper.unmap(escaped_id)[0]
73
73
                    if file_id not in ids:
74
74
                        ids.add(file_id)
75
75
                        yield file_id
153
153
                # unexpected error - NoSuchFile is expected to be raised on a
154
154
                # missing dir only and that only occurs when we are prefixed.
155
155
                raise
156
 
            self._transport.mkdir(self.hash_prefix(file_id), mode=self._dir_mode)
 
156
            dirname = osutils.dirname(_filename)
 
157
            self._transport.mkdir(dirname, mode=self._dir_mode)
157
158
            weave = self._versionedfile_class(_filename, self._transport,
158
159
                                              self._file_mode, create=True,
159
160
                                              get_scope=self.get_scope,
178
179
    def _put_weave(self, file_id, weave, transaction):
179
180
        """Preserved here for upgrades-to-weaves to use."""
180
181
        myweave = self._make_new_versionedfile(file_id, transaction)
181
 
        myweave.insert_record_stream(weave.get_record_stream(weave.versions(),
 
182
        myweave.insert_record_stream(weave.get_record_stream(
 
183
            [(version,) for version in weave.versions()],
182
184
            'topological', False))
183
185
 
184
 
    def copy(self, source, result_id, transaction):
185
 
        """Copy the source versioned file to result_id in this store."""
186
 
        source.copy_to(self.filename(result_id), self._transport)
187
 
 
188
186
    def copy_all_ids(self, store_from, pb=None, from_transaction=None,
189
187
                     to_transaction=None):
190
188
        """Copy all the file ids from store_from into self."""
241
239
                target = self._make_new_versionedfile(f, to_transaction)
242
240
                source = from_store.get_weave(f, from_transaction)
243
241
                target.insert_record_stream(source.get_record_stream(
244
 
                    source.versions(), 'topological', False))
 
242
                    [(version,) for version in source.versions()],
 
243
                    'topological', False))
245
244
        finally:
246
245
            pb.finished()
247
246