~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_extract.py

  • Committer: Aaron Bentley
  • Date: 2006-10-07 13:17:20 UTC
  • mto: (2100.3.5 by-reference-trees)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: aaron.bentley@utoronto.ca-20061007131720-b9a1a0387f949e2a
Support extracting with checkouts

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
from bzrlib import errors
 
17
from bzrlib import (
 
18
    branch, 
 
19
    errors,
 
20
    )
18
21
from bzrlib.tests import TestCaseWithTransport
19
22
 
20
23
 
32
35
        self.assertRaises(errors.BzrError, wt.id2path, 'b-id')
33
36
        self.assertEqual(b_wt.basedir, wt.abspath('b'))
34
37
        self.assertEqual(wt.get_parent_ids(), b_wt.get_parent_ids())
 
38
 
 
39
    def test_extract_in_checkout(self):
 
40
        a_branch = self.make_branch('branch')
 
41
        self.build_tree(['a/', 'a/b/', 'a/b/c/', 'a/b/c/d'])
 
42
        wt = a_branch.create_checkout('a', lightweight=True)
 
43
        wt.add(['b', 'b/c', 'b/c/d'], ['b-id', 'c-id', 'd-id'])
 
44
        wt.commit('added files')
 
45
        b_wt = wt.extract('b-id')
 
46
        b_branch = branch.Branch.open('branch/b')
 
47
        b_branch_ref = branch.Branch.open('a/b')
 
48
        self.assertEqual(b_branch.base, b_branch_ref.base)
 
49
 
 
50
    def test_extract_in_deep_checkout(self):
 
51
        a_branch = self.make_branch('branch')
 
52
        self.build_tree(['a/', 'a/b/', 'a/b/c/', 'a/b/c/d/', 'a/b/c/d/e'])
 
53
        wt = a_branch.create_checkout('a', lightweight=True)
 
54
        wt.add(['b', 'b/c', 'b/c/d', 'b/c/d/e/'], ['b-id', 'c-id', 'd-id',
 
55
                'e-id'])
 
56
        wt.commit('added files')
 
57
        b_wt = wt.extract('d-id')
 
58
        b_branch = branch.Branch.open('branch/b/c/d')
 
59
        b_branch_ref = branch.Branch.open('a/b/c/d')
 
60
        self.assertEqual(b_branch.base, b_branch_ref.base)