Merge lp:~jelmer/brz/user-url into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/user-url
Merge into: lp:brz
Prerequisite: lp:~jelmer/brz/lock-breaking
Diff against target: 212 lines (+22/-25)
12 files modified
breezy/branch.py (+1/-1)
breezy/info.py (+2/-2)
breezy/tests/blackbox/test_branch.py (+1/-1)
breezy/tests/blackbox/test_init.py (+1/-1)
breezy/tests/per_branch/test_branch.py (+2/-5)
breezy/tests/per_branch/test_http.py (+1/-1)
breezy/tests/per_branch/test_sprout.py (+1/-1)
breezy/tests/per_controldir/test_controldir.py (+4/-6)
breezy/tests/per_controldir_colo/test_supported.py (+2/-2)
breezy/tests/per_interbranch/test_pull.py (+6/-1)
breezy/tests/per_workingtree/test_smart_add.py (+1/-1)
breezy/tests/per_workingtree/test_workingtree.py (+0/-3)
To merge this branch: bzr merge lp:~jelmer/brz/user-url
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+340567@code.launchpad.net

Commit message

Consistently use Branch.user_url when referring to branch location.

Description of the change

Consistently use Branch.user_url when referring to branch location.

Previously, some code assumed that the branches' control directory's transport base would be at the same location, but that is not necessarily true in git.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Looks good.

review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Running landing tests failed
https://ci.breezy-vcs.org/job/brz-dev/4/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/branch.py'
2--- breezy/branch.py 2018-03-01 05:46:59 +0000
3+++ breezy/branch.py 2018-03-04 17:01:53 +0000
4@@ -1245,7 +1245,7 @@
5 self.copy_content_into(result, revision_id=revision_id)
6 master_url = self.get_bound_location()
7 if master_url is None:
8- result.set_parent(self.controldir.root_transport.base)
9+ result.set_parent(self.user_url)
10 else:
11 result.set_parent(master_url)
12 return result
13
14=== modified file 'breezy/info.py'
15--- breezy/info.py 2017-07-24 01:09:25 +0000
16+++ breezy/info.py 2018-03-04 17:01:53 +0000
17@@ -469,8 +469,8 @@
18 if branch is None and tree is not None:
19 phrase = "branchless tree"
20 else:
21- if (tree is not None and tree.user_url !=
22- branch.user_url):
23+ if (tree is not None and tree.controldir.control_url !=
24+ branch.controldir.control_url):
25 independence = ''
26 phrase = "Lightweight checkout"
27 elif branch.get_bound_location() is not None:
28
29=== modified file 'breezy/tests/blackbox/test_branch.py'
30--- breezy/tests/blackbox/test_branch.py 2017-11-12 13:53:51 +0000
31+++ breezy/tests/blackbox/test_branch.py 2018-03-04 17:01:53 +0000
32@@ -81,7 +81,7 @@
33 out, err = self.run_bzr(
34 'init --format=development-colo file:b,branch=orig')
35 self.assertEqual(
36- """Created a lightweight checkout (format: development-colo)\n""",
37+ """Created a standalone tree (format: development-colo)\n""",
38 out)
39 self.assertEqual('', err)
40 out, err = self.run_bzr(
41
42=== modified file 'breezy/tests/blackbox/test_init.py'
43--- breezy/tests/blackbox/test_init.py 2017-06-19 20:34:29 +0000
44+++ breezy/tests/blackbox/test_init.py 2018-03-04 17:01:53 +0000
45@@ -57,7 +57,7 @@
46 def test_init_colocated(self):
47 """Smoke test for constructing a colocated branch."""
48 out, err = self.run_bzr('init --format=development-colo file:,branch=abranch')
49- self.assertEqual("""Created a lightweight checkout (format: development-colo)\n""",
50+ self.assertEqual("""Created a standalone tree (format: development-colo)\n""",
51 out)
52 self.assertEqual('', err)
53 out, err = self.run_bzr('branches')
54
55=== modified file 'breezy/tests/per_branch/test_branch.py'
56--- breezy/tests/per_branch/test_branch.py 2018-02-03 13:39:29 +0000
57+++ breezy/tests/per_branch/test_branch.py 2018-03-04 17:01:53 +0000
58@@ -162,7 +162,7 @@
59 rev1 = wt_a.commit('commit one')
60
61 branch_b = wt_a.branch.controldir.sprout('b', revision_id=rev1).open_branch()
62- self.assertEqual(wt_a.branch.base, branch_b.get_parent())
63+ self.assertEqual(wt_a.branch.user_url, branch_b.get_parent())
64 return branch_b
65
66 def test_clone_branch_nickname(self):
67@@ -649,7 +649,7 @@
68 pass
69 else:
70 ref = this_branch._format.get_reference(this_branch.controldir)
71- self.assertEqual(ref, other_branch.base)
72+ self.assertEqual(ref, other_branch.user_url)
73
74 def test_format_initialize_find_open(self):
75 # loopback test to check the current format initializes to itself.
76@@ -1022,9 +1022,6 @@
77 br = self.make_branch('branch')
78 self.assertIsInstance(br.user_url, str)
79 self.assertEqual(br.user_url, br.user_transport.base)
80- # for all current bzrdir implementations the user dir must be
81- # above the control dir but we might need to relax that?
82- self.assertEqual(br.control_url.find(br.user_url), 0)
83 self.assertEqual(br.control_url, br.control_transport.base)
84
85
86
87=== modified file 'breezy/tests/per_branch/test_http.py'
88--- breezy/tests/per_branch/test_http.py 2017-06-10 00:17:06 +0000
89+++ breezy/tests/per_branch/test_http.py 2018-03-04 17:01:53 +0000
90@@ -75,4 +75,4 @@
91 # from, even if that branch has an invalid parent.
92 branch_b = self.get_branch_with_invalid_parent()
93 branch_c = branch_b.controldir.sprout('c').open_branch()
94- self.assertEqual(branch_b.base, branch_c.get_parent())
95+ self.assertEqual(branch_b.user_url, branch_c.get_parent())
96
97=== modified file 'breezy/tests/per_branch/test_sprout.py'
98--- breezy/tests/per_branch/test_sprout.py 2017-11-12 20:07:32 +0000
99+++ breezy/tests/per_branch/test_sprout.py 2018-03-04 17:01:53 +0000
100@@ -43,7 +43,7 @@
101 def test_sprout_branch_parent(self):
102 source = self.make_branch('source')
103 target = source.controldir.sprout(self.get_url('target')).open_branch()
104- self.assertEqual(source.controldir.root_transport.base, target.get_parent())
105+ self.assertEqual(source.user_url, target.get_parent())
106
107 def test_sprout_uses_bzrdir_branch_format(self):
108 # branch.sprout(bzrdir) is defined as using the branch format selected
109
110=== modified file 'breezy/tests/per_controldir/test_controldir.py'
111--- breezy/tests/per_controldir/test_controldir.py 2018-03-03 13:27:25 +0000
112+++ breezy/tests/per_controldir/test_controldir.py 2018-03-04 17:01:53 +0000
113@@ -450,9 +450,7 @@
114 # this is ok too, not all formats have to support references.
115 raise TestNotApplicable("control directory does not "
116 "support branch references")
117- self.assertEqual(
118- referenced_branch.controldir.root_transport.abspath('') + '/',
119- dir.get_branch_reference())
120+ self.assertEqual(referenced_branch.user_url, dir.get_branch_reference())
121
122 def test_set_branch_reference_on_existing_reference(self):
123 """set_branch_reference creates a branch reference"""
124@@ -467,7 +465,7 @@
125 "support branch references")
126 reference = dir.set_branch_reference(referenced_branch2)
127 self.assertEqual(
128- referenced_branch2.controldir.root_transport.abspath('') + '/',
129+ referenced_branch2.user_url,
130 dir.get_branch_reference())
131
132 def test_set_branch_reference_on_existing_branch(self):
133@@ -481,7 +479,7 @@
134 raise TestNotApplicable("control directory does not "
135 "support branch references")
136 self.assertEqual(
137- referenced_branch.controldir.root_transport.abspath('') + '/',
138+ referenced_branch.user_url,
139 dir.get_branch_reference())
140
141 def test_get_branch_reference_on_reference(self):
142@@ -494,7 +492,7 @@
143 # this is ok too, not all formats have to support references.
144 raise TestNotApplicable("control directory does not "
145 "support branch references")
146- self.assertEqual(referenced_branch.controldir.root_transport.abspath('') + '/',
147+ self.assertEqual(referenced_branch.user_url,
148 dir.get_branch_reference())
149
150 def test_get_branch_reference_on_non_reference(self):
151
152=== modified file 'breezy/tests/per_controldir_colo/test_supported.py'
153--- breezy/tests/per_controldir_colo/test_supported.py 2017-06-10 00:52:08 +0000
154+++ breezy/tests/per_controldir_colo/test_supported.py 2018-03-04 17:01:53 +0000
155@@ -154,5 +154,5 @@
156 except errors.IncompatibleFormat:
157 raise tests.TestNotApplicable(
158 'Control dir does not support creating branch references.')
159- self.assertEqual(referenced.base,
160- repo.controldir.get_branch_reference('foo'))
161+ self.assertEqual(referenced.user_url,
162+ repo.controldir.get_branch_reference('foo'))
163
164=== modified file 'breezy/tests/per_interbranch/test_pull.py'
165--- breezy/tests/per_interbranch/test_pull.py 2018-03-01 00:15:57 +0000
166+++ breezy/tests/per_interbranch/test_pull.py 2018-03-04 17:01:53 +0000
167@@ -21,6 +21,7 @@
168 from breezy import errors
169 from breezy.memorytree import MemoryTree
170 from breezy.revision import NULL_REVISION
171+from breezy.tests import TestNotApplicable
172 from breezy.tests.per_interbranch import TestCaseWithInterBranch
173
174
175@@ -77,7 +78,11 @@
176 other = self.sprout_to(master_tree.branch.controldir, 'other').open_branch()
177 # move the branch out of the way on disk to cause a connection
178 # error.
179- master_tree.branch.controldir.destroy_branch()
180+ try:
181+ master_tree.branch.controldir.destroy_branch()
182+ except errors.UnsupportedOperation:
183+ raise TestNotApplicable(
184+ 'control format does not support destroying default branch')
185 # try to pull, which should raise a BoundBranchConnectionFailure.
186 self.assertRaises(errors.BoundBranchConnectionFailure,
187 checkout.branch.pull, other)
188
189=== modified file 'breezy/tests/per_workingtree/test_smart_add.py'
190--- breezy/tests/per_workingtree/test_smart_add.py 2018-02-26 13:36:15 +0000
191+++ breezy/tests/per_workingtree/test_smart_add.py 2018-03-04 17:01:53 +0000
192@@ -138,7 +138,7 @@
193
194 self.build_tree(build_paths)
195 wt = self.make_branch_and_tree('.')
196- if wt.user_url != wt.branch.user_url:
197+ if wt.controldir.user_url != wt.branch.controldir.user_url:
198 # Lightweight checkout, make sure we have a repo location.
199 wt.branch.controldir.root_transport.mkdir('original')
200 child_tree = self.make_branch_and_tree('original/child')
201
202=== modified file 'breezy/tests/per_workingtree/test_workingtree.py'
203--- breezy/tests/per_workingtree/test_workingtree.py 2018-03-02 01:33:39 +0000
204+++ breezy/tests/per_workingtree/test_workingtree.py 2018-03-04 17:01:53 +0000
205@@ -1233,9 +1233,6 @@
206 wt = self.make_branch_and_tree('wt')
207 self.assertIsInstance(wt.user_url, str)
208 self.assertEqual(wt.user_url, wt.user_transport.base)
209- # for all current bzrdir implementations the user dir must be
210- # above the control dir but we might need to relax that?
211- self.assertEqual(wt.control_url.find(wt.user_url), 0)
212 self.assertEqual(wt.control_url, wt.control_transport.base)
213
214

Subscribers

People subscribed via source and target branches