~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2010-12-20 02:23:31 UTC
  • mto: This revision was merged to the branch mainline in revision 5577.
  • Revision ID: jelmer@samba.org-20101220022331-hbm91o1ps9gjrlns
Add testr magic for bzr selftest --list

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    controldir,
30
30
    errors,
31
31
    help_topics,
 
32
    lock,
32
33
    repository,
33
34
    osutils,
34
35
    remote,
 
36
    symbol_versioning,
35
37
    urlutils,
36
38
    win32utils,
37
39
    workingtree,
790
792
        self.build_tree(['tree1/subtree/file'])
791
793
        sub_tree.add('file')
792
794
        tree.commit('Initial commit')
 
795
        # The following line force the orhaning to reveal bug #634470
 
796
        tree.branch.get_config().set_user_option(
 
797
            'bzr.transform.orphan_policy', 'move')
793
798
        tree.bzrdir.destroy_workingtree()
 
799
        # FIXME: subtree/.bzr is left here which allows the test to pass (or
 
800
        # fail :-( ) -- vila 20100909
794
801
        repo = self.make_repository('repo', shared=True,
795
802
            format='dirstate-with-subtree')
796
803
        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')
 
804
        # FIXME: we just deleted the workingtree and now we want to use it ????
 
805
        # At a minimum, we should use tree.branch below (but this fails too
 
806
        # currently) or stop calling this test 'treeless'. Specifically, I've
 
807
        # turn the line below into an assertRaises when 'subtree/.bzr' is
 
808
        # orphaned and sprout tries to access the branch there (which is left
 
809
        # by bzrdir.BzrDirMeta1.destroy_workingtree when it ignores the
 
810
        # [DeletingParent('Not deleting', u'subtree', None)] conflict). See bug
 
811
        # #634470.  -- vila 20100909
 
812
        self.assertRaises(errors.NotBranchError,
 
813
                          tree.bzrdir.sprout, 'repo/tree2')
 
814
#        self.failUnlessExists('repo/tree2/subtree')
 
815
#        self.failIfExists('repo/tree2/subtree/file')
800
816
 
801
817
    def make_foo_bar_baz(self):
802
818
        foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir
1334
1350
    def set_parent(self, parent):
1335
1351
        self._parent = parent
1336
1352
 
 
1353
    def lock_read(self):
 
1354
        return lock.LogicalLockResult(self.unlock)
 
1355
 
 
1356
    def unlock(self):
 
1357
        return
 
1358
 
1337
1359
 
1338
1360
class TestBzrDirSprout(TestCaseWithMemoryTransport):
1339
1361
 
1417
1439
 
1418
1440
 
1419
1441
class TestGenerateBackupName(TestCaseWithMemoryTransport):
 
1442
    # FIXME: This may need to be unified with test_osutils.TestBackupNames or
 
1443
    # moved to per_bzrdir or per_transport for better coverage ?
 
1444
    # -- vila 20100909
1420
1445
 
1421
1446
    def setUp(self):
1422
1447
        super(TestGenerateBackupName, self).setUp()
1425
1450
            possible_transports=[self._transport])
1426
1451
        self._bzrdir = bzrdir.BzrDir.open_from_transport(self._transport)
1427
1452
 
 
1453
    def test_deprecated_generate_backup_name(self):
 
1454
        res = self.applyDeprecated(
 
1455
                symbol_versioning.deprecated_in((2, 3, 0)),
 
1456
                self._bzrdir.generate_backup_name, 'whatever')
 
1457
 
1428
1458
    def test_new(self):
1429
 
        self.assertEqual("a.~1~", self._bzrdir.generate_backup_name("a"))
 
1459
        self.assertEqual("a.~1~", self._bzrdir._available_backup_name("a"))
1430
1460
 
1431
1461
    def test_exiting(self):
1432
1462
        self._transport.put_bytes("a.~1~", "some content")
1433
 
        self.assertEqual("a.~2~", self._bzrdir.generate_backup_name("a"))
 
1463
        self.assertEqual("a.~2~", self._bzrdir._available_backup_name("a"))