Merge lp:~jelmer/brz/default-is-reference 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/default-is-reference
Merge into: lp:brz
Diff against target: 51 lines (+25/-4)
2 files modified
breezy/tests/per_branch/test_branch.py (+15/-2)
breezy/tests/per_controldir/test_controldir.py (+10/-2)
To merge this branch: bzr merge lp:~jelmer/brz/default-is-reference
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+340929@code.launchpad.net

Commit message

Allow the default branch to be a reference branch.

Description of the change

Allow the default branch to be a reference branch.

This is necessary since Git's HEAD branch (the default branch) is a reference
branch by default.

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

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/per_branch/test_branch.py'
2--- breezy/tests/per_branch/test_branch.py 2018-03-05 21:45:41 +0000
3+++ breezy/tests/per_branch/test_branch.py 2018-03-07 01:22:28 +0000
4@@ -633,9 +633,22 @@
5 # because the default open will not open them and
6 # they may not be initializable.
7 return
8- made_branch = self.make_branch('.')
9+ made_controldir = self.make_controldir('.')
10+ made_controldir.create_repository()
11+ if made_controldir._format.colocated_branches:
12+ # Formats that support colocated branches sometimes have a default
13+ # branch that is a reference branch (such as Git). Cope with
14+ # those by creating a different colocated branch.
15+ name = 'foo'
16+ else:
17+ name = None
18+ try:
19+ made_branch = made_controldir.create_branch(name)
20+ except errors.UninitializableFormat:
21+ raise tests.TestNotApplicable('Uninitializable branch format')
22+
23 self.assertEqual(None,
24- made_branch._format.get_reference(made_branch.controldir))
25+ made_branch._format.get_reference(made_branch.controldir, name))
26
27 def test_set_reference(self):
28 """set_reference on all regular branches should be callable."""
29
30=== modified file 'breezy/tests/per_controldir/test_controldir.py'
31--- breezy/tests/per_controldir/test_controldir.py 2018-03-04 02:57:55 +0000
32+++ breezy/tests/per_controldir/test_controldir.py 2018-03-07 01:22:28 +0000
33@@ -497,8 +497,16 @@
34
35 def test_get_branch_reference_on_non_reference(self):
36 """get_branch_reference should return None for non-reference branches."""
37- branch = self.make_branch('referenced')
38- self.assertEqual(None, branch.controldir.get_branch_reference())
39+ dir = self.make_controldir('referenced')
40+ dir.create_repository()
41+ if dir._format.colocated_branches:
42+ # The default branch in a controldir might be a reference branch
43+ # (e.g. for Git), so let's create another one.
44+ name = 'foo'
45+ else:
46+ name = None
47+ branch = dir.create_branch(name)
48+ self.assertEqual(None, branch.controldir.get_branch_reference(name))
49
50 def test_get_branch_reference_no_branch(self):
51 """get_branch_reference should not mask NotBranchErrors."""

Subscribers

People subscribed via source and target branches