/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): Colin Watson
  • Date: 2020-11-16 21:47:08 UTC
  • mfrom: (7521.1.1 remove-lp-workaround)
  • Revision ID: breezy.the.bot@gmail.com-20201116214708-jos209mgxi41oy15
Remove breezy.git workaround for bazaar.launchpad.net.

Merged from https://code.launchpad.net/~cjwatson/brz/remove-lp-workaround/+merge/393710

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
from bzrlib import (
19
 
    branch as _mod_branch,
 
18
from breezy import (
20
19
    controldir,
21
20
    )
22
 
from bzrlib.tests import TestCaseWithTransport
 
21
from breezy.tests import TestCaseWithTransport
23
22
 
24
23
 
25
24
class TestReference(TestCaseWithTransport):
26
25
 
27
26
    def get_default_format(self):
28
 
        format = controldir.format_registry.make_bzrdir('1.9')
29
 
        format.set_branch_format(_mod_branch.BzrBranchFormat8())
30
 
        return format
 
27
        return controldir.format_registry.make_controldir('development-subtree')
31
28
 
32
29
    def test_no_args_lists(self):
33
 
        branch = self.make_branch('branch')
34
 
        branch.set_reference_info('file-id', 'path', 'http://example.org')
35
 
        branch.set_reference_info('file-id2', 'lath', 'http://example.org/2')
 
30
        tree = self.make_branch_and_tree('branch')
 
31
        branch = tree.branch
 
32
        tree.add_reference(self.make_branch_and_tree('branch/path'))
 
33
        tree.add_reference(self.make_branch_and_tree('branch/lath'))
 
34
        tree.set_reference_info('path', 'http://example.org')
 
35
        tree.set_reference_info('lath', 'http://example.org/2')
36
36
        out, err = self.run_bzr('reference', working_dir='branch')
37
37
        lines = out.splitlines()
38
38
        self.assertEqual('lath http://example.org/2', lines[0])
40
40
 
41
41
    def make_tree_with_reference(self):
42
42
        tree = self.make_branch_and_tree('tree')
43
 
        self.build_tree(['tree/newpath'])
44
 
        tree.add('newpath', 'file-id')
45
 
        tree.branch.set_reference_info('file-id', 'path', 'http://example.org')
46
 
        tree.branch.set_reference_info('file-id2', 'lath',
47
 
                                       'http://example.org/2')
 
43
        subtree = self.make_branch_and_tree('tree/newpath')
 
44
        tree.add_reference(subtree)
 
45
        tree.set_reference_info('newpath', 'http://example.org')
 
46
        tree.commit('add reference')
48
47
        return tree
49
48
 
50
49
    def test_uses_working_tree_location(self):
54
53
 
55
54
    def test_uses_basis_tree_location(self):
56
55
        tree = self.make_tree_with_reference()
57
 
        tree.commit('add newpath')
58
 
        tree.bzrdir.destroy_workingtree()
 
56
        tree.controldir.destroy_workingtree()
59
57
        out, err = self.run_bzr('reference', working_dir='tree')
60
58
        self.assertContainsRe(out, 'newpath http://example.org\n')
61
59
 
66
64
 
67
65
    def test_one_arg_uses_containing_tree(self):
68
66
        tree = self.make_tree_with_reference()
69
 
        out, err = self.run_bzr('reference tree/newpath')
 
67
        out, err = self.run_bzr('reference -d tree newpath')
70
68
        self.assertEqual('newpath http://example.org\n', out)
71
69
 
72
70
    def test_two_args_sets(self):
73
71
        tree = self.make_branch_and_tree('tree')
74
72
        self.build_tree(['tree/file'])
75
 
        tree.add('file', 'file-id')
76
 
        out, err = self.run_bzr('reference tree/file http://example.org')
77
 
        path, location = tree.branch.get_reference_info('file-id')
 
73
        tree.add('file')
 
74
        out, err = self.run_bzr('reference -d tree file http://example.org')
 
75
        location = tree.get_reference_info('file')
78
76
        self.assertEqual('http://example.org', location)
79
 
        self.assertEqual('file', path)
80
77
        self.assertEqual('', out)
81
78
        self.assertEqual('', err)
82
79
 
84
81
        tree = self.make_branch_and_tree('tree')
85
82
        out, err = self.run_bzr('reference file http://example.org',
86
83
                                working_dir='tree', retcode=3)
87
 
        self.assertEqual('bzr: ERROR: file is not versioned.\n', err)
 
84
        self.assertEqual('brz: ERROR: file is not versioned.\n', err)
 
85
 
 
86
    def test_missing_file_forced(self):
 
87
        tree = self.make_branch_and_tree('tree')
 
88
        tree.add_reference(self.make_branch_and_tree('tree/file'))
 
89
        out, err = self.run_bzr(
 
90
            'reference --force-unversioned file http://example.org',
 
91
            working_dir='tree')
 
92
        location = tree.get_reference_info('file')
 
93
        self.assertEqual('http://example.org', location)
 
94
        self.assertEqual('', out)
 
95
        self.assertEqual('', err)