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
1=== modified file 'breezy/builtins.py'
2--- breezy/builtins.py 2018-08-12 23:18:19 +0000
3+++ breezy/builtins.py 2018-09-14 12:13:33 +0000
4@@ -1460,9 +1460,7 @@
5 # RBC 20060209
6 revision_id = br_from.last_revision()
7 if to_location is None:
8- to_location = getattr(br_from, "name", None)
9- if not to_location:
10- to_location = urlutils.derive_to_location(from_location)
11+ to_location = urlutils.derive_to_location(from_location)
12 to_transport = transport.get_transport(to_location)
13 try:
14 to_transport.mkdir('.')
15
16=== modified file 'breezy/tests/blackbox/test_branch.py'
17--- breezy/tests/blackbox/test_branch.py 2018-07-18 19:48:48 +0000
18+++ breezy/tests/blackbox/test_branch.py 2018-09-14 12:13:33 +0000
19@@ -98,13 +98,14 @@
20
21 def test_from_colocated(self):
22 """Branch from a colocated branch into a regular branch."""
23- tree = self.example_branch('a', format='development-colo')
24+ os.mkdir('b')
25+ tree = self.example_branch('b/a', format='development-colo')
26 tree.controldir.create_branch(name='somecolo')
27 out, err = self.run_bzr('branch %s,branch=somecolo' %
28- local_path_to_url('a'))
29+ local_path_to_url('b/a'))
30 self.assertEqual('', out)
31 self.assertEqual('Branched 0 revisions.\n', err)
32- self.assertPathExists("somecolo")
33+ self.assertPathExists('a')
34
35 def test_branch_broken_pack(self):
36 """branching with a corrupted pack file."""
37
38=== modified file 'breezy/urlutils.py'
39--- breezy/urlutils.py 2018-09-13 12:50:28 +0000
40+++ breezy/urlutils.py 2018-09-14 12:13:33 +0000
41@@ -811,6 +811,7 @@
42 is used without a path, e.g. c:foo-bar => foo-bar.
43 If no /, path separator or : is found, the from_location is returned.
44 """
45+ from_location, unused_params = split_segment_parameters(from_location)
46 if from_location.find("/") >= 0 or from_location.find(os.sep) >= 0:
47 return os.path.basename(from_location.rstrip("/\\"))
48 else:

Subscribers

People subscribed via source and target branches