Merge lp:~jelmer/brz/no-colo-name into lp:brz

Proposed by Jelmer Vernooij on 2018-09-14
Status: Merged
Approved by: Jelmer Vernooij on 2018-09-14
Approved revision: 7112
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/no-colo-name
Merge into: lp:brz
Diff against target: 48 lines (+6/-6)
3 files modified
breezy/builtins.py (+1/-3)
breezy/tests/blackbox/test_branch.py (+4/-3)
breezy/urlutils.py (+1/-0)
To merge this branch: bzr merge lp:~jelmer/brz/no-colo-name
Reviewer Review Type Date Requested Status
Martin Packman 2018-09-14 Approve on 2018-09-14
Review via email: mp+354946@code.launchpad.net

Commit message

Don't use colocated branch names for derived branch directory names.

Description of the change

When running "bzr branch http://blah/blah", don't use the remote's colocated branch name to derived the local control dir name.

This is a bad idea for a couple of reasons:
 * unpredictable
 * most of the time, the remote's name is going to be "master" anyway

Instead, just derive the local name from the last part of the remote URL, as we do when there are no colocated branches involved.

To post a comment you must log in.
Martin Packman (gz) wrote :

Makes sense.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/builtins.py'
--- breezy/builtins.py 2018-08-12 23:18:19 +0000
+++ breezy/builtins.py 2018-09-14 12:13:33 +0000
@@ -1460,9 +1460,7 @@
1460 # RBC 200602091460 # RBC 20060209
1461 revision_id = br_from.last_revision()1461 revision_id = br_from.last_revision()
1462 if to_location is None:1462 if to_location is None:
1463 to_location = getattr(br_from, "name", None)1463 to_location = urlutils.derive_to_location(from_location)
1464 if not to_location:
1465 to_location = urlutils.derive_to_location(from_location)
1466 to_transport = transport.get_transport(to_location)1464 to_transport = transport.get_transport(to_location)
1467 try:1465 try:
1468 to_transport.mkdir('.')1466 to_transport.mkdir('.')
14691467
=== modified file 'breezy/tests/blackbox/test_branch.py'
--- breezy/tests/blackbox/test_branch.py 2018-07-18 19:48:48 +0000
+++ breezy/tests/blackbox/test_branch.py 2018-09-14 12:13:33 +0000
@@ -98,13 +98,14 @@
9898
99 def test_from_colocated(self):99 def test_from_colocated(self):
100 """Branch from a colocated branch into a regular branch."""100 """Branch from a colocated branch into a regular branch."""
101 tree = self.example_branch('a', format='development-colo')101 os.mkdir('b')
102 tree = self.example_branch('b/a', format='development-colo')
102 tree.controldir.create_branch(name='somecolo')103 tree.controldir.create_branch(name='somecolo')
103 out, err = self.run_bzr('branch %s,branch=somecolo' %104 out, err = self.run_bzr('branch %s,branch=somecolo' %
104 local_path_to_url('a'))105 local_path_to_url('b/a'))
105 self.assertEqual('', out)106 self.assertEqual('', out)
106 self.assertEqual('Branched 0 revisions.\n', err)107 self.assertEqual('Branched 0 revisions.\n', err)
107 self.assertPathExists("somecolo")108 self.assertPathExists('a')
108109
109 def test_branch_broken_pack(self):110 def test_branch_broken_pack(self):
110 """branching with a corrupted pack file."""111 """branching with a corrupted pack file."""
111112
=== modified file 'breezy/urlutils.py'
--- breezy/urlutils.py 2018-09-13 12:50:28 +0000
+++ breezy/urlutils.py 2018-09-14 12:13:33 +0000
@@ -811,6 +811,7 @@
811 is used without a path, e.g. c:foo-bar => foo-bar.811 is used without a path, e.g. c:foo-bar => foo-bar.
812 If no /, path separator or : is found, the from_location is returned.812 If no /, path separator or : is found, the from_location is returned.
813 """813 """
814 from_location, unused_params = split_segment_parameters(from_location)
814 if from_location.find("/") >= 0 or from_location.find(os.sep) >= 0:815 if from_location.find("/") >= 0 or from_location.find(os.sep) >= 0:
815 return os.path.basename(from_location.rstrip("/\\"))816 return os.path.basename(from_location.rstrip("/\\"))
816 else:817 else:

Subscribers

People subscribed via source and target branches