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')
801
817
def make_foo_bar_baz(self):
802
818
foo = bzrdir.BzrDir.create_branch_convenience('foo').bzrdir
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 ?
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)
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')
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"))
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"))