diff.jsp revision 1469
See LICENSE.txt included in this distribution for the specific
file and include the License file at LICENSE.txt.
StringBuilder sb = new StringBuilder("<script type=\"text/javascript\">/* <![CDATA[ */ ");
sb.append(" /* ]]> */</script>");
return sb.toString();
/** if {@code true} dump all, i.e. no hidden lines */
* @param full if {@code true} dump all, i.e. no hidden lines *
this.full = full;
this.start = start;
this.leading = leading;
this.hidden = hidden;
this.trailing = trailing;
bn.setLength(0);
bs.setLength(0);
if (h.full || howMany < 20) {
h.reset(line, howMany, 0, 0);
bn.append("<a name=\"").append(line).append("\">")
bn.append(line).append('\n');
bn.append("<a name=\"").append(j).append("\">")
bn.append(j).append('\n');
h.reset(line, 8, howMany - 8 - trailing, trailing); // hidden block (row n+1)
bs = h.bs;
bn = h.bn;
bn.append("<a name=\"").append(line).append("\">")
bn.append(line).append('\n');
bn.append("<a name=\"").append(line).append("\">")
bn.append(line).append('\n');
bs.append(file[j]).append('\n');
return "<b>" + h.hidden + " unchanged lines hidden</b>"
bn.setLength(0);
bn.append(n).append('\n');
int idx = path.lastIndexOf('/');
return path.substring(idx+1);
include file="mast.jsp"
/* ---------------------- diff.jsp start --------------------- */
cfg = PageConfig.get(request);
DiffData dd = cfg.getDiffData();
if (dd.errorMsg != null) {
<p><%= dd.errorMsg %></p>
int idx1 = dd.rp1.indexOf('@');
int idx2 = dd.rp2.indexOf('@');
<tr><td class="dti"><img src="<%= link + dd.rp1.substring(0, idx1)
%>?r=<%= dd.rp1.substring(idx1 + 2) %>"/></td>
<td class="dti"><img src="<%= link + dd.rp2.substring(0, idx2)
%>?r=<%= dd.rp2.substring(idx2 + 2) %>"/></td>
int idx1 = dd.rp1.indexOf('@');
int idx2 = dd.rp2.indexOf('@');
} else if (dd.revision.size() == 0) {
for (DiffType t : DiffType.values()) {
if (dd.type == t) {
%> <span class="active dbtab"><%= t.toString() %><%
if (t == DiffType.OLD) {
%> ( <%= dd.rev1 %> )<%
} else if (t == DiffType.NEW) {
%> ( <%= dd.rev2 %> )<%
if (t == DiffType.OLD) {
%> ( <%= dd.rev1 %> )<%
} else if (t == DiffType.NEW) {
%> ( <%= dd.rev2 %> )<%
if (!dd.full) {
%><table id="<%= "dt" + dd.type %>"><%
String[] file1 = dd.file[0]; // source lines of the 'old' file
String[] file2 = dd.file[1]; // source lines of the 'new' file
Hidden h1 = new Hidden(dd.full); // hidden line info + trailing stuff file1
Hidden h2 = new Hidden(dd.full); // hidden line info + trailing stuff file2
for (int i=0; i < dd.revision.size(); i++) {
Delta d = dd.revision.getDelta(i);
Chunk c1 = d.getOriginal();
Chunk c2 = d.getRevised();
int cn1 = c1.first() + 1; // line# of the 1st line of chunk file1
int cl1 = c1.last() + 1; // line# of the last line of chunk file1
int cn2 = c2.first() + 1; // line# of the 1st line of chunk file2
int cl2 = c2.last() + 1; // line# of the last line of chunk file2
bs1.setLength(0);
.append(Util.htmlize(file1[i1])).append("</span>")
bs2.setLength(0);
.append(Util.htmlize(file2[i2])).append("</span>")
bn2.setLength(0);
bs2.setLength(0);
bn1.setLength(0); // hidden source
bs1.setLength(0); // line#s of hidden source
h1.full = true; // dump all
ln1 = genNums(ln1, h2.hidden, lna);
bn1.setLength(0);
bs1.setLength(0);
h1.full |= cn2 - ln2 + 1 < 20; // force same dump strategy for both
<td class="dtn"><%= h1.bn %></td><%
if (h2.hidden > 0) {
if (h2.trailing > 0) {
<td class="dtn"><%= h1.bn %></td>
<td class="dts"><%= h1.bs %></td><%
<td class="dtn"><%= h1.bs %></td><%
<td class="dtn"><%= h2.bn %></td>
<td class="dts"><%= h2.bs %></td>
bn2.setLength(0);
bs2.setLength(0);
bn2.setLength(0);
bs2.setLength(0);
bn1.setLength(0);
bs1.setLength(0);
} // for revision.size(
if (file1.length >= ln1) {
bn2.setLength(0);
bs2.setLength(0);
ln1 = dumpFile(ln1, file1.length - ln1 + 1, 0, file1, bn2, bs2, h2, true);
ln2 = dumpFile(ln2, file2.length - ln2 + 1, 0, file2, bn2, bs2, h2, true);
} else if (like_udiff && file2.length >= ln2) {
ln2 = dumpFile(ln2, file2.length - ln2 + 1, 0, file2, bn2, bs2, h2, true);
bn1.setLength(0); // hidden source
bs1.setLength(0); // line#s of hidden source
h1.full = true; // dump all
ln1 = genNums(ln1, h2.hidden, lna);
bn1.setLength(0);
bs1.setLength(0);
ln1 = dumpFile(ln1, file1.length - ln1 + 1, 0, file1, bn1, bs1, h1, false);
ln2 = dumpFile(ln2, file2.length - ln2 + 1, 0, file2, bn2, bs2, h2, true);
<td class="dtn"><%= h1.bn %></td><%
if (h2.hidden > 0) {
<tr class="dtl" id="hi_<%= dd.revision.size() %>"><%
<tr class="dte" id="hs_<%= dd.revision.size() %>">
/* ---------------------- diff.jsp end --------------------- */
include file="foot.jspf"