~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-31 12:56:46 UTC
  • mfrom: (5939.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20110531125646-a1k5q7foqxlnmmr1
(Martin von Gagern) Use transport.move instead of transport.rename to
        allow overwriting pack files over sftp, (bug #421776)

Show diffs side-by-side

added added

removed removed

Lines of Context:
314
314
        for index_type in index_types:
315
315
            old_name = self.index_name(index_type, self.name)
316
316
            new_name = '../indices/' + old_name
317
 
            self.upload_transport.rename(old_name, new_name)
 
317
            self.upload_transport.move(old_name, new_name)
318
318
            self._replace_index_with_readonly(index_type)
319
319
        new_name = '../packs/' + self.file_name()
320
 
        self.upload_transport.rename(self.file_name(), new_name)
 
320
        self.upload_transport.move(self.file_name(), new_name)
321
321
        self._state = 'finished'
322
322
 
323
323
    def _get_external_refs(self, index):
503
503
        new_name = self.name + '.pack'
504
504
        if not suspend:
505
505
            new_name = '../packs/' + new_name
506
 
        self.upload_transport.rename(self.random_name, new_name)
 
506
        self.upload_transport.move(self.random_name, new_name)
507
507
        self._state = 'finished'
508
508
        if 'pack' in debug.debug_flags:
509
509
            # XXX: size might be interesting?
1211
1211
        """
1212
1212
        for pack in packs:
1213
1213
            try:
1214
 
                pack.pack_transport.rename(pack.file_name(),
 
1214
                pack.pack_transport.move(pack.file_name(),
1215
1215
                    '../obsolete_packs/' + pack.file_name())
1216
1216
            except (errors.PathError, errors.TransportError), e:
1217
1217
                # TODO: Should these be warnings or mutters?
1225
1225
                suffixes.append('.cix')
1226
1226
            for suffix in suffixes:
1227
1227
                try:
1228
 
                    self._index_transport.rename(pack.name + suffix,
 
1228
                    self._index_transport.move(pack.name + suffix,
1229
1229
                        '../obsolete_packs/' + pack.name + suffix)
1230
1230
                except (errors.PathError, errors.TransportError), e:
1231
1231
                    mutter("couldn't rename obsolete index, skipping it:\n%s"