~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Aaron Bentley
  • Date: 2006-02-22 14:39:42 UTC
  • mto: (2027.1.2 revert-subpath-56549)
  • mto: This revision was merged to the branch mainline in revision 1570.
  • Revision ID: abentley@panoramicfeedback.com-20060222143942-ae72299f2de66767
Fixed build_tree with symlinks

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import os
18
18
from bzrlib.branch import Branch
 
19
from bzrlib.bzrdir import BzrDir
19
20
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
20
21
                           ReusingTransform, CantMoveRoot, NotVersionedError,
21
22
                           ExistingLimbo, ImmortalLimbo, LockError)
24
25
from bzrlib.tests import TestCaseInTempDir, TestSkipped
25
26
from bzrlib.transform import (TreeTransform, ROOT_PARENT, FinalPaths, 
26
27
                              resolve_conflicts, cook_conflicts, 
27
 
                              conflicts_strings, find_interesting)
 
28
                              conflicts_strings, find_interesting, build_tree)
28
29
 
29
30
class TestTreeTransform(TestCaseInTempDir):
30
31
    def setUp(self):
658
659
        self.assertIs(os.path.lexists(this.wt.abspath('b/h1.BASE')), True)
659
660
        self.assertIs(os.path.lexists(this.wt.abspath('b/h1.OTHER')), False)
660
661
        self.assertEqual(this.wt.id2path('i'), pathjoin('b/i1.OTHER'))
 
662
 
 
663
class TestBuildTree(TestCaseInTempDir):
 
664
    def test_build_tree(self):
 
665
        if not has_symlinks():
 
666
            raise TestSkipped('Test requires symlink support')
 
667
        os.mkdir('a')
 
668
        a = BzrDir.create_standalone_workingtree('a')
 
669
        os.mkdir('a/foo')
 
670
        file('a/foo/bar', 'wb').write('contents')
 
671
        os.symlink('a/foo/bar', 'a/foo/baz')
 
672
        a.add(['foo', 'foo/bar', 'foo/baz'])
 
673
        a.commit('initial commit')
 
674
        b = BzrDir.create_standalone_workingtree('b')
 
675
        build_tree(a.basis_tree(), b)
 
676
        self.assertIs(os.path.isdir('b/foo'), True)
 
677
        self.assertEqual(file('b/foo/bar', 'rb').read(), "contents")
 
678
        self.assertEqual(os.readlink('b/foo/baz'), 'a/foo/bar')