~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_view.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-18 14:09:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120118140919-rlvdrhpc0nq1lbwi
Change set/remove to require a lock for the branch config files.

This means that tests (or any plugin for that matter) do not requires an
explicit lock on the branch anymore to change a single option. This also
means the optimisation becomes "opt-in" and as such won't be as
spectacular as it may be and/or harder to get right (nothing fails
anymore).

This reduces the diff by ~300 lines.

Code/tests that were updating more than one config option is still taking
a lock to at least avoid some IOs and demonstrate the benefits through
the decreased number of hpss calls.

The duplication between BranchStack and BranchOnlyStack will be removed
once the same sharing is in place for local config files, at which point
the Stack class itself may be able to host the changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
class TestViewUI(TestCaseWithTransport):
25
25
 
26
 
    def make_branch_and_tree(self):
27
 
        # we need to use a specific format because the default format
28
 
        # doesn't support views yet
29
 
        format = bzrdir.format_registry.make_bzrdir('development6-rich-root')
30
 
        return TestCaseWithTransport.make_branch_and_tree(self, '.',
31
 
            format=format)
32
 
 
33
26
    def test_view_command_help(self):
34
27
        out, err = self.run_bzr('help view')
35
28
        self.assertContainsRe(out, 'Manage filtered views')
36
29
 
37
30
    def test_define_view(self):
38
 
        wt = self.make_branch_and_tree()
 
31
        wt = self.make_branch_and_tree('.')
39
32
        # Check definition of a new view
40
33
        out, err = self.run_bzr('view a b c')
41
34
        self.assertEquals(out, "Using 'my' view: a, b, c\n")
51
44
        self.assertContainsRe(err, "Cannot change the 'off' pseudo view")
52
45
 
53
46
    def test_list_view(self):
54
 
        wt = self.make_branch_and_tree()
 
47
        wt = self.make_branch_and_tree('.')
55
48
        # Check list of the current view
56
49
        out, err = self.run_bzr('view')
57
50
        self.assertEquals(out, "No current view.\n")
76
69
        self.assertContainsRe(err, "No such view")
77
70
 
78
71
    def test_delete_view(self):
79
 
        wt = self.make_branch_and_tree()
 
72
        wt = self.make_branch_and_tree('.')
80
73
        # Check delete of the current view
81
74
        out, err = self.run_bzr('view --delete', retcode=3)
82
75
        self.assertContainsRe(err, "No current view to delete")
101
94
        self.assertContainsRe(err, "Both --delete and a file list specified")
102
95
 
103
96
    def test_switch_view(self):
104
 
        wt = self.make_branch_and_tree()
 
97
        wt = self.make_branch_and_tree('.')
105
98
        # Check switching to a named view
106
99
        self.run_bzr('view a b c')
107
100
        self.run_bzr('view e f --name foo')