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

Proposed by Jelmer Vernooij on 2018-03-04
Status: Merged
Approved by: Jelmer Vernooij on 2018-03-04
Approved revision: 6877
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 2018-03-04 Approve on 2018-03-04
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.
Martin Packman (gz) wrote :

Looks good.

review: Approve
The Breezy Bot (the-breezy-bot) wrote :

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

lp:~jelmer/brz/user-url updated on 2018-03-04
6877. By Jelmer Vernooij on 2018-03-04

Fix format names.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/branch.py'
--- breezy/branch.py 2018-03-01 05:46:59 +0000
+++ breezy/branch.py 2018-03-04 17:01:53 +0000
@@ -1245,7 +1245,7 @@
1245 self.copy_content_into(result, revision_id=revision_id)1245 self.copy_content_into(result, revision_id=revision_id)
1246 master_url = self.get_bound_location()1246 master_url = self.get_bound_location()
1247 if master_url is None:1247 if master_url is None:
1248 result.set_parent(self.controldir.root_transport.base)1248 result.set_parent(self.user_url)
1249 else:1249 else:
1250 result.set_parent(master_url)1250 result.set_parent(master_url)
1251 return result1251 return result
12521252
=== modified file 'breezy/info.py'
--- breezy/info.py 2017-07-24 01:09:25 +0000
+++ breezy/info.py 2018-03-04 17:01:53 +0000
@@ -469,8 +469,8 @@
469 if branch is None and tree is not None:469 if branch is None and tree is not None:
470 phrase = "branchless tree"470 phrase = "branchless tree"
471 else:471 else:
472 if (tree is not None and tree.user_url !=472 if (tree is not None and tree.controldir.control_url !=
473 branch.user_url):473 branch.controldir.control_url):
474 independence = ''474 independence = ''
475 phrase = "Lightweight checkout"475 phrase = "Lightweight checkout"
476 elif branch.get_bound_location() is not None:476 elif branch.get_bound_location() is not None:
477477
=== modified file 'breezy/tests/blackbox/test_branch.py'
--- breezy/tests/blackbox/test_branch.py 2017-11-12 13:53:51 +0000
+++ breezy/tests/blackbox/test_branch.py 2018-03-04 17:01:53 +0000
@@ -81,7 +81,7 @@
81 out, err = self.run_bzr(81 out, err = self.run_bzr(
82 'init --format=development-colo file:b,branch=orig')82 'init --format=development-colo file:b,branch=orig')
83 self.assertEqual(83 self.assertEqual(
84 """Created a lightweight checkout (format: development-colo)\n""",84 """Created a standalone tree (format: development-colo)\n""",
85 out)85 out)
86 self.assertEqual('', err)86 self.assertEqual('', err)
87 out, err = self.run_bzr(87 out, err = self.run_bzr(
8888
=== modified file 'breezy/tests/blackbox/test_init.py'
--- breezy/tests/blackbox/test_init.py 2017-06-19 20:34:29 +0000
+++ breezy/tests/blackbox/test_init.py 2018-03-04 17:01:53 +0000
@@ -57,7 +57,7 @@
57 def test_init_colocated(self):57 def test_init_colocated(self):
58 """Smoke test for constructing a colocated branch."""58 """Smoke test for constructing a colocated branch."""
59 out, err = self.run_bzr('init --format=development-colo file:,branch=abranch')59 out, err = self.run_bzr('init --format=development-colo file:,branch=abranch')
60 self.assertEqual("""Created a lightweight checkout (format: development-colo)\n""",60 self.assertEqual("""Created a standalone tree (format: development-colo)\n""",
61 out)61 out)
62 self.assertEqual('', err)62 self.assertEqual('', err)
63 out, err = self.run_bzr('branches')63 out, err = self.run_bzr('branches')
6464
=== modified file 'breezy/tests/per_branch/test_branch.py'
--- breezy/tests/per_branch/test_branch.py 2018-02-03 13:39:29 +0000
+++ breezy/tests/per_branch/test_branch.py 2018-03-04 17:01:53 +0000
@@ -162,7 +162,7 @@
162 rev1 = wt_a.commit('commit one')162 rev1 = wt_a.commit('commit one')
163163
164 branch_b = wt_a.branch.controldir.sprout('b', revision_id=rev1).open_branch()164 branch_b = wt_a.branch.controldir.sprout('b', revision_id=rev1).open_branch()
165 self.assertEqual(wt_a.branch.base, branch_b.get_parent())165 self.assertEqual(wt_a.branch.user_url, branch_b.get_parent())
166 return branch_b166 return branch_b
167167
168 def test_clone_branch_nickname(self):168 def test_clone_branch_nickname(self):
@@ -649,7 +649,7 @@
649 pass649 pass
650 else:650 else:
651 ref = this_branch._format.get_reference(this_branch.controldir)651 ref = this_branch._format.get_reference(this_branch.controldir)
652 self.assertEqual(ref, other_branch.base)652 self.assertEqual(ref, other_branch.user_url)
653653
654 def test_format_initialize_find_open(self):654 def test_format_initialize_find_open(self):
655 # loopback test to check the current format initializes to itself.655 # loopback test to check the current format initializes to itself.
@@ -1022,9 +1022,6 @@
1022 br = self.make_branch('branch')1022 br = self.make_branch('branch')
1023 self.assertIsInstance(br.user_url, str)1023 self.assertIsInstance(br.user_url, str)
1024 self.assertEqual(br.user_url, br.user_transport.base)1024 self.assertEqual(br.user_url, br.user_transport.base)
1025 # for all current bzrdir implementations the user dir must be
1026 # above the control dir but we might need to relax that?
1027 self.assertEqual(br.control_url.find(br.user_url), 0)
1028 self.assertEqual(br.control_url, br.control_transport.base)1025 self.assertEqual(br.control_url, br.control_transport.base)
10291026
10301027
10311028
=== modified file 'breezy/tests/per_branch/test_http.py'
--- breezy/tests/per_branch/test_http.py 2017-06-10 00:17:06 +0000
+++ breezy/tests/per_branch/test_http.py 2018-03-04 17:01:53 +0000
@@ -75,4 +75,4 @@
75 # from, even if that branch has an invalid parent.75 # from, even if that branch has an invalid parent.
76 branch_b = self.get_branch_with_invalid_parent()76 branch_b = self.get_branch_with_invalid_parent()
77 branch_c = branch_b.controldir.sprout('c').open_branch()77 branch_c = branch_b.controldir.sprout('c').open_branch()
78 self.assertEqual(branch_b.base, branch_c.get_parent())78 self.assertEqual(branch_b.user_url, branch_c.get_parent())
7979
=== modified file 'breezy/tests/per_branch/test_sprout.py'
--- breezy/tests/per_branch/test_sprout.py 2017-11-12 20:07:32 +0000
+++ breezy/tests/per_branch/test_sprout.py 2018-03-04 17:01:53 +0000
@@ -43,7 +43,7 @@
43 def test_sprout_branch_parent(self):43 def test_sprout_branch_parent(self):
44 source = self.make_branch('source')44 source = self.make_branch('source')
45 target = source.controldir.sprout(self.get_url('target')).open_branch()45 target = source.controldir.sprout(self.get_url('target')).open_branch()
46 self.assertEqual(source.controldir.root_transport.base, target.get_parent())46 self.assertEqual(source.user_url, target.get_parent())
4747
48 def test_sprout_uses_bzrdir_branch_format(self):48 def test_sprout_uses_bzrdir_branch_format(self):
49 # branch.sprout(bzrdir) is defined as using the branch format selected49 # branch.sprout(bzrdir) is defined as using the branch format selected
5050
=== modified file 'breezy/tests/per_controldir/test_controldir.py'
--- breezy/tests/per_controldir/test_controldir.py 2018-03-03 13:27:25 +0000
+++ breezy/tests/per_controldir/test_controldir.py 2018-03-04 17:01:53 +0000
@@ -450,9 +450,7 @@
450 # this is ok too, not all formats have to support references.450 # this is ok too, not all formats have to support references.
451 raise TestNotApplicable("control directory does not "451 raise TestNotApplicable("control directory does not "
452 "support branch references")452 "support branch references")
453 self.assertEqual(453 self.assertEqual(referenced_branch.user_url, dir.get_branch_reference())
454 referenced_branch.controldir.root_transport.abspath('') + '/',
455 dir.get_branch_reference())
456454
457 def test_set_branch_reference_on_existing_reference(self):455 def test_set_branch_reference_on_existing_reference(self):
458 """set_branch_reference creates a branch reference"""456 """set_branch_reference creates a branch reference"""
@@ -467,7 +465,7 @@
467 "support branch references")465 "support branch references")
468 reference = dir.set_branch_reference(referenced_branch2)466 reference = dir.set_branch_reference(referenced_branch2)
469 self.assertEqual(467 self.assertEqual(
470 referenced_branch2.controldir.root_transport.abspath('') + '/',468 referenced_branch2.user_url,
471 dir.get_branch_reference())469 dir.get_branch_reference())
472470
473 def test_set_branch_reference_on_existing_branch(self):471 def test_set_branch_reference_on_existing_branch(self):
@@ -481,7 +479,7 @@
481 raise TestNotApplicable("control directory does not "479 raise TestNotApplicable("control directory does not "
482 "support branch references")480 "support branch references")
483 self.assertEqual(481 self.assertEqual(
484 referenced_branch.controldir.root_transport.abspath('') + '/',482 referenced_branch.user_url,
485 dir.get_branch_reference())483 dir.get_branch_reference())
486484
487 def test_get_branch_reference_on_reference(self):485 def test_get_branch_reference_on_reference(self):
@@ -494,7 +492,7 @@
494 # this is ok too, not all formats have to support references.492 # this is ok too, not all formats have to support references.
495 raise TestNotApplicable("control directory does not "493 raise TestNotApplicable("control directory does not "
496 "support branch references")494 "support branch references")
497 self.assertEqual(referenced_branch.controldir.root_transport.abspath('') + '/',495 self.assertEqual(referenced_branch.user_url,
498 dir.get_branch_reference())496 dir.get_branch_reference())
499497
500 def test_get_branch_reference_on_non_reference(self):498 def test_get_branch_reference_on_non_reference(self):
501499
=== modified file 'breezy/tests/per_controldir_colo/test_supported.py'
--- breezy/tests/per_controldir_colo/test_supported.py 2017-06-10 00:52:08 +0000
+++ breezy/tests/per_controldir_colo/test_supported.py 2018-03-04 17:01:53 +0000
@@ -154,5 +154,5 @@
154 except errors.IncompatibleFormat:154 except errors.IncompatibleFormat:
155 raise tests.TestNotApplicable(155 raise tests.TestNotApplicable(
156 'Control dir does not support creating branch references.')156 'Control dir does not support creating branch references.')
157 self.assertEqual(referenced.base,157 self.assertEqual(referenced.user_url,
158 repo.controldir.get_branch_reference('foo'))158 repo.controldir.get_branch_reference('foo'))
159159
=== modified file 'breezy/tests/per_interbranch/test_pull.py'
--- breezy/tests/per_interbranch/test_pull.py 2018-03-01 00:15:57 +0000
+++ breezy/tests/per_interbranch/test_pull.py 2018-03-04 17:01:53 +0000
@@ -21,6 +21,7 @@
21from breezy import errors21from breezy import errors
22from breezy.memorytree import MemoryTree22from breezy.memorytree import MemoryTree
23from breezy.revision import NULL_REVISION23from breezy.revision import NULL_REVISION
24from breezy.tests import TestNotApplicable
24from breezy.tests.per_interbranch import TestCaseWithInterBranch25from breezy.tests.per_interbranch import TestCaseWithInterBranch
2526
2627
@@ -77,7 +78,11 @@
77 other = self.sprout_to(master_tree.branch.controldir, 'other').open_branch()78 other = self.sprout_to(master_tree.branch.controldir, 'other').open_branch()
78 # move the branch out of the way on disk to cause a connection79 # move the branch out of the way on disk to cause a connection
79 # error.80 # error.
80 master_tree.branch.controldir.destroy_branch()81 try:
82 master_tree.branch.controldir.destroy_branch()
83 except errors.UnsupportedOperation:
84 raise TestNotApplicable(
85 'control format does not support destroying default branch')
81 # try to pull, which should raise a BoundBranchConnectionFailure.86 # try to pull, which should raise a BoundBranchConnectionFailure.
82 self.assertRaises(errors.BoundBranchConnectionFailure,87 self.assertRaises(errors.BoundBranchConnectionFailure,
83 checkout.branch.pull, other)88 checkout.branch.pull, other)
8489
=== modified file 'breezy/tests/per_workingtree/test_smart_add.py'
--- breezy/tests/per_workingtree/test_smart_add.py 2018-02-26 13:36:15 +0000
+++ breezy/tests/per_workingtree/test_smart_add.py 2018-03-04 17:01:53 +0000
@@ -138,7 +138,7 @@
138138
139 self.build_tree(build_paths)139 self.build_tree(build_paths)
140 wt = self.make_branch_and_tree('.')140 wt = self.make_branch_and_tree('.')
141 if wt.user_url != wt.branch.user_url:141 if wt.controldir.user_url != wt.branch.controldir.user_url:
142 # Lightweight checkout, make sure we have a repo location.142 # Lightweight checkout, make sure we have a repo location.
143 wt.branch.controldir.root_transport.mkdir('original')143 wt.branch.controldir.root_transport.mkdir('original')
144 child_tree = self.make_branch_and_tree('original/child')144 child_tree = self.make_branch_and_tree('original/child')
145145
=== modified file 'breezy/tests/per_workingtree/test_workingtree.py'
--- breezy/tests/per_workingtree/test_workingtree.py 2018-03-02 01:33:39 +0000
+++ breezy/tests/per_workingtree/test_workingtree.py 2018-03-04 17:01:53 +0000
@@ -1233,9 +1233,6 @@
1233 wt = self.make_branch_and_tree('wt')1233 wt = self.make_branch_and_tree('wt')
1234 self.assertIsInstance(wt.user_url, str)1234 self.assertIsInstance(wt.user_url, str)
1235 self.assertEqual(wt.user_url, wt.user_transport.base)1235 self.assertEqual(wt.user_url, wt.user_transport.base)
1236 # for all current bzrdir implementations the user dir must be
1237 # above the control dir but we might need to relax that?
1238 self.assertEqual(wt.control_url.find(wt.user_url), 0)
1239 self.assertEqual(wt.control_url, wt.control_transport.base)1236 self.assertEqual(wt.control_url, wt.control_transport.base)
12401237
12411238

Subscribers

People subscribed via source and target branches