bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6404.6.1
by Vincent Ladeuil
Tests passing for a first rough version of a cached branch config store. The changes here are too invasive and several parallel proposals have been made. |
1 |
# Copyright (C) 2007-2012 Canonical Ltd
|
|
2363.5.11
by Aaron Bentley
All info tests pass |
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
|
|
2363.5.11
by Aaron Bentley
All info tests pass |
16 |
|
|
2804.4.3
by Alexander Belchenko
fix for test_info-tests: using osutils.getcwd instead of os.getcwd (sigh) |
17 |
import sys |
|
2363.5.11
by Aaron Bentley
All info tests pass |
18 |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
19 |
from .. import ( |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
20 |
branch as _mod_branch, |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
21 |
controldir, |
|
6883.20.1
by Jelmer Vernooij
Skip checkout description tests against git. |
22 |
errors, |
|
2363.5.2
by Aaron Bentley
Implement layout description |
23 |
info, |
24 |
tests, |
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
25 |
workingtree, |
26 |
repository as _mod_repository, |
|
|
2363.5.2
by Aaron Bentley
Implement layout description |
27 |
)
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
28 |
from ..bzr import ( |
29 |
branch as _mod_bzrbranch, |
|
30 |
)
|
|
|
2363.5.2
by Aaron Bentley
Implement layout description |
31 |
|
32 |
||
33 |
class TestInfo(tests.TestCaseWithTransport): |
|
34 |
||
35 |
def test_describe_standalone_layout(self): |
|
36 |
tree = self.make_branch_and_tree('tree') |
|
37 |
self.assertEqual('Empty control directory', info.describe_layout()) |
|
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
38 |
self.assertEqual( |
39 |
'Unshared repository with trees and colocated branches', |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
40 |
info.describe_layout(tree.branch.repository, control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
41 |
tree.branch.repository.set_make_working_trees(False) |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
42 |
self.assertEqual('Unshared repository with colocated branches', |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
43 |
info.describe_layout(tree.branch.repository, control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
44 |
self.assertEqual('Standalone branch', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
45 |
info.describe_layout(tree.branch.repository, tree.branch, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
46 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
47 |
self.assertEqual('Standalone branchless tree', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
48 |
info.describe_layout(tree.branch.repository, None, tree, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
49 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
50 |
self.assertEqual('Standalone tree', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
51 |
info.describe_layout(tree.branch.repository, tree.branch, tree, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
52 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
53 |
tree.branch.bind(tree.branch) |
54 |
self.assertEqual('Bound branch', |
|
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
55 |
info.describe_layout(tree.branch.repository, tree.branch, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
56 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
57 |
self.assertEqual('Checkout', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
58 |
info.describe_layout(tree.branch.repository, tree.branch, tree, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
59 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
60 |
checkout = tree.branch.create_checkout('checkout', lightweight=True) |
61 |
self.assertEqual('Lightweight checkout', |
|
62 |
info.describe_layout(checkout.branch.repository, checkout.branch, |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
63 |
checkout, control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
64 |
|
65 |
def test_describe_repository_layout(self): |
|
66 |
repository = self.make_repository('.', shared=True) |
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
67 |
tree = controldir.ControlDir.create_branch_convenience('tree', |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
68 |
force_new_tree=True).controldir.open_workingtree() |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
69 |
self.assertEqual('Shared repository with trees and colocated branches', |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
70 |
info.describe_layout(tree.branch.repository, control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
71 |
repository.set_make_working_trees(False) |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
72 |
self.assertEqual('Shared repository with colocated branches', |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
73 |
info.describe_layout(tree.branch.repository, control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
74 |
self.assertEqual('Repository branch', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
75 |
info.describe_layout(tree.branch.repository, tree.branch, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
76 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
77 |
self.assertEqual('Repository branchless tree', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
78 |
info.describe_layout(tree.branch.repository, None, tree, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
79 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
80 |
self.assertEqual('Repository tree', |
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
81 |
info.describe_layout(tree.branch.repository, tree.branch, tree, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
82 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
83 |
tree.branch.bind(tree.branch) |
84 |
self.assertEqual('Repository checkout', |
|
|
6437.9.4
by Jelmer Vernooij
Fix remaining tests. |
85 |
info.describe_layout(tree.branch.repository, tree.branch, tree, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
86 |
control=tree.controldir)) |
|
2363.5.2
by Aaron Bentley
Implement layout description |
87 |
checkout = tree.branch.create_checkout('checkout', lightweight=True) |
|
2363.5.4
by Aaron Bentley
Eliminate the concept of a 'repository lightweight checkout' |
88 |
self.assertEqual('Lightweight checkout', |
|
2363.5.2
by Aaron Bentley
Implement layout description |
89 |
info.describe_layout(checkout.branch.repository, checkout.branch, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
90 |
checkout, control=tree.controldir)) |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
91 |
|
92 |
def assertTreeDescription(self, format): |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
93 |
"""Assert a tree's format description matches expectations""" |
|
2363.5.6
by Aaron Bentley
Add short format description |
94 |
self.make_branch_and_tree('%s_tree' % format, format=format) |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
95 |
tree = workingtree.WorkingTree.open('%s_tree' % format) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
96 |
self.assertEqual(format, info.describe_format(tree.controldir, |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
97 |
tree.branch.repository, tree.branch, tree)) |
98 |
||
|
2363.5.6
by Aaron Bentley
Add short format description |
99 |
def assertCheckoutDescription(self, format, expected=None): |
|
2363.5.22
by Aaron Bentley
Restructure tests |
100 |
"""Assert a checkout's format description matches expectations""" |
|
2363.5.6
by Aaron Bentley
Add short format description |
101 |
if expected is None: |
102 |
expected = format |
|
103 |
branch = self.make_branch('%s_cobranch' % format, format=format) |
|
104 |
# this ought to be easier...
|
|
105 |
branch.create_checkout('%s_co' % format, |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
106 |
lightweight=True).controldir.destroy_workingtree() |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
107 |
control = controldir.ControlDir.open('%s_co' % format) |
|
2363.5.13
by Aaron Bentley
Fix environment pollution with assertCheckoutDescription |
108 |
old_format = control._format.workingtree_format |
109 |
try: |
|
110 |
control._format.workingtree_format = \ |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
111 |
controldir.format_registry.make_controldir(format).workingtree_format |
|
2363.5.13
by Aaron Bentley
Fix environment pollution with assertCheckoutDescription |
112 |
control.create_workingtree() |
113 |
tree = workingtree.WorkingTree.open('%s_co' % format) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
114 |
format_description = info.describe_format(tree.controldir, |
|
2592.4.2
by Martin Pool
exempt experimental-* formats from test_describe_checkout_format |
115 |
tree.branch.repository, tree.branch, tree) |
116 |
self.assertEqual(expected, format_description, |
|
117 |
"checkout of format called %r was described as %r" % |
|
118 |
(expected, format_description)) |
|
|
2363.5.13
by Aaron Bentley
Fix environment pollution with assertCheckoutDescription |
119 |
finally: |
120 |
control._format.workingtree_format = old_format |
|
|
2363.5.6
by Aaron Bentley
Add short format description |
121 |
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
122 |
def assertBranchDescription(self, format, expected=None): |
|
2363.5.22
by Aaron Bentley
Restructure tests |
123 |
"""Assert branch's format description matches expectations""" |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
124 |
if expected is None: |
125 |
expected = format |
|
|
2363.5.6
by Aaron Bentley
Add short format description |
126 |
self.make_branch('%s_branch' % format, format=format) |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
127 |
branch = _mod_branch.Branch.open('%s_branch' % format) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
128 |
self.assertEqual(expected, info.describe_format(branch.controldir, |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
129 |
branch.repository, branch, None)) |
130 |
||
131 |
def assertRepoDescription(self, format, expected=None): |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
132 |
"""Assert repository's format description matches expectations""" |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
133 |
if expected is None: |
134 |
expected = format |
|
|
2363.5.6
by Aaron Bentley
Add short format description |
135 |
self.make_repository('%s_repo' % format, format=format) |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
136 |
repo = _mod_repository.Repository.open('%s_repo' % format) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
137 |
self.assertEqual(expected, info.describe_format(repo.controldir, |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
138 |
repo, None, None)) |
139 |
||
|
2363.5.22
by Aaron Bentley
Restructure tests |
140 |
def test_describe_tree_format(self): |
|
6862.3.1
by Jelmer Vernooij
Don't try to get a tree description for formats that don't support trees. |
141 |
for key, format in controldir.format_registry.iteritems(): |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
142 |
if key in controldir.format_registry.aliases(): |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
143 |
continue
|
|
6862.3.1
by Jelmer Vernooij
Don't try to get a tree description for formats that don't support trees. |
144 |
if not format().supports_workingtrees: |
145 |
continue
|
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
146 |
self.assertTreeDescription(key) |
147 |
||
|
2363.5.22
by Aaron Bentley
Restructure tests |
148 |
def test_describe_checkout_format(self): |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
149 |
for key in controldir.format_registry.keys(): |
150 |
if key in controldir.format_registry.aliases(): |
|
|
3152.2.2
by Robert Collins
The bzrdir format registry now accepts an ``alias`` keyword to |
151 |
# Aliases will not describe correctly in the UI because the
|
152 |
# real format is found.
|
|
153 |
continue
|
|
154 |
# legacy: weave does not support checkouts
|
|
155 |
if key == 'weave': |
|
156 |
continue
|
|
|
6883.20.1
by Jelmer Vernooij
Skip checkout description tests against git. |
157 |
# foreign: git checkouts can actually be bzr controldirs
|
158 |
if key in ('git', 'git-bare'): |
|
159 |
continue
|
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
160 |
if controldir.format_registry.get_info(key).experimental: |
|
3152.2.2
by Robert Collins
The bzrdir format registry now accepts an ``alias`` keyword to |
161 |
# We don't require that experimental formats support checkouts
|
162 |
# or describe correctly in the UI.
|
|
|
2363.5.6
by Aaron Bentley
Add short format description |
163 |
continue
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
164 |
if controldir.format_registry.get_info(key).hidden: |
|
4976.2.1
by Ian Clatworthy
Hide most storage formats |
165 |
continue
|
|
2363.5.6
by Aaron Bentley
Add short format description |
166 |
expected = None |
|
4977.1.2
by Ian Clatworthy
(igc) Fix comparison bug in format name tests (trivial) |
167 |
if key in ('pack-0.92',): |
|
4976.2.1
by Ian Clatworthy
Hide most storage formats |
168 |
expected = 'pack-0.92' |
|
3586.2.6
by Ian Clatworthy
add 1.7 and 1.7-rich-root formats |
169 |
elif key in ('knit', 'metaweave'): |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
170 |
if 'metaweave' in controldir.format_registry: |
|
5582.10.96
by Jelmer Vernooij
Support running without plugins. |
171 |
expected = 'knit or metaweave' |
172 |
else: |
|
173 |
expected = 'knit' |
|
|
4210.4.1
by Ian Clatworthy
replace experimental development-wt5 formats with 1.14 formats |
174 |
elif key in ('1.14', '1.14-rich-root'): |
|
4265.1.1
by John Arbash Meinel
Merge the a couple rev older brisbane-core into bzr.dev, most things are resolve in favor of bzr.dev |
175 |
expected = '1.14 or 1.14-rich-root' |
|
2363.5.6
by Aaron Bentley
Add short format description |
176 |
self.assertCheckoutDescription(key, expected) |
177 |
||
|
2363.5.22
by Aaron Bentley
Restructure tests |
178 |
def test_describe_branch_format(self): |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
179 |
for key in controldir.format_registry.keys(): |
180 |
if key in controldir.format_registry.aliases(): |
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
181 |
continue
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
182 |
if controldir.format_registry.get_info(key).hidden: |
|
4210.4.2
by Ian Clatworthy
split filtered views support out into WorkingTreeFormat6 |
183 |
continue
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
184 |
expected = None |
185 |
if key in ('dirstate', 'knit'): |
|
|
2363.5.17
by Aaron Bentley
Change separator from '/' to 'or' |
186 |
expected = 'dirstate or knit' |
|
4977.1.2
by Ian Clatworthy
(igc) Fix comparison bug in format name tests (trivial) |
187 |
elif key in ('1.14',): |
|
4976.2.1
by Ian Clatworthy
Hide most storage formats |
188 |
expected = '1.14' |
|
4977.1.2
by Ian Clatworthy
(igc) Fix comparison bug in format name tests (trivial) |
189 |
elif key in ('1.14-rich-root',): |
|
4976.2.1
by Ian Clatworthy
Hide most storage formats |
190 |
expected = '1.14-rich-root' |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
191 |
self.assertBranchDescription(key, expected) |
192 |
||
|
2363.5.22
by Aaron Bentley
Restructure tests |
193 |
def test_describe_repo_format(self): |
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
194 |
for key in controldir.format_registry.keys(): |
195 |
if key in controldir.format_registry.aliases(): |
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
196 |
continue
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
197 |
if controldir.format_registry.get_info(key).hidden: |
|
4210.4.2
by Ian Clatworthy
split filtered views support out into WorkingTreeFormat6 |
198 |
continue
|
|
2363.5.5
by Aaron Bentley
add info.describe_format |
199 |
expected = None |
200 |
if key in ('dirstate', 'knit', 'dirstate-tags'): |
|
|
2363.5.17
by Aaron Bentley
Change separator from '/' to 'or' |
201 |
expected = 'dirstate or dirstate-tags or knit' |
|
4977.1.2
by Ian Clatworthy
(igc) Fix comparison bug in format name tests (trivial) |
202 |
elif key in ('1.14',): |
|
4976.2.1
by Ian Clatworthy
Hide most storage formats |
203 |
expected = '1.14' |
|
4977.1.2
by Ian Clatworthy
(igc) Fix comparison bug in format name tests (trivial) |
204 |
elif key in ('1.14-rich-root',): |
|
4976.2.1
by Ian Clatworthy
Hide most storage formats |
205 |
expected = '1.14-rich-root' |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
206 |
self.assertRepoDescription(key, expected) |
207 |
||
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
208 |
format = controldir.format_registry.make_controldir('knit') |
|
6653.1.10
by Jelmer Vernooij
Fix remaining two tests. |
209 |
format.set_branch_format(_mod_bzrbranch.BzrBranchFormat6()) |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
210 |
tree = self.make_branch_and_tree('unknown', format=format) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
211 |
self.assertEqual('unnamed', info.describe_format(tree.controldir, |
|
2363.5.5
by Aaron Bentley
add info.describe_format |
212 |
tree.branch.repository, tree.branch, tree)) |
|
2363.5.18
by Aaron Bentley
Get all tests passing |
213 |
|
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
214 |
def test_gather_location_controldir_only(self): |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
215 |
bzrdir = self.make_controldir('.') |
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
216 |
self.assertEqual([('control directory', bzrdir.user_url)], |
217 |
info.gather_location_info(control=bzrdir)) |
|
218 |
||
|
2363.5.18
by Aaron Bentley
Get all tests passing |
219 |
def test_gather_location_standalone(self): |
220 |
tree = self.make_branch_and_tree('tree') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
221 |
self.assertEqual([('branch root', tree.controldir.root_transport.base)], |
222 |
info.gather_location_info( |
|
223 |
tree.branch.repository, tree.branch, tree, control=tree.controldir)) |
|
224 |
self.assertEqual([('branch root', tree.controldir.root_transport.base)], |
|
225 |
info.gather_location_info( |
|
226 |
tree.branch.repository, tree.branch, control=tree.controldir)) |
|
|
2363.5.18
by Aaron Bentley
Get all tests passing |
227 |
return tree |
228 |
||
229 |
def test_gather_location_repo(self): |
|
230 |
srepo = self.make_repository('shared', shared=True) |
|
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
231 |
self.assertEqual( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
232 |
[('shared repository', srepo.controldir.root_transport.base)], |
233 |
info.gather_location_info(srepo, control=srepo.controldir)) |
|
|
2363.5.18
by Aaron Bentley
Get all tests passing |
234 |
urepo = self.make_repository('unshared') |
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
235 |
self.assertEqual( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
236 |
[('repository', urepo.controldir.root_transport.base)], |
237 |
info.gather_location_info(urepo, control=urepo.controldir)) |
|
|
2363.5.18
by Aaron Bentley
Get all tests passing |
238 |
|
239 |
def test_gather_location_repo_branch(self): |
|
240 |
srepo = self.make_repository('shared', shared=True) |
|
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
241 |
self.assertEqual( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
242 |
[('shared repository', srepo.controldir.root_transport.base)], |
243 |
info.gather_location_info(srepo, control=srepo.controldir)) |
|
|
2363.5.18
by Aaron Bentley
Get all tests passing |
244 |
tree = self.make_branch_and_tree('shared/tree') |
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
245 |
self.assertEqual( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
246 |
[('shared repository', srepo.controldir.root_transport.base), |
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
247 |
('repository branch', tree.branch.base)], |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
248 |
info.gather_location_info(srepo, tree.branch, tree, srepo.controldir)) |
|
2363.5.18
by Aaron Bentley
Get all tests passing |
249 |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
250 |
def test_gather_location_light_checkout(self): |
|
2363.5.18
by Aaron Bentley
Get all tests passing |
251 |
tree = self.make_branch_and_tree('tree') |
252 |
lcheckout = tree.branch.create_checkout('lcheckout', lightweight=True) |
|
253 |
self.assertEqual( |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
254 |
[('light checkout root', lcheckout.controldir.root_transport.base), |
255 |
('checkout of branch', tree.controldir.root_transport.base)], |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
256 |
self.gather_tree_location_info(lcheckout)) |
257 |
||
258 |
def test_gather_location_heavy_checkout(self): |
|
259 |
tree = self.make_branch_and_tree('tree') |
|
260 |
checkout = tree.branch.create_checkout('checkout') |
|
261 |
self.assertEqual( |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
262 |
[('checkout root', checkout.controldir.root_transport.base), |
263 |
('checkout of branch', tree.controldir.root_transport.base)], |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
264 |
self.gather_tree_location_info(checkout)) |
265 |
light_checkout = checkout.branch.create_checkout('light_checkout', |
|
266 |
lightweight=True) |
|
267 |
self.assertEqual( |
|
|
2363.5.23
by Aaron Bentley
Output 2-tuples from gather_locations |
268 |
[('light checkout root', |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
269 |
light_checkout.controldir.root_transport.base), |
270 |
('checkout root', checkout.controldir.root_transport.base), |
|
271 |
('checkout of branch', tree.controldir.root_transport.base)], |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
272 |
self.gather_tree_location_info(light_checkout) |
273 |
)
|
|
274 |
||
275 |
def test_gather_location_shared_repo_checkout(self): |
|
276 |
tree = self.make_branch_and_tree('tree') |
|
|
2363.5.18
by Aaron Bentley
Get all tests passing |
277 |
srepo = self.make_repository('shared', shared=True) |
|
2363.5.22
by Aaron Bentley
Restructure tests |
278 |
shared_checkout = tree.branch.create_checkout('shared/checkout') |
|
2363.5.18
by Aaron Bentley
Get all tests passing |
279 |
self.assertEqual( |
|
2363.5.23
by Aaron Bentley
Output 2-tuples from gather_locations |
280 |
[('repository checkout root', |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
281 |
shared_checkout.controldir.root_transport.base), |
282 |
('checkout of branch', tree.controldir.root_transport.base), |
|
283 |
('shared repository', srepo.controldir.root_transport.base)], |
|
|
2363.5.22
by Aaron Bentley
Restructure tests |
284 |
self.gather_tree_location_info(shared_checkout)) |
285 |
||
286 |
def gather_tree_location_info(self, tree): |
|
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
287 |
return info.gather_location_info( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
288 |
tree.branch.repository, tree.branch, tree, tree.controldir) |
|
2363.5.19
by Aaron Bentley
Add support for bound branches |
289 |
|
290 |
def test_gather_location_bound(self): |
|
291 |
branch = self.make_branch('branch') |
|
292 |
bound_branch = self.make_branch('bound_branch') |
|
293 |
bound_branch.bind(branch) |
|
294 |
self.assertEqual( |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
295 |
[('branch root', bound_branch.controldir.root_transport.base), |
296 |
('bound to branch', branch.controldir.root_transport.base)], |
|
|
6241.4.1
by Jelmer Vernooij
Make gather_location_info understand control directories. |
297 |
info.gather_location_info( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
298 |
bound_branch.repository, bound_branch, control=bound_branch.controldir) |
|
2363.5.19
by Aaron Bentley
Add support for bound branches |
299 |
)
|
|
1551.15.41
by Aaron Bentley
Make info provide more related brances, and format all branches nicely |
300 |
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
301 |
def test_gather_location_bound_in_repository(self): |
302 |
repo = self.make_repository('repo', shared=True) |
|
303 |
repo.set_make_working_trees(False) |
|
304 |
branch = self.make_branch('branch') |
|
305 |
bound_branch = controldir.ControlDir.create_branch_convenience( |
|
306 |
'repo/bound_branch') |
|
307 |
bound_branch.bind(branch) |
|
308 |
self.assertEqual( |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
309 |
[('shared repository', bound_branch.repository.controldir.user_url), |
310 |
('repository branch', bound_branch.controldir.user_url), |
|
311 |
('bound to branch', branch.controldir.user_url)], |
|
|
6241.2.1
by Jelmer Vernooij
bzr info now shows the bound location too for local branches without tree. |
312 |
info.gather_location_info(bound_branch.repository, bound_branch) |
313 |
)
|
|
314 |
||
|
1551.15.41
by Aaron Bentley
Make info provide more related brances, and format all branches nicely |
315 |
def test_location_list(self): |
|
2804.4.3
by Alexander Belchenko
fix for test_info-tests: using osutils.getcwd instead of os.getcwd (sigh) |
316 |
if sys.platform == 'win32': |
317 |
raise tests.TestSkipped('Windows-unfriendly test') |
|
|
1551.15.41
by Aaron Bentley
Make info provide more related brances, and format all branches nicely |
318 |
locs = info.LocationList('/home/foo') |
319 |
locs.add_url('a', 'file:///home/foo/') |
|
320 |
locs.add_url('b', 'file:///home/foo/bar/') |
|
321 |
locs.add_url('c', 'file:///home/bar/bar') |
|
322 |
locs.add_url('d', 'http://example.com/example/') |
|
323 |
locs.add_url('e', None) |
|
|
1551.15.43
by Aaron Bentley
Provide ways of getting at unicode-clean output |
324 |
self.assertEqual(locs.locs, [('a', '.'), |
|
1551.15.41
by Aaron Bentley
Make info provide more related brances, and format all branches nicely |
325 |
('b', 'bar'), |
326 |
('c', '/home/bar/bar'), |
|
327 |
('d', 'http://example.com/example/')]) |
|
|
1551.15.43
by Aaron Bentley
Provide ways of getting at unicode-clean output |
328 |
self.assertEqualDiff(' a: .\n b: bar\n c: /home/bar/bar\n' |
329 |
' d: http://example.com/example/\n', |
|
330 |
''.join(locs.get_lines())) |
|
|
1551.15.41
by Aaron Bentley
Make info provide more related brances, and format all branches nicely |
331 |
|
332 |
def test_gather_related_braches(self): |
|
333 |
branch = self.make_branch('.') |
|
|
6404.6.1
by Vincent Ladeuil
Tests passing for a first rough version of a cached branch config store. The changes here are too invasive and several parallel proposals have been made. |
334 |
branch.lock_write() |
335 |
try: |
|
336 |
branch.set_public_branch('baz') |
|
337 |
branch.set_push_location('bar') |
|
338 |
branch.set_parent('foo') |
|
339 |
branch.set_submit_branch('qux') |
|
340 |
finally: |
|
341 |
branch.unlock() |
|
|
1551.15.41
by Aaron Bentley
Make info provide more related brances, and format all branches nicely |
342 |
self.assertEqual( |
343 |
[('public branch', 'baz'), ('push branch', 'bar'), |
|
344 |
('parent branch', 'foo'), ('submit branch', 'qux')], |
|
|
1551.15.43
by Aaron Bentley
Provide ways of getting at unicode-clean output |
345 |
info._gather_related_branches(branch).locs) |