From 51c76e7366c2e8851f1639fbdbf2b8deb219c7fc Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 24 May 2013 17:38:12 -0400
Subject: [PATCH] Added support for displaying refs/pull/n/head|merge

---
 src/main/resources/gitblit.css                         |   11 ++++++++---
 src/main/java/com/gitblit/wicket/panels/RefsPanel.java |   10 ++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/gitblit/wicket/panels/RefsPanel.java b/src/main/java/com/gitblit/wicket/panels/RefsPanel.java
index 5776a13..dc852e2 100644
--- a/src/main/java/com/gitblit/wicket/panels/RefsPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/RefsPanel.java
@@ -43,6 +43,8 @@
 	private static final long serialVersionUID = 1L;
 	
 	private static final String R_CHANGES = "refs/changes/";
+	
+	private static final String R_PULL= "refs/pull/";
 
 	public RefsPanel(String id, final String repositoryName, RevCommit c,
 			Map<ObjectId, List<RefModel>> refs) {
@@ -114,6 +116,14 @@
 					// Gerrit change ref
 					name = name.substring(R_CHANGES.length());
 					cssClass = "otherRef";
+				} else if (name.startsWith(R_PULL)) {
+					// Pull Request ref
+					name = "pull #" + name.substring(R_PULL.length());
+					if (name.endsWith("/head")) {
+						// strip pull request head from name 
+						name = name.substring(0, name.length() - "/head".length());
+					}
+					cssClass = "pullRef";
 				} else if (name.startsWith(Constants.R_REMOTES)) {
 					// remote branch
 					linkClass = LogPage.class;
diff --git a/src/main/resources/gitblit.css b/src/main/resources/gitblit.css
index 0a1c3b0..9ee0a73 100644
--- a/src/main/resources/gitblit.css
+++ b/src/main/resources/gitblit.css
@@ -1266,7 +1266,7 @@
 	font-size: 2em;
 }
 
-.tagRef, .headRef, .localBranch, .remoteBranch, .otherRef {	
+.tagRef, .headRef, .localBranch, .remoteBranch, .otherRef, .pullRef {	
 	padding: 0px 3px;
 	margin-right:2px;
 	font-family: sans-serif;
@@ -1276,13 +1276,13 @@
 	color: black;	
 }
 
-.tagRef a, .headRef a, .localBranch a, .remoteBranch a, .otherRef a {
+.tagRef a, .headRef a, .localBranch a, .remoteBranch a, .otherRef a, .pullRef a {
 	font-size: 9px;
 	text-decoration: none;
 	color: black !important;
 }
 
-.tagRef a:hover, .headRef a:hover, .localBranch a:hover, .remoteBranch a:hover, .otherRef a:hover {
+.tagRef a:hover, .headRef a:hover, .localBranch a:hover, .remoteBranch a:hover, .otherRef a:hover, .pullRef a:hover {
 	color: black !important;
 	text-decoration: underline;
 }
@@ -1292,6 +1292,11 @@
 	border-color: #80aaaa;	
 }
 
+.pullRef {
+	background-color: rgb(255, 221, 136);
+	border-color: rgb(136, 136, 136);
+}
+
 .remoteBranch {
 	background-color: #cAc2f5;
 	border-color: #6c6cbf;

--
Gitblit v1.9.1