/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_extract.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    def test_extract(self):
27
27
        self.build_tree(['a/', 'a/b/', 'a/b/c', 'a/d'])
28
28
        wt = self.make_branch_and_tree('a', format='rich-root-pack')
29
 
        wt.add(['b', 'b/c', 'd'], [b'b-id', b'c-id', b'd-id'])
 
29
        wt.add(['b', 'b/c', 'd'], ['b-id', 'c-id', 'd-id'])
30
30
        wt.commit('added files')
31
 
        b_wt = wt.extract('b')
32
 
        self.assertTrue(b_wt.is_versioned(''))
33
 
        if b_wt.supports_setting_file_ids():
34
 
            self.assertEqual(b'b-id', b_wt.path2id(''))
35
 
            self.assertEqual(b'c-id', b_wt.path2id('c'))
36
 
            self.assertEqual('c', b_wt.id2path(b'c-id'))
37
 
            self.assertRaises(errors.BzrError, wt.id2path, b'b-id')
 
31
        b_wt = wt.extract('b-id')
 
32
        self.assertEqual('b-id', b_wt.get_root_id())
 
33
        self.assertEqual('c-id', b_wt.path2id('c'))
 
34
        self.assertEqual('c', b_wt.id2path('c-id'))
 
35
        self.assertRaises(errors.BzrError, wt.id2path, 'b-id')
38
36
        self.assertEqual(b_wt.basedir, wt.abspath('b'))
39
37
        self.assertEqual(wt.get_parent_ids(), b_wt.get_parent_ids())
40
38
        self.assertEqual(wt.branch.last_revision(),
43
41
    def extract_in_checkout(self, a_branch):
44
42
        self.build_tree(['a/', 'a/b/', 'a/b/c/', 'a/b/c/d'])
45
43
        wt = a_branch.create_checkout('a', lightweight=True)
46
 
        wt.add(['b', 'b/c', 'b/c/d'], [b'b-id', b'c-id', b'd-id'])
 
44
        wt.add(['b', 'b/c', 'b/c/d'], ['b-id', 'c-id', 'd-id'])
47
45
        wt.commit('added files')
48
 
        return wt.extract('b')
 
46
        return wt.extract('b-id')
49
47
 
50
48
    def test_extract_in_checkout(self):
51
49
        a_branch = self.make_branch('branch', format='rich-root-pack')
58
56
        a_branch = self.make_branch('branch', format='rich-root-pack')
59
57
        self.build_tree(['a/', 'a/b/', 'a/b/c/', 'a/b/c/d/', 'a/b/c/d/e'])
60
58
        wt = a_branch.create_checkout('a', lightweight=True)
61
 
        wt.add(['b', 'b/c', 'b/c/d', 'b/c/d/e/'], [b'b-id', b'c-id', b'd-id',
62
 
                                                   b'e-id'])
 
59
        wt.add(['b', 'b/c', 'b/c/d', 'b/c/d/e/'], ['b-id', 'c-id', 'd-id',
 
60
                'e-id'])
63
61
        wt.commit('added files')
64
 
        b_wt = wt.extract('b/c/d')
 
62
        b_wt = wt.extract('d-id')
65
63
        b_branch = branch.Branch.open('branch/b/c/d')
66
64
        b_branch_ref = branch.Branch.open('a/b/c/d')
67
65
        self.assertEqual(b_branch.base, b_branch_ref.base)
75
73
 
76
74
    def test_good_repo_format(self):
77
75
        repo = self.make_repository('branch', shared=True,
78
 
                                    format='dirstate-with-subtree')
 
76
            format='dirstate-with-subtree')
79
77
        a_branch = repo.controldir.create_branch()
80
78
        wt_b = self.extract_in_checkout(a_branch)
81
79
        self.assertEqual(wt_b.branch.repository.controldir.transport.base,
82
 
                         repo.controldir.transport.base)
 
80
        repo.controldir.transport.base)