diff.jsp revision 55ca23edd10d48a1f4683d6071955db3683a3b69
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<%--
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync$Id$
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCDDL HEADER START
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncThe contents of this file are subject to the terms of the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCommon Development and Distribution License (the "License").
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncYou may not use this file except in compliance with the License.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncSee LICENSE.txt included in this distribution for the specific
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsynclanguage governing permissions and limitations under the License.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncWhen distributing Covered Code, include this CDDL HEADER in each
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncfile and include the License file at LICENSE.txt.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncIf applicable, add the following below this CDDL HEADER, with the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncfields enclosed by brackets "[]" replaced with your own identifying
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncinformation: Portions Copyright [yyyy] [name of copyright owner]
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCDDL HEADER END
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncCopyright 2009 Sun Microsystems, Inc. All rights reserved.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncUse is subject to license terms.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncPortions Copyright 2011 Jens Elkner.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync--%><%@page import="
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.io.BufferedReader,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.io.FileNotFoundException,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.io.InputStream,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.io.InputStreamReader,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.io.UnsupportedEncodingException,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.net.URLDecoder,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncjava.util.ArrayList,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.apache.commons.jrcs.diff.Chunk,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.apache.commons.jrcs.diff.Delta,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.apache.commons.jrcs.diff.Diff,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.apache.commons.jrcs.diff.Revision,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.opensolaris.opengrok.analysis.AnalyzerGuru,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.opensolaris.opengrok.analysis.FileAnalyzer.Genre,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.opensolaris.opengrok.web.DiffData,
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncorg.opensolaris.opengrok.web.DiffType"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%><%!
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncprivate String getAnnotateRevision(DiffData data) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (data.type == DiffType.OLD || data.type == DiffType.NEW) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync return "<script type=\"text/javascript\">/* <![CDATA[ */ "
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync + "document.rev = 'r=" + data.rev[data.type == DiffType.NEW ? 1 : 0]
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync + "'; /* ]]> */</script>";
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync return "";
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync}
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%><%@
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncinclude file="mast.jsp"
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync/* ---------------------- diff.jsp start --------------------- */
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync{
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync cfg = PageConfig.get(request);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync DiffData data = cfg.getDiffData();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (data.errorMsg != null) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<div class="src">
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <h3 class="error">Error:</h3>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <p><%= data.errorMsg %></p>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync</div><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else if (data.genre == Genre.IMAGE) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String link = request.getContextPath() + Prefix.DOWNLOAD_P
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync + Util.htmlize(cfg.getPath());
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<div id="difftable">
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <table class="image">
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <thead>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <tr><th><%= data.filename %> (revision <%= data.rev[0] %>)</th>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <th><%= data.filename %> (revision <%= data.rev[1] %>)</th>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </tr>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </thead>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <tbody>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <tr><td><img src="<%= link %>?r=<%= data.rev[0] %>"/></td>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <td><img src="<%= link %>?r=<%= data.rev[1] %>"/></td>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </tr>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </tbody>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </table>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync</div><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else if (data.genre != Genre.PLAIN && data.genre != Genre.HTML) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String link = request.getContextPath() + Prefix.DOWNLOAD_P
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync + Util.htmlize(cfg.getPath());
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<div id="src">Diffs for binary files cannot be displayed! Files are <a
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync href="<%= link %>?r=<%= data.rev[0] %>"><%=
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync data.filename %>(revision <%= data.rev[0] %>)</a> and <a
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync href="<%= link %>?r=<%= data.rev[1] %>"><%=
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync data.filename %>(revision <%= data.rev[1] %>)</a>.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync</div><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else if (data.revision.size() == 0) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <%= getAnnotateRevision(data) %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <b>No differences found!</b><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync //-------- Do THE DIFFS ------------
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int ln1 = 0;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int ln2 = 0;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String rp1 = data.param[0];
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String rp2 = data.param[1];
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String reqURI = request.getRequestURI();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String[] file1 = data.file[0];
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String[] file2 = data.file[1];
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync DiffType type = data.type;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync boolean full = data.full;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync%>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<%= getAnnotateRevision(data) %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<div id="diffbar">
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <div class="legend">
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <span class="d">Deleted</span>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <span class="a">Added</span>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </div>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <div class="tabs"><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync for (DiffType t : DiffType.values()) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (type == t) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %> <span class="active"><%= t.toString() %><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (t == DiffType.OLD) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %> ( <%= data.rev[0] %> )<%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else if (t == DiffType.NEW) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %> ( <%= data.rev[1] %> )<%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %></span><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %> <span><a href="<%= reqURI %>?r1=<%= rp1 %>&amp;r2=<%= rp2
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>&amp;format=<%= t.getAbbrev() %>&amp;full=<%= full ? '1' : '0'
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>"><%= t.toString() %><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (t == DiffType.OLD) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %> ( <%= data.rev[0] %> )<%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else if (t == DiffType.NEW) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %> ( <%= data.rev[1] %> )<%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %></a></span><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %></div>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <div class="ctype"><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (!full) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <span><a href="<%= reqURI %>?r1=<%= rp1 %>&amp;r2=<%= rp2
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>&amp;format=<%= type.getAbbrev() %>&amp;full=1">full</a></span>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <span class="active">compact</span><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <span class="active">full</span>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <span> <a href="<%= reqURI %>?r1=<%= rp1 %>&amp;r2=<%= rp2
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>&amp;format=<%= type.getAbbrev() %>&amp;full=0">compact</a></span><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %></div>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync</div>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync<div id="difftable">
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <div class="pre"><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (type == DiffType.SIDEBYSIDE || type == DiffType.UNIFIED) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %><table class="plain"><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (type == DiffType.SIDEBYSIDE) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <thead><tr>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <th><%= data.filename %> (<%= data.rev[0] %>)</th>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <th><%= data.filename %> (<%= data.rev[1] %>)</th>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync </tr></thead><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %>
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync <tbody><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync }
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync for (int i=0; i < data.revision.size(); i++) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Delta d = data.revision.getDelta(i);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (type == DiffType.TEXT) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync %><%= Util.htmlize(d.toString()) %><%
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync } else {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Chunk c1 = d.getOriginal();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync Chunk c2 = d.getRevised();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int cn1 = c1.first();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int cl1 = c1.last();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int cn2 = c2.first();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int cl2 = c2.last();
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int i1 = cn1, i2 = cn2;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync StringBuilder bl1 = new StringBuilder(80);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync StringBuilder bl2 = new StringBuilder(80);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync for (; i1 <= cl1 && i2 <= cl2; i1++, i2++) {
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync String[] ss = Util.diffline(
new StringBuilder(file1[i1]),
new StringBuilder(file2[i2]));
file1[i1] = ss[0];
file2[i2] = ss[1];
}
// deleted
for (; i1 <= cl1; i1++) {
bl1.setLength(0);
bl1.append("<span class=\"d\">");
Util.htmlize(file1[i1], bl1);
file1[i1] = bl1.append("</span>").toString();
}
// added
for (; i2 <= cl2; i2++) {
bl2.setLength(0);
bl2.append("<span class=\"a\">");
Util.htmlize(file2[i2], bl2);
file2[i2] = bl2.append("</span>").toString();
}
if (type == DiffType.UNIFIED) {
// UDIFF
if (cn1 > ln1 || cn2 > ln2) {
%>
<tr class="k"><td><%
if (full || (cn2 - ln2 < 20)) {
for (int j = ln2; j < cn2; j++) {
%><i><%= ++ln2 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
} else {
for (int j = ln2; j < ln2 + 8; j++) {
%><i><%= j+1 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
%><br/>--- <b><%= cn2 - ln2 - 16
%> unchanged lines hidden</b> (<a href="<%= reqURI
%>?r1=<%= rp1 %>&amp;r2=<%= rp2
%>&amp;format=<%= type.getAbbrev()
%>&amp;full=1#<%= ln2 %>">view full</a>) --- <br/><br/><%
ln2 = cn2 - 8;
for (int j = ln2; j < cn2; j++) {
%><i><%= ++ln2 %></i><%= Util.htmlize(file2[j]) %><br/><%
}
}
%></td>
</tr><%
ln1 = cn1;
}
if (cn1 <= cl1) {
%>
<tr><td><%
for (int j = cn1; j <= cl1 ; j++) {
%><del class="d"><%= ++ln1 %></del><%= file1[j]
%><br/><%
}
%></td>
</tr><%
}
if (cn2 <= cl2) {
%>
<tr class="k"><td><%
for (int j = cn2; j < cl2; j++) {
%><i class="a"><%= ++ln2 %></i><%= file2[j]
%><br/><%
}
%><i class="a"><%= ++ln2 %></i><%= file2[cl2] %><%
if(full) {
%><a name="<%= ln2 %>" /><%
}
%></td>
</tr><%
}
} else if (type == DiffType.SIDEBYSIDE) {
// SDIFF
if (cn1 > ln1 || cn2 > ln2) {
%>
<tr class="k"><td><%
if (full || cn2 - ln2 < 20) {
for (int j = ln1; j < cn1; j++) {
%><i><%= ++ln1 %></i><%=
Util.htmlize(file1[j]) %><br/><%
}
%></td><td><%
for (int j = ln2; j < cn2 ; j++) {
%><i><%= ++ln2 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
} else {
for (int j = ln1; j < ln1 + 8; j++) {
%><i><%= j+1 %></i><%=
Util.htmlize(file1[j]) %><br/><%
}
%><br/>--- <b><%= cn1 - ln1 - 16
%> unchanged lines hidden</b> (<a href="<%= reqURI
%>?r1=<%= rp1 %>&amp;r2=<%= rp2
%>&amp;format=<%= type.getAbbrev()
%>&amp;full=1#<%= ln2 %>">view full</a>) --- <br/><br/><%
ln1 = cn1 - 8;
for (int j = ln1; j < cn1; j++) {
%><i><%= ++ln1 %></i><%=
Util.htmlize(file1[j]) %><br/><%
}
%></td><td><%
for (int j = ln2; j < ln2 + 8; j++) {
%><i><%= j+1 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
%><br/>--- <b><%= cn2 - ln2 - 16
%> unchanged lines hidden</b> (<a href="<%= reqURI
%>?r1=<%= rp1 %>&amp;r2=<%= rp2
%>&amp;format=<%= type.getAbbrev()
%>&amp;full=1#<%= ln2 %>">view full</a>) --- <br/><br/><%
ln2 = cn2 - 8;
for (int j = ln2; j < cn2; j++) {
%><i><%= ++ln2 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
}
%></td>
</tr><%
}
%>
<tr class="k"><td><%
for (int j = cn1; j <= cl1; j++) {
%><i><%= ++ln1 %></i><%= file1[j] %><br/><%
}
%></td><td><%
for (int j = cn2; j <= cl2; j++) {
%><i><%= ++ln2 %></i><a name="<%= ln2 %>"></a><%=
file2[j] %><br/><%
}
%></td>
</tr><%
// OLD
} else if (type == DiffType.OLD) {
// OLD
if (cn1 > ln1) {
if (full || cn1 - ln1 < 20) {
for (int j = ln1; j < cn1; j++) {
%><i><%= ++ln1 %></i><%=
Util.htmlize(file1[j]) %><br/><%
}
} else {
for (int j = ln1; j < ln1 + 8; j++) {
%><i><%= j+1 %></i><%=
Util.htmlize(file1[j]) %><br/><%
}
%><br/>--- <b><%= cn1 - ln1 - 16
%> unchanged lines hidden</b> (<a href="<%= reqURI
%>?r1=<%= rp1 %>&amp;r2=<%= rp2
%>&amp;format=<%= type.getAbbrev()
%>&amp;full=1#<%=ln1%>">view full</a>) --- <br/><br/><%
ln1 = cn1 - 8;
for (int j = ln1; j < cn1; j++) {
%><i><%= ++ln1 %></i><%=
Util.htmlize(file1[j]) %><br/><%
}
}
}
for (int j = cn1; j <= cl1 ; j++) {
%><i><%= ++ln1 %></i><%= file1[j] %><br/><%
}
if (full) {
%><a name="<%=ln1%>" ></a><%
}
// NEW
} else if (type == DiffType.NEW) {
if (cn2 > ln2) {
if (full || cn2 - ln2 < 20) {
for (int j = ln2; j < cn2 ; j++) {
%><i><%= ++ln2 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
} else {
for (int j = ln2; j < ln2 + 8; j++) {
%><i><%= j+1 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
%><br/>--- <b><%= cn2 - ln2 - 16
%> unchanged lines hidden</b> (<a href="<%= reqURI
%>?r1=<%= rp1 %>&amp;r2=<%= rp2
%>&amp;format=<%= type.getAbbrev()
%>&amp;full=1#<%= ln2 %>">view full</a>) --- <br/><br/><%
ln2 = cn2 - 8;
for (int j = ln2; j < cn2; j++) {
%><i><%= ++ln2 %></i><%=
Util.htmlize(file2[j]) %><br/><%
}
}
}
for (int j = cn2; j <= cl2 ; j++) {
%><i><%= ++ln2 %></i><%= file2[j] %><br/><%
}
if (full) {
%><a name="<%= ln2 %>"></a><%
}
}
} // else
} // for
// deltas done, dump the remaining
if (file1.length >= ln1) {
if (type == DiffType.SIDEBYSIDE) {
if (full || file1.length - ln1 < 20) {
%>
<tr><td><%
for (int j = ln1; j < file1.length ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file1[j]) %><br/><%
}
%></td><td><%
for (int j = ln2; j < file2.length ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file2[j]) %><br/><%
}
%></td>
</tr>
</tbody>
</table><%
} else {
%>
<tr><td><%
for (int j = ln1; j < ln1 + 8 ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file1[j]) %><br/><%
}
%><br/> --- <b><%= file1.length - ln1 - 8
%> unchanged lines hidden</b> --- </td><td><%
for (int j = ln2; j < ln2 + 8 ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file2[j]) %><br/><%
}
%><br/>--- <b><%= file1.length - ln1 - 8
%> unchanged lines hidden</b> ---</td>
</tr>
</tbody>
</table><%
}
} else if (type == DiffType.UNIFIED) {
if (full || file2.length - ln2 < 20) {
%>
<tr><td><%
for (int j = ln2; j < file2.length ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file2[j]) %><br/><%
}
%></td>
</tr>
</tbody>
</table><%
} else {
%>
<tr><td><%
for (int j = ln2; j < ln2 + 8 ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file2[j]) %><br/><%
}
%><br/>--- <b><%= file2.length - ln2 - 8
%> unchanged lines hidden</b> ---</td>
</tr>
</tbody>
</table><%
}
} else if (type == DiffType.OLD) {
if (full || file1.length - ln1 < 20) {
for (int j = ln1; j < file1.length ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file1[j]) %><br/><%
}
} else {
for (int j = ln1; j < ln1 + 8 ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file1[j]) %><br/><%
}
%><br/> --- <b><%= file1.length - ln1 - 8
%> unchanged lines hidden</b> ---<br/><%
}
} else if (type == DiffType.NEW) {
if (full || file2.length - ln2 < 20) {
for (int j = ln2; j < file2.length ; j++) {
%><i><%= j+1 %></i><%=Util.htmlize(file2[j])%><br/><%
}
} else {
for (int j = ln2; j < ln2 + 8 ; j++) {
%><i><%= j+1 %></i><%= Util.htmlize(file2[j]) %><br/><%
}
%><br/> --- <b><%= file2.length - ln2 - 8
%> unchanged lines hidden</b> ---<br/><%
}
}
}
//----DIFFS Done--------
%></div>
</div><%
}
}
/* ---------------------- diff.jsp end --------------------- */
%><%@
include file="foot.jspf"
%>