~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

Deprecate BzrDir.generate_backup_name and use osutils.available_backup_name.

* bzrlib/tests/test_bzrdir.py:
(TestGenerateBackupName.test_deprecated_generate_backup_name): Added.

* bzrlib/workingtree.py:
(WorkingTree.remove.backup): Fix line too long in a call site

* bzrlib/bzrdir.py:
(BzrDir.generate_backup_name): Deperecated.
(BzrDir._available_backup_name): Renamed to better hint about race
conditions and implementation delegated to
osutils.available_backup_name.
(BzrDir.backup_bzrdir): Cleaned up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2078
2078
                    files_to_backup.append(path[1])
2079
2079
 
2080
2080
        def backup(file_to_backup):
2081
 
            backup_name = self.bzrdir.generate_backup_name(file_to_backup)
 
2081
            backup_name = self.bzrdir._available_backup_name(file_to_backup)
2082
2082
            osutils.rename(abs_path, self.abspath(backup_name))
2083
 
            return "removed %s (but kept a copy: %s)" % (file_to_backup, backup_name)
 
2083
            return "removed %s (but kept a copy: %s)" % (file_to_backup,
 
2084
                                                         backup_name)
2084
2085
 
2085
2086
        # Build inv_delta and delete files where applicable,
2086
2087
        # do this before any modifications to inventory.