history.jsp revision 77bb616a49abcd468b37a4416385df92d1f698c6
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<%--
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenCDDL HEADER START
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenThe contents of this file are subject to the terms of the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenCommon Development and Distribution License (the "License").
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenYou may not use this file except in compliance with the License.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenSee LICENSE.txt included in this distribution for the specific
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenlanguage governing permissions and limitations under the License.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenWhen distributing Covered Code, include this CDDL HEADER in each
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenfile and include the License file at LICENSE.txt.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenIf applicable, add the following below this CDDL HEADER, with the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenfields enclosed by brackets "[]" replaced with your own identifying
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Siraineninformation: Portions Copyright [yyyy] [name of copyright owner]
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenCDDL HEADER END
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenCopyright 2005 Sun Microsystems, Inc. All rights reserved.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenUse is subject to license terms.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenident "@(#)history.jsp 1.1 05/11/11 SMI"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen--%><%@ page import = "javax.servlet.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenjava.lang.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenjavax.servlet.http.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenjava.util.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenjava.io.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenjava.text.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenorg.opensolaris.opengrok.analysis.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenorg.opensolaris.opengrok.web.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenorg.opensolaris.opengrok.history.*,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenjava.util.regex.*
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%><%@include file="mast.jsp"%><%
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenif (path.length() > 0 && valid) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen boolean striked = false;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen String userPage = getInitParameter("USER_PAGE");
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen String bugPage = getInitParameter("BUG_PAGE");
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen Pattern bugPattern = Pattern.compile("\\b([12456789][0-9]{6})\\b");
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen Format df = new SimpleDateFormat("dd-MMM-yyyy");
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen Date tstart = new Date();
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen File f = new File(rawSource + path);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen HistoryReader hr = HistoryGuru.getInstance().getHistoryReader(f);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if (hr == null) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen response.sendError(404, "No history");
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen return;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%><form action="<%=context%>/diff<%=path%>">
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<table cellspacing="0" cellpadding="2" border="0" width="100%" class="src">
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<tr><td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td></tr>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<tr class="thead"><%
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainenif(!isDir) {
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen%><td>Revision</td><th><input type="submit" value=" Compare "/></th><%
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen}
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%><td>Date</td><td>Author</td><td>Comments</td></tr><%
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenboolean alt = true;
e06c0b65c16ccce69bbee009ead14d7d3d17a256Timo Sirainenwhile (hr.next()) {
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen String rev = hr.getRevision();
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen alt = !alt;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%><tr valign="top" <%= alt ? "class=\"alt\"" : "" %>><%
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainenif(!isDir) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if(hr.isActive()) {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%><td>&nbsp;<a name="<%=rev%>" href="<%= context +"/xref" + path + "?r=" + rev %>"><%=rev%></a>&nbsp;</td><td align="center"><input type="radio" name="r1" value="<%=rev%>"/>
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen<input type="radio" name="r2" value="<%=rev%>"/></td><%
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen } else {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen striked = true;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen }
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen}
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen%><td><%= df.format(hr.getDate()) %>&nbsp;</td>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<td>
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen<%
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainenif(userPage != null && ! userPage.equals("")) {
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen %><a href="<%= userPage + hr.getAuthor() %>"><%= hr.getAuthor() %></a><%
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen} else {
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen %><%= hr.getAuthor() %><%
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen}
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen%>&nbsp;</td><td><%=
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen(bugPage != null && ! bugPage.equals("")) ?
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen bugPattern.matcher(Util.Htmlize(hr.getComment())).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>")
659fe5d24825b160cae512538088020d97a60239Timo Sirainen : Util.Htmlize(hr.getComment())
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen%><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo SirainenList<String> files = hr.getFiles();
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainenif(files != null) {%><br/><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen for (String ifile : files) {
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen String jfile = ifile;
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen if ("/".equals(path)) {
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen jfile = ifile.substring(1);
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen } else if (ifile.startsWith(path)) {
659fe5d24825b160cae512538088020d97a60239Timo Sirainen jfile = ifile.substring(path.length()+1);
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen }
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen }
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen}
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen%></td></tr><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen}
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen %></table></form><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen hr.close();
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen if(striked) {
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainen %><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen }
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen %><p class="rssbadge"><a href="<%=context%>/rss<%=path%>"><img src="<%=context%>/img/rss.png" width="80" height="15" alt="RSS XML Feed" title="RSS XML Feed of latest changes"/></a></p><%
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen}
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen%><%@include file="foot.jsp"%>
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen