~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib import bzrdir
22
 
from bzrlib.tests import TestCaseWithTransport
23
 
from bzrlib.workingtree import WorkingTree
24
 
 
25
 
 
26
 
class TestViewFileOperations(TestCaseWithTransport):
 
21
from bzrlib import (
 
22
    bzrdir,
 
23
    osutils,
 
24
    tests,
 
25
    )
 
26
 
 
27
 
 
28
class TestViewFileOperations(tests.TestCaseWithTransport):
27
29
 
28
30
    def make_abc_tree_with_ab_view(self):
29
31
        # we need to use a specific format because the default format
30
32
        # doesn't support views yet
31
33
        format = bzrdir.format_registry.make_bzrdir('development6-rich-root')
32
 
        wt = TestCaseWithTransport.make_branch_and_tree(self, '.',
33
 
            format=format)
 
34
        wt = self.make_branch_and_tree( '.', format=format)
34
35
        self.build_tree(['a', 'b', 'c'])
35
36
        wt.views.set_view('my', ['a', 'b'])
36
37
        return wt
152
153
        self.assertEquals('b', out_lines[1])
153
154
 
154
155
 
155
 
class TestViewTreeOperationss(TestCaseWithTransport):
 
156
class TestViewTreeOperations(tests.TestCaseWithTransport):
156
157
 
157
158
    def make_abc_tree_and_clone_with_ab_view(self):
158
159
        # we need to use a specific format because the default format
159
160
        # doesn't support views yet
160
161
        format = bzrdir.format_registry.make_bzrdir('development6-rich-root')
161
162
        # Build the first tree
162
 
        wt1 = TestCaseWithTransport.make_branch_and_tree(self, 'tree_1',
163
 
            format=format)
 
163
        wt1 = self.make_branch_and_tree('tree_1', format=format)
164
164
        self.build_tree(['tree_1/a', 'tree_1/b', 'tree_1/c'])
165
165
        wt1.add(['a', 'b', 'c'])
166
166
        wt1.commit("adding a b c")
186
186
 
187
187
    def test_view_on_update(self):
188
188
        tree_1, tree_2 = self.make_abc_tree_and_clone_with_ab_view()
189
 
        os.chdir("tree_2")
190
 
        self.run_bzr("bind ../tree_1")
191
 
        out, err = self.run_bzr('update')
 
189
        self.run_bzr("bind ../tree_1", working_dir='tree_2')
 
190
        out, err = self.run_bzr('update', working_dir='tree_2')
192
191
        self.assertEqualDiff(
193
 
            "Operating on whole tree but only reporting on 'my' view.\n"
194
 
            " M  a\n"
195
 
            "All changes applied successfully.\n"
196
 
            "Updated to revision 2.\n", err)
197
 
        self.assertEqualDiff("", out)
 
192
            """Operating on whole tree but only reporting on 'my' view.
 
193
 M  a
 
194
All changes applied successfully.
 
195
Updated to revision 2 of branch %s
 
196
""" % osutils.pathjoin(self.test_dir, 'tree_1'),
 
197
            err)
 
198
        self.assertEqual("", out)
198
199
 
199
200
    def test_view_on_merge(self):
200
201
        tree_1, tree_2 = self.make_abc_tree_and_clone_with_ab_view()
203
204
            "Operating on whole tree but only reporting on 'my' view.\n"
204
205
            " M  a\n"
205
206
            "All changes applied successfully.\n", err)
206
 
        self.assertEqualDiff("", out)
 
207
        self.assertEqual("", out)