/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: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from breezy import (
19
19
    controldir,
20
20
    )
21
 
from breezy.bzr import (
22
 
    branch as _mod_bzrbranch,
23
 
    )
24
21
from breezy.tests import TestCaseWithTransport
25
22
 
26
23
 
30
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('path', 'http://example.org', b'file-id')
35
 
        branch.set_reference_info('lath', 'http://example.org/2', b'file-id2')
 
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', 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')
 
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')
49
47
        return tree
50
48
 
51
49
    def test_uses_working_tree_location(self):
55
53
 
56
54
    def test_uses_basis_tree_location(self):
57
55
        tree = self.make_tree_with_reference()
58
 
        tree.commit('add newpath')
59
56
        tree.controldir.destroy_workingtree()
60
57
        out, err = self.run_bzr('reference', working_dir='tree')
61
58
        self.assertContainsRe(out, 'newpath http://example.org\n')
67
64
 
68
65
    def test_one_arg_uses_containing_tree(self):
69
66
        tree = self.make_tree_with_reference()
70
 
        out, err = self.run_bzr('reference tree/newpath')
 
67
        out, err = self.run_bzr('reference -d tree newpath')
71
68
        self.assertEqual('newpath http://example.org\n', out)
72
69
 
73
70
    def test_two_args_sets(self):
74
71
        tree = self.make_branch_and_tree('tree')
75
72
        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')
 
73
        tree.add('file')
 
74
        out, err = self.run_bzr('reference -d tree file http://example.org')
 
75
        location = tree.get_reference_info('file')
79
76
        self.assertEqual('http://example.org', location)
80
 
        self.assertEqual(b'file-id', file_id)
81
77
        self.assertEqual('', out)
82
78
        self.assertEqual('', err)
83
79
 
89
85
 
90
86
    def test_missing_file_forced(self):
91
87
        tree = self.make_branch_and_tree('tree')
 
88
        tree.add_reference(self.make_branch_and_tree('tree/file'))
92
89
        out, err = self.run_bzr(
93
90
            'reference --force-unversioned file http://example.org',
94
91
            working_dir='tree')
95
 
        location, file_id = tree.branch.get_reference_info('file')
 
92
        location = tree.get_reference_info('file')
96
93
        self.assertEqual('http://example.org', location)
97
94
        self.assertEqual('', out)
98
95
        self.assertEqual('', err)