/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_reference.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-06 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180506114854-h4qd9ojaqy8wxjsd
Move .mailmap to root.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
class TestReference(TestCaseWithTransport):
28
28
 
29
29
    def get_default_format(self):
30
 
        return controldir.format_registry.make_controldir('development-subtree')
 
30
        format = controldir.format_registry.make_controldir('1.9')
 
31
        format.set_branch_format(_mod_bzrbranch.BzrBranchFormat8())
 
32
        return format
31
33
 
32
34
    def test_no_args_lists(self):
33
 
        tree = self.make_branch_and_tree('branch')
34
 
        branch = tree.branch
35
 
        tree.add_reference(self.make_branch_and_tree('branch/path'))
36
 
        tree.add_reference(self.make_branch_and_tree('branch/lath'))
37
 
        tree.set_reference_info('path', 'http://example.org')
38
 
        tree.set_reference_info('lath', 'http://example.org/2')
 
35
        branch = self.make_branch('branch')
 
36
        branch.set_reference_info('path', 'http://example.org', b'file-id')
 
37
        branch.set_reference_info('lath', 'http://example.org/2', b'file-id2')
39
38
        out, err = self.run_bzr('reference', working_dir='branch')
40
39
        lines = out.splitlines()
41
40
        self.assertEqual('lath http://example.org/2', lines[0])
43
42
 
44
43
    def make_tree_with_reference(self):
45
44
        tree = self.make_branch_and_tree('tree')
46
 
        subtree = self.make_branch_and_tree('tree/newpath')
47
 
        tree.add_reference(subtree)
48
 
        tree.set_reference_info('newpath', 'http://example.org')
49
 
        tree.commit('add reference')
 
45
        self.build_tree(['tree/newpath'])
 
46
        tree.add('newpath', b'file-id')
 
47
        tree.branch.set_reference_info('newpath', 'http://example.org', b'file-id')
 
48
        tree.branch.set_reference_info('lath', 'http://example.org/2',
 
49
                b'file-id2')
50
50
        return tree
51
51
 
52
52
    def test_uses_working_tree_location(self):
56
56
 
57
57
    def test_uses_basis_tree_location(self):
58
58
        tree = self.make_tree_with_reference()
 
59
        tree.commit('add newpath')
59
60
        tree.controldir.destroy_workingtree()
60
61
        out, err = self.run_bzr('reference', working_dir='tree')
61
62
        self.assertContainsRe(out, 'newpath http://example.org\n')
67
68
 
68
69
    def test_one_arg_uses_containing_tree(self):
69
70
        tree = self.make_tree_with_reference()
70
 
        out, err = self.run_bzr('reference -d tree newpath')
 
71
        out, err = self.run_bzr('reference tree/newpath')
71
72
        self.assertEqual('newpath http://example.org\n', out)
72
73
 
73
74
    def test_two_args_sets(self):
74
75
        tree = self.make_branch_and_tree('tree')
75
76
        self.build_tree(['tree/file'])
76
 
        tree.add('file')
77
 
        out, err = self.run_bzr('reference -d tree file http://example.org')
78
 
        location = tree.get_reference_info('file')
 
77
        tree.add('file', b'file-id')
 
78
        out, err = self.run_bzr('reference tree/file http://example.org')
 
79
        location, file_id = tree.branch.get_reference_info('file')
79
80
        self.assertEqual('http://example.org', location)
 
81
        self.assertEqual(b'file-id', file_id)
80
82
        self.assertEqual('', out)
81
83
        self.assertEqual('', err)
82
84
 
85
87
        out, err = self.run_bzr('reference file http://example.org',
86
88
                                working_dir='tree', retcode=3)
87
89
        self.assertEqual('brz: ERROR: file is not versioned.\n', err)
88
 
 
89
 
    def test_missing_file_forced(self):
90
 
        tree = self.make_branch_and_tree('tree')
91
 
        tree.add_reference(self.make_branch_and_tree('tree/file'))
92
 
        out, err = self.run_bzr(
93
 
            'reference --force-unversioned file http://example.org',
94
 
            working_dir='tree')
95
 
        location = tree.get_reference_info('file')
96
 
        self.assertEqual('http://example.org', location)
97
 
        self.assertEqual('', out)
98
 
        self.assertEqual('', err)