~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_workingtree.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005,2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
# Authors:  Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
19
19
import os
20
20
 
21
21
import bzrlib
22
 
import bzrlib.branch
23
 
from bzrlib.branch import Branch
24
 
import bzrlib.bzrdir as bzrdir
25
 
from bzrlib.bzrdir import BzrDir
26
 
import bzrlib.errors as errors
 
22
from bzrlib import branch, bzrdir, errors, urlutils, workingtree
27
23
from bzrlib.errors import (NotBranchError, NotVersionedError, 
28
24
                           UnsupportedOperation)
29
25
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
30
26
from bzrlib.tests import TestSkipped
31
27
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
32
28
from bzrlib.trace import mutter
33
 
import bzrlib.workingtree as workingtree
34
29
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
35
30
                                WorkingTree)
36
 
 
 
31
from bzrlib.conflicts import ConflictList
37
32
 
38
33
class TestWorkingTree(TestCaseWithWorkingTree):
39
34
 
78
73
        branch = self.make_branch_and_tree('.').branch
79
74
        wt, relpath = WorkingTree.open_containing()
80
75
        self.assertEqual('', relpath)
81
 
        self.assertEqual(wt.basedir + '/', branch.base)
 
76
        self.assertEqual(wt.basedir + '/', urlutils.local_path_from_url(branch.base))
82
77
        wt, relpath = WorkingTree.open_containing(u'.')
83
78
        self.assertEqual('', relpath)
84
 
        self.assertEqual(wt.basedir + '/', branch.base)
 
79
        self.assertEqual(wt.basedir + '/', urlutils.local_path_from_url(branch.base))
85
80
        wt, relpath = WorkingTree.open_containing('./foo')
86
81
        self.assertEqual('foo', relpath)
87
 
        self.assertEqual(wt.basedir + '/', branch.base)
 
82
        self.assertEqual(wt.basedir + '/', urlutils.local_path_from_url(branch.base))
88
83
        wt, relpath = WorkingTree.open_containing('file://' + getcwd() + '/foo')
89
84
        self.assertEqual('foo', relpath)
90
 
        self.assertEqual(wt.basedir + '/', branch.base)
 
85
        self.assertEqual(wt.basedir + '/', urlutils.local_path_from_url(branch.base))
91
86
 
92
87
    def test_basic_relpath(self):
93
88
        # for comprehensive relpath tests, see whitebox.py.
186
181
    def test_initialize(self):
187
182
        # initialize should create a working tree and branch in an existing dir
188
183
        t = self.make_branch_and_tree('.')
189
 
        b = Branch.open('.')
 
184
        b = branch.Branch.open('.')
190
185
        self.assertEqual(t.branch.base, b.base)
191
186
        t2 = WorkingTree.open('.')
192
187
        self.assertEqual(t.basedir, t2.basedir)
399
394
        # current format
400
395
        self.build_tree(['checkout/', 'tree/file'])
401
396
        checkout = bzrdir.BzrDirMetaFormat1().initialize('checkout')
402
 
        bzrlib.branch.BranchReferenceFormat().initialize(checkout, main_branch)
 
397
        branch.BranchReferenceFormat().initialize(checkout, main_branch)
403
398
        old_tree = self.workingtree_format.initialize(checkout)
404
399
        # now commit to 'tree'
405
400
        wt.add('file')
430
425
        # current format
431
426
        self.build_tree(['checkout/', 'tree/file'])
432
427
        checkout = bzrdir.BzrDirMetaFormat1().initialize('checkout')
433
 
        bzrlib.branch.BranchReferenceFormat().initialize(checkout, main_branch)
 
428
        branch.BranchReferenceFormat().initialize(checkout, main_branch)
434
429
        old_tree = self.workingtree_format.initialize(checkout)
435
430
        # now commit to 'tree'
436
431
        wt.add('file')
537
532
        tree.add('blo')
538
533
        tree.commit("blah", allow_pointless=False)
539
534
        base = tree.basis_tree()
540
 
        BzrDir.open("mine").sprout("other")
 
535
        bzrdir.BzrDir.open("mine").sprout("other")
541
536
        file('other/bloo', 'wb').write('two')
542
537
        othertree = WorkingTree.open('other')
543
538
        othertree.commit('blah', allow_pointless=False)
551
546
        self.assertEqual(len(tree.conflicts()), 1)
552
547
 
553
548
    def test_clear_merge_conflicts(self):
554
 
        from bzrlib.conflicts import ConflictList
555
549
        tree = self.make_merge_conflicts()
556
550
        self.assertEqual(len(tree.conflicts()), 1)
557
551
        try: