/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-01-19 03:15:39 UTC
  • mfrom: (7447.3.4 move-reference-functions)
  • Revision ID: breezy.the.bot@gmail.com-20200119031539-v25daxmc7w2qoog2
Move tree reference info functions to workingtree.

Merged from https://code.launchpad.net/~jelmer/brz/move-reference-functions/+merge/377800

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
 
        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')
 
33
        tree = self.make_branch_and_tree('branch')
 
34
        branch = tree.branch
 
35
        branch.set_reference_info('path', 'http://example.org')
 
36
        tree.add_reference(self.make_branch_and_tree('branch/path'))
 
37
        tree.add_reference(self.make_branch_and_tree('branch/lath'))
 
38
        branch.set_reference_info('lath', 'http://example.org/2')
36
39
        out, err = self.run_bzr('reference', working_dir='branch')
37
40
        lines = out.splitlines()
38
41
        self.assertEqual('lath http://example.org/2', lines[0])
40
43
 
41
44
    def make_tree_with_reference(self):
42
45
        tree = self.make_branch_and_tree('tree')
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')
 
46
        subtree = self.make_branch_and_tree('tree/newpath')
 
47
        tree.add_reference(subtree)
 
48
        tree.commit('add reference')
 
49
        tree.set_reference_info('newpath', 'http://example.org')
 
50
        tree.set_reference_info('lath', 'http://example.org/2')
49
51
        return tree
50
52
 
51
53
    def test_uses_working_tree_location(self):
67
69
 
68
70
    def test_one_arg_uses_containing_tree(self):
69
71
        tree = self.make_tree_with_reference()
70
 
        out, err = self.run_bzr('reference tree/newpath')
 
72
        out, err = self.run_bzr('reference -d tree newpath')
71
73
        self.assertEqual('newpath http://example.org\n', out)
72
74
 
73
75
    def test_two_args_sets(self):
74
76
        tree = self.make_branch_and_tree('tree')
75
77
        self.build_tree(['tree/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')
 
78
        tree.add('file')
 
79
        out, err = self.run_bzr('reference -d tree file http://example.org')
 
80
        location = tree.get_reference_info('file')
79
81
        self.assertEqual('http://example.org', location)
80
 
        self.assertEqual(b'file-id', file_id)
81
82
        self.assertEqual('', out)
82
83
        self.assertEqual('', err)
83
84