~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.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:
32
32
    repository,
33
33
    osutils,
34
34
    remote,
 
35
    symbol_versioning,
35
36
    urlutils,
36
37
    win32utils,
37
38
    workingtree,
1417
1418
 
1418
1419
 
1419
1420
class TestGenerateBackupName(TestCaseWithMemoryTransport):
 
1421
    # FIXME: This may need to be unified with test_osutils.TestBackupNames or
 
1422
    # moved to per_bzrdir or per_transport for better coverage ?
 
1423
    # -- vila 20100909
1420
1424
 
1421
1425
    def setUp(self):
1422
1426
        super(TestGenerateBackupName, self).setUp()
1425
1429
            possible_transports=[self._transport])
1426
1430
        self._bzrdir = bzrdir.BzrDir.open_from_transport(self._transport)
1427
1431
 
 
1432
    def test_deprecated_generate_backup_name(self):
 
1433
        res = self.applyDeprecated(
 
1434
                symbol_versioning.deprecated_in((2, 3, 0)),
 
1435
                self._bzrdir.generate_backup_name, 'whatever')
 
1436
 
1428
1437
    def test_new(self):
1429
 
        self.assertEqual("a.~1~", self._bzrdir.generate_backup_name("a"))
 
1438
        self.assertEqual("a.~1~", self._bzrdir._available_backup_name("a"))
1430
1439
 
1431
1440
    def test_exiting(self):
1432
1441
        self._transport.put_bytes("a.~1~", "some content")
1433
 
        self.assertEqual("a.~2~", self._bzrdir.generate_backup_name("a"))
 
1442
        self.assertEqual("a.~2~", self._bzrdir._available_backup_name("a"))