Merge ~twom/launchpad:friendly-git-ref-names into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 9b3d025f30f2088fb011124bde4ed8f99ad25b79
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:friendly-git-ref-names
Merge into: launchpad:master
Diff against target: 26 lines (+2/-2)
2 files modified
lib/lp/code/browser/gitref.py (+1/-1)
lib/lp/code/browser/tests/test_branchmergeproposal.py (+1/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+380302@code.launchpad.net

Commit message

Fix failures in friendly git ref names

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/browser/gitref.py b/lib/lp/code/browser/gitref.py
2index 99d4882..25021bc 100644
3--- a/lib/lp/code/browser/gitref.py
4+++ b/lib/lp/code/browser/gitref.py
5@@ -288,7 +288,7 @@ class GitRefRegisterMergeProposalView(LaunchpadFormView):
6 # If we have a target, and the user hasn't entered a value.
7 if term and not self.widgets['target_git_path'].hasInput():
8 branch_display = term.value.default_branch
9- if branch_display.startswith("refs/heads/"):
10+ if branch_display and branch_display.startswith("refs/heads/"):
11 branch_display = branch_display[len("refs/heads/"):]
12 self.widgets['target_git_path'].setRenderedValue(branch_display)
13
14diff --git a/lib/lp/code/browser/tests/test_branchmergeproposal.py b/lib/lp/code/browser/tests/test_branchmergeproposal.py
15index 2e3055a..e42a9c5 100644
16--- a/lib/lp/code/browser/tests/test_branchmergeproposal.py
17+++ b/lib/lp/code/browser/tests/test_branchmergeproposal.py
18@@ -869,7 +869,7 @@ class TestRegisterBranchMergeProposalViewGit(
19 target_branch.repository)._default_branch = target_branch.path
20 view = self._createView()
21 self.assertEqual(
22- target_branch.repository.default_branch,
23+ target_branch.repository.default_branch.split('/')[-1],
24 view.widgets['target_git_path']._getCurrentValue())
25
26 def test_default_branch_no_default_set(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: