← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Tom Wardill has proposed merging ~twom/launchpad:friendly-git-ref-names into launchpad:master.

Commit message:
Make target branch a more friendly name

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/380300

Remove the refs/heads from the start of the default target name as it looks a bit unfriendly.
Use the same method as GitRefMixin.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:friendly-git-ref-names into launchpad:master.
diff --git a/lib/lp/code/browser/gitref.py b/lib/lp/code/browser/gitref.py
index edbb0bf..99d4882 100644
--- a/lib/lp/code/browser/gitref.py
+++ b/lib/lp/code/browser/gitref.py
@@ -287,8 +287,10 @@ class GitRefRegisterMergeProposalView(LaunchpadFormView):
             None)
         # If we have a target, and the user hasn't entered a value.
         if term and not self.widgets['target_git_path'].hasInput():
-            self.widgets['target_git_path'].setRenderedValue(
-                term.value.default_branch)
+            branch_display = term.value.default_branch
+            if branch_display.startswith("refs/heads/"):
+                branch_display = branch_display[len("refs/heads/"):]
+            self.widgets['target_git_path'].setRenderedValue(branch_display)
 
     @action('Propose Merge', name='register',
             failure=LaunchpadFormView.ajax_failure_handler)