/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/per_workingtree/test_workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
 
from cStringIO import StringIO
20
19
import errno
21
20
import os
22
21
 
23
 
from bzrlib import (
 
22
from ... import (
24
23
    branch,
25
24
    bzrdir,
26
25
    config,
33
32
    trace,
34
33
    urlutils,
35
34
    )
36
 
from bzrlib.errors import (
 
35
from ...errors import (
37
36
    UnsupportedOperation,
38
37
    PathsNotVersionedError,
39
38
    )
40
 
from bzrlib.inventory import Inventory
41
 
from bzrlib.mutabletree import MutableTree
42
 
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
43
 
from bzrlib.tests import (
 
39
from ...inventory import Inventory
 
40
from ...mutabletree import MutableTree
 
41
from ...osutils import pathjoin, getcwd, has_symlinks
 
42
from ...sixish import (
 
43
    BytesIO,
 
44
    )
 
45
from .. import (
44
46
    features,
45
47
    TestSkipped,
46
48
    TestNotApplicable,
47
49
    )
48
 
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
49
 
from bzrlib.workingtree import (
 
50
from .  import TestCaseWithWorkingTree
 
51
from ...workingtree import (
50
52
    TreeDirectory,
51
53
    TreeFile,
52
54
    TreeLink,
53
55
    InventoryWorkingTree,
54
56
    WorkingTree,
55
57
    )
56
 
from bzrlib.conflicts import ConflictList, TextConflict, ContentsConflict
 
58
from ...conflicts import ConflictList, TextConflict, ContentsConflict
57
59
 
58
60
 
59
61
class TestWorkingTree(TestCaseWithWorkingTree):
295
297
        "bzr add" adds the parent as necessary, but simple working tree add
296
298
        doesn't do that.
297
299
        """
298
 
        from bzrlib.errors import NotVersionedError
 
300
        from breezy.errors import NotVersionedError
299
301
        wt = self.make_branch_and_tree('.')
300
302
        self.build_tree(['foo/',
301
303
                         'foo/hello'])
318
320
        self.build_tree(['hello'])
319
321
        wt.add(['hello'])
320
322
        wt.commit(message='add hello')
321
 
        stdout = StringIO()
322
 
        stderr = StringIO()
 
323
        stdout = BytesIO()
 
324
        stderr = BytesIO()
323
325
        self.assertEqual(None, self.apply_redirected(None, stdout, stderr,
324
326
                                                     wt.remove,
325
327
                                                     ['hello'],
569
571
        self.assertEqual(['A'], old_tree.get_parent_ids())
570
572
 
571
573
    def test_merge_revert(self):
572
 
        from bzrlib.merge import merge_inner
 
574
        from breezy.merge import merge_inner
573
575
        this = self.make_branch_and_tree('b1')
574
576
        self.build_tree_contents([('b1/a', 'a test\n'), ('b1/b', 'b test\n')])
575
577
        this.add(['a', 'b'])
688
690
        self.assertEqual(mm, d)
689
691
 
690
692
    def test_conflicts(self):
691
 
        from bzrlib.tests.test_conflicts import example_conflicts
 
693
        from breezy.tests.test_conflicts import example_conflicts
692
694
        tree = self.make_branch_and_tree('master')
693
695
        try:
694
696
            tree.set_conflicts(example_conflicts)
705
707
                          tree2.conflicts)
706
708
 
707
709
    def make_merge_conflicts(self):
708
 
        from bzrlib.merge import merge_inner
 
710
        from breezy.merge import merge_inner
709
711
        tree = self.make_branch_and_tree('mine')
710
712
        with file('mine/bloo', 'wb') as f: f.write('one')
711
713
        with file('mine/blo', 'wb') as f: f.write('on')
882
884
        tree.lock_read()
883
885
        self.addCleanup(tree.unlock)
884
886
        self.assertEqual(
885
 
            set(['not-here-and-not-versioned', 'here-and-not-versioned']),
 
887
            {'not-here-and-not-versioned', 'here-and-not-versioned'},
886
888
            tree.filter_unversioned_files(paths))
887
889
 
888
890
    def test_detect_real_kind(self):
986
988
                self.assertFalse(tree.is_executable(tree.path2id('filename')))
987
989
            finally:
988
990
                tree.unlock()
989
 
            os.chmod('filename', 0755)
 
991
            os.chmod('filename', 0o755)
990
992
            self.addCleanup(tree.lock_read().unlock)
991
993
            self.assertTrue(tree.is_executable(tree.path2id('filename')))
992
994
        else:
1000
1002
        self.build_tree(['tree/a', 'tree/b'])
1001
1003
        tree.add(['a', 'b'], ['a-id', 'b-id'])
1002
1004
        os.unlink('tree/a')
1003
 
        self.assertEqual(set(['a-id', 'b-id', tree.get_root_id()]),
 
1005
        self.assertEqual({'a-id', 'b-id', tree.get_root_id()},
1004
1006
                         tree.all_file_ids())
1005
1007
 
1006
1008
    def test_sprout_hardlink(self):