~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-22 13:39:51 UTC
  • mfrom: (6470.1.1 less-inventory-use-2)
  • Revision ID: pqm@pqm.ubuntu.com-20120222133951-cqvnnx710wox7905
(jelmer) Use inventories directly in fewer places. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    transform,
35
35
    urlutils,
36
36
    )
 
37
from bzrlib.bzrdir import BzrDir
37
38
from bzrlib.conflicts import (
38
39
    DeletingParent,
39
40
    DuplicateEntry,
43
44
    ParentLoop,
44
45
    UnversionedParent,
45
46
)
46
 
from bzrlib.controldir import ControlDir
47
47
from bzrlib.diff import show_diff_trees
48
48
from bzrlib.errors import (
49
49
    DuplicateKey,
1645
1645
    def __init__(self, dirname, root_id):
1646
1646
        self.name = dirname
1647
1647
        os.mkdir(dirname)
1648
 
        self.wt = ControlDir.create_standalone_workingtree(dirname)
 
1648
        self.wt = BzrDir.create_standalone_workingtree(dirname)
1649
1649
        self.wt.set_root_id(root_id)
1650
1650
        self.b = self.wt.branch
1651
1651
        self.tt = TreeTransform(self.wt)
1881
1881
    def test_build_tree_with_symlinks(self):
1882
1882
        self.requireFeature(SymlinkFeature)
1883
1883
        os.mkdir('a')
1884
 
        a = ControlDir.create_standalone_workingtree('a')
 
1884
        a = BzrDir.create_standalone_workingtree('a')
1885
1885
        os.mkdir('a/foo')
1886
1886
        with file('a/foo/bar', 'wb') as f: f.write('contents')
1887
1887
        os.symlink('a/foo/bar', 'a/foo/baz')
1888
1888
        a.add(['foo', 'foo/bar', 'foo/baz'])
1889
1889
        a.commit('initial commit')
1890
 
        b = ControlDir.create_standalone_workingtree('b')
 
1890
        b = BzrDir.create_standalone_workingtree('b')
1891
1891
        basis = a.basis_tree()
1892
1892
        basis.lock_read()
1893
1893
        self.addCleanup(basis.unlock)
2410
2410
        self.assertEqual('tree', revision.properties['branch-nick'])
2411
2411
 
2412
2412
 
 
2413
class TestBackupName(tests.TestCase):
 
2414
 
 
2415
    def test_deprecations(self):
 
2416
        class MockTransform(object):
 
2417
 
 
2418
            def has_named_child(self, by_parent, parent_id, name):
 
2419
                return name in by_parent.get(parent_id, [])
 
2420
 
 
2421
        class MockEntry(object):
 
2422
 
 
2423
            def __init__(self):
 
2424
                object.__init__(self)
 
2425
                self.name = "name"
 
2426
 
 
2427
        tt = MockTransform()
 
2428
        name1 = self.applyDeprecated(
 
2429
            symbol_versioning.deprecated_in((2, 3, 0)),
 
2430
            transform.get_backup_name, MockEntry(), {'a':[]}, 'a', tt)
 
2431
        self.assertEqual('name.~1~', name1)
 
2432
        name2 = self.applyDeprecated(
 
2433
            symbol_versioning.deprecated_in((2, 3, 0)),
 
2434
            transform._get_backup_name, 'name', {'a':['name.~1~']}, 'a', tt)
 
2435
        self.assertEqual('name.~2~', name2)
 
2436
 
 
2437
 
2413
2438
class TestFileMover(tests.TestCaseWithTransport):
2414
2439
 
2415
2440
    def test_file_mover(self):