bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
5557.1.15
by John Arbash Meinel
Merge bzr.dev 5597 to resolve NEWS, aka bzr-2.3.txt |
1 |
# Copyright (C) 2006, 2007, 2009, 2011 Canonical Ltd
|
1731.2.16
by Aaron Bentley
Get extract working for standalone trees |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1731.2.16
by Aaron Bentley
Get extract working for standalone trees |
16 |
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
17 |
from .. import ( |
1731.2.18
by Aaron Bentley
Get extract in repository under test |
18 |
branch, |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
19 |
errors, |
20 |
)
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
21 |
from . import TestCaseWithTransport |
1731.2.16
by Aaron Bentley
Get extract working for standalone trees |
22 |
|
23 |
||
24 |
class TestExtract(TestCaseWithTransport): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
25 |
|
1731.2.16
by Aaron Bentley
Get extract working for standalone trees |
26 |
def test_extract(self): |
27 |
self.build_tree(['a/', 'a/b/', 'a/b/c', 'a/d']) |
|
3113.6.5
by Aaron Bentley
Update tests |
28 |
wt = self.make_branch_and_tree('a', format='rich-root-pack') |
6855.4.1
by Jelmer Vernooij
Yet more bees. |
29 |
wt.add(['b', 'b/c', 'd'], [b'b-id', b'c-id', b'd-id']) |
1731.2.16
by Aaron Bentley
Get extract working for standalone trees |
30 |
wt.commit('added files') |
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
31 |
b_wt = wt.extract('b') |
7391.3.1
by Jelmer Vernooij
Use id2path in fewer places. |
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') |
|
1731.2.16
by Aaron Bentley
Get extract working for standalone trees |
38 |
self.assertEqual(b_wt.basedir, wt.abspath('b')) |
39 |
self.assertEqual(wt.get_parent_ids(), b_wt.get_parent_ids()) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
40 |
self.assertEqual(wt.branch.last_revision(), |
1731.2.21
by Aaron Bentley
Ensure extracting a subtree dupes the branch |
41 |
b_wt.branch.last_revision()) |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
42 |
|
1731.2.18
by Aaron Bentley
Get extract in repository under test |
43 |
def extract_in_checkout(self, a_branch): |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
44 |
self.build_tree(['a/', 'a/b/', 'a/b/c/', 'a/b/c/d']) |
45 |
wt = a_branch.create_checkout('a', lightweight=True) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
46 |
wt.add(['b', 'b/c', 'b/c/d'], [b'b-id', b'c-id', b'd-id']) |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
47 |
wt.commit('added files') |
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
48 |
return wt.extract('b') |
1731.2.18
by Aaron Bentley
Get extract in repository under test |
49 |
|
50 |
def test_extract_in_checkout(self): |
|
3113.6.5
by Aaron Bentley
Update tests |
51 |
a_branch = self.make_branch('branch', format='rich-root-pack') |
1731.2.18
by Aaron Bentley
Get extract in repository under test |
52 |
self.extract_in_checkout(a_branch) |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
53 |
b_branch = branch.Branch.open('branch/b') |
54 |
b_branch_ref = branch.Branch.open('a/b') |
|
55 |
self.assertEqual(b_branch.base, b_branch_ref.base) |
|
56 |
||
57 |
def test_extract_in_deep_checkout(self): |
|
3113.6.5
by Aaron Bentley
Update tests |
58 |
a_branch = self.make_branch('branch', format='rich-root-pack') |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
59 |
self.build_tree(['a/', 'a/b/', 'a/b/c/', 'a/b/c/d/', 'a/b/c/d/e']) |
60 |
wt = a_branch.create_checkout('a', lightweight=True) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
61 |
wt.add(['b', 'b/c', 'b/c/d', 'b/c/d/e/'], [b'b-id', b'c-id', b'd-id', |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
62 |
b'e-id']) |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
63 |
wt.commit('added files') |
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
64 |
b_wt = wt.extract('b/c/d') |
1731.2.17
by Aaron Bentley
Support extracting with checkouts |
65 |
b_branch = branch.Branch.open('branch/b/c/d') |
66 |
b_branch_ref = branch.Branch.open('a/b/c/d') |
|
67 |
self.assertEqual(b_branch.base, b_branch_ref.base) |
|
1731.2.18
by Aaron Bentley
Get extract in repository under test |
68 |
|
69 |
def test_bad_repo_format(self): |
|
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
70 |
repo = self.make_repository('branch', shared=True, |
2100.3.17
by Aaron Bentley
Remove get_format_*, make FormatRegistry.register_metadir vary working tree |
71 |
format='knit') |
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
72 |
a_branch = repo.controldir.create_branch() |
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
73 |
self.assertRaises(errors.RootNotRich, self.extract_in_checkout, |
1731.2.18
by Aaron Bentley
Get extract in repository under test |
74 |
a_branch) |
75 |
||
76 |
def test_good_repo_format(self): |
|
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
77 |
repo = self.make_repository('branch', shared=True, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
78 |
format='dirstate-with-subtree') |
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
79 |
a_branch = repo.controldir.create_branch() |
1731.2.18
by Aaron Bentley
Get extract in repository under test |
80 |
wt_b = self.extract_in_checkout(a_branch) |
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
81 |
self.assertEqual(wt_b.branch.repository.controldir.transport.base, |
7143.15.2
by Jelmer Vernooij
Run autopep8. |
82 |
repo.controldir.transport.base) |