~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-02 01:44:26 UTC
  • mfrom: (6518 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120402014426-0o5qtysohyl006b2
merge bzr.dev.

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
38
37
from bzrlib.conflicts import (
39
38
    DeletingParent,
40
39
    DuplicateEntry,
44
43
    ParentLoop,
45
44
    UnversionedParent,
46
45
)
 
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 = BzrDir.create_standalone_workingtree(dirname)
 
1648
        self.wt = ControlDir.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 = BzrDir.create_standalone_workingtree('a')
 
1884
        a = ControlDir.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 = BzrDir.create_standalone_workingtree('b')
 
1890
        b = ControlDir.create_standalone_workingtree('b')
1891
1891
        basis = a.basis_tree()
1892
1892
        basis.lock_read()
1893
1893
        self.addCleanup(basis.unlock)
2184
2184
        def rot13(chunks, context=None):
2185
2185
            return [''.join(chunks).encode('rot13')]
2186
2186
        rot13filter = filters.ContentFilter(rot13, rot13)
2187
 
        filters.register_filter_stack_map('rot13', {'yes': [rot13filter]}.get)
 
2187
        filters.filter_stacks_registry.register(
 
2188
            'rot13', {'yes': [rot13filter]}.get)
2188
2189
        os.mkdir(self.test_home_dir + '/.bazaar')
2189
2190
        rules_filename = self.test_home_dir + '/.bazaar/rules'
2190
2191
        f = open(rules_filename, 'wb')
2410
2411
        self.assertEqual('tree', revision.properties['branch-nick'])
2411
2412
 
2412
2413
 
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
 
 
2438
2414
class TestFileMover(tests.TestCaseWithTransport):
2439
2415
 
2440
2416
    def test_file_mover(self):