~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

Merge bzr.dev to resolve news conflict

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,
790
791
        self.build_tree(['tree1/subtree/file'])
791
792
        sub_tree.add('file')
792
793
        tree.commit('Initial commit')
 
794
        # The following line force the orhaning to reveal bug #634470
 
795
        tree.branch.get_config().set_user_option(
 
796
            'bzr.transform.orphan_policy', 'move')
793
797
        tree.bzrdir.destroy_workingtree()
 
798
        # FIXME: subtree/.bzr is left here which allows the test to pass (or
 
799
        # fail :-( ) -- vila 20100909
794
800
        repo = self.make_repository('repo', shared=True,
795
801
            format='dirstate-with-subtree')
796
802
        repo.set_make_working_trees(False)
797
 
        tree.bzrdir.sprout('repo/tree2')
798
 
        self.failUnlessExists('repo/tree2/subtree')
799
 
        self.failIfExists('repo/tree2/subtree/file')
 
803
        # FIXME: we just deleted the workingtree and now we want to use it ????
 
804
        # At a minimum, we should use tree.branch below (but this fails too
 
805
        # currently) or stop calling this test 'treeless'. Specifically, I've
 
806
        # turn the line below into an assertRaises when 'subtree/.bzr' is
 
807
        # orphaned and sprout tries to access the branch there (which is left
 
808
        # by bzrdir.BzrDirMeta1.destroy_workingtree when it ignores the
 
809
        # [DeletingParent('Not deleting', u'subtree', None)] conflict). See bug
 
810
        # #634470.  -- vila 20100909
 
811
        self.assertRaises(errors.NotBranchError,
 
812
                          tree.bzrdir.sprout, 'repo/tree2')
 
813
#        self.failUnlessExists('repo/tree2/subtree')
 
814
#        self.failIfExists('repo/tree2/subtree/file')
800
815
 
801
816
    def make_foo_bar_baz(self):
802
817
        foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir
1417
1432
 
1418
1433
 
1419
1434
class TestGenerateBackupName(TestCaseWithMemoryTransport):
 
1435
    # FIXME: This may need to be unified with test_osutils.TestBackupNames or
 
1436
    # moved to per_bzrdir or per_transport for better coverage ?
 
1437
    # -- vila 20100909
1420
1438
 
1421
1439
    def setUp(self):
1422
1440
        super(TestGenerateBackupName, self).setUp()
1425
1443
            possible_transports=[self._transport])
1426
1444
        self._bzrdir = bzrdir.BzrDir.open_from_transport(self._transport)
1427
1445
 
 
1446
    def test_deprecated_generate_backup_name(self):
 
1447
        res = self.applyDeprecated(
 
1448
                symbol_versioning.deprecated_in((2, 3, 0)),
 
1449
                self._bzrdir.generate_backup_name, 'whatever')
 
1450
 
1428
1451
    def test_new(self):
1429
 
        self.assertEqual("a.~1~", self._bzrdir.generate_backup_name("a"))
 
1452
        self.assertEqual("a.~1~", self._bzrdir._available_backup_name("a"))
1430
1453
 
1431
1454
    def test_exiting(self):
1432
1455
        self._transport.put_bytes("a.~1~", "some content")
1433
 
        self.assertEqual("a.~2~", self._bzrdir.generate_backup_name("a"))
 
1456
        self.assertEqual("a.~2~", self._bzrdir._available_backup_name("a"))