/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: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
        return controldir.format_registry.make_controldir('development-subtree')
31
31
 
32
32
    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')
 
33
        branch = self.make_branch('branch')
 
34
        branch.set_reference_info('path', 'http://example.org', b'file-id')
 
35
        branch.set_reference_info('lath', 'http://example.org/2', b'file-id2')
39
36
        out, err = self.run_bzr('reference', working_dir='branch')
40
37
        lines = out.splitlines()
41
38
        self.assertEqual('lath http://example.org/2', lines[0])
43
40
 
44
41
    def make_tree_with_reference(self):
45
42
        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')
 
43
        self.build_tree(['tree/newpath'])
 
44
        tree.add('newpath', b'file-id')
 
45
        tree.branch.set_reference_info(
 
46
            'newpath', 'http://example.org', b'file-id')
 
47
        tree.branch.set_reference_info('lath', 'http://example.org/2',
 
48
                                       b'file-id2')
50
49
        return tree
51
50
 
52
51
    def test_uses_working_tree_location(self):
56
55
 
57
56
    def test_uses_basis_tree_location(self):
58
57
        tree = self.make_tree_with_reference()
 
58
        tree.commit('add newpath')
59
59
        tree.controldir.destroy_workingtree()
60
60
        out, err = self.run_bzr('reference', working_dir='tree')
61
61
        self.assertContainsRe(out, 'newpath http://example.org\n')
67
67
 
68
68
    def test_one_arg_uses_containing_tree(self):
69
69
        tree = self.make_tree_with_reference()
70
 
        out, err = self.run_bzr('reference -d tree newpath')
 
70
        out, err = self.run_bzr('reference tree/newpath')
71
71
        self.assertEqual('newpath http://example.org\n', out)
72
72
 
73
73
    def test_two_args_sets(self):
74
74
        tree = self.make_branch_and_tree('tree')
75
75
        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')
 
76
        tree.add('file', b'file-id')
 
77
        out, err = self.run_bzr('reference tree/file http://example.org')
 
78
        location, file_id = tree.branch.get_reference_info('file')
79
79
        self.assertEqual('http://example.org', location)
 
80
        self.assertEqual(b'file-id', file_id)
80
81
        self.assertEqual('', out)
81
82
        self.assertEqual('', err)
82
83
 
88
89
 
89
90
    def test_missing_file_forced(self):
90
91
        tree = self.make_branch_and_tree('tree')
91
 
        tree.add_reference(self.make_branch_and_tree('tree/file'))
92
92
        out, err = self.run_bzr(
93
93
            'reference --force-unversioned file http://example.org',
94
94
            working_dir='tree')
95
 
        location = tree.get_reference_info('file')
 
95
        location, file_id = tree.branch.get_reference_info('file')
96
96
        self.assertEqual('http://example.org', location)
97
97
        self.assertEqual('', out)
98
98
        self.assertEqual('', err)