- <?xml version="1.0"?>
- <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
- <jsp:directive.page import="java.util.*,com.perforce.api.*" contentType="text/html;charset=ISO-8859-1"/>
- <jsp:directive.include file="session.jsp"/>
- <jsp:text><HTML><HEAD>
- <jsp:directive.include file="head.jsp"/>
- </HEAD>
- <BODY bgcolor="#FFFFFF" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
- <TABLE width="780" cellspacing="0" cellpadding="0" border="0">
- <jsp:directive.include file="navbar.jsp"/>
- <TR><TD><TABLE width="100%" cellspacing="0" cellpadding="0" border="0">
- <TR><TD width="21"><IMG src="images/s.gif" width="21" rowspan="10"/></TD><TD width="100%">
- <H1>File Diff:</H1>
- <jsp:scriptlet>
- String path = request.getParameter("path");
- if (null == path) {
- response.sendRedirect(response.encodeRedirectURL("index.jsp"));
- return;
- }
- String r1 = request.getParameter("r1");
- String r2 = request.getParameter("r2");
- FileEntry fent = new FileEntry(env, path);
- fent.sync();
- if (null == r1) r1 = String.valueOf(fent.getHeadRev()-1);
- if (null == r2) r2 = String.valueOf(fent.getHeadRev());
- out.print("File: "+Utils.formatDepotPath(fent.getDepotPath(), "<A href=\"browse.jsp?path={0}\">{1}</A>", "<A href=\"file.jsp?path={0}\">{1}</A>",null, true));
- out.print("<BR/>");
- out.print("Versions: #"+r1+" to #"+r2);
- out.print("<HR/>");
- String cmd[] = { "p4", "diff2", "-du", path+"#"+r1, path+"#"+r2 };
- String l, c;
- out.println("<PRE style=\"diff\">");
- try {
- P4Process p = new P4Process(env);
- p.setRawMode(true);
- p.exec(cmd);
- while (null != (l = p.readLine())) {
- if (l.startsWith("text: ")) {
- l = l.substring(6);
- } else {
- continue;
- }
- switch (l.charAt(0)) {
- case '@':
- c = "diffmacro";
- break;
- case '+':
- c = "diffadd";
- if (1 > l.length()) {
- l = "";
- } else {
- l = l.substring(1);
- }
- break;
- case '-':
- c = "diffsub";
- if (2 > l.length()) {
- l = "&nbsp;";
- } else {
- l = l.substring(1);
- }
- break;
- default:
- c = "diff";
- if (2 > l.length()) {
- l = "&nbsp;";
- } else {
- l = l.substring(1);
- }
- break;
- }
- l = Utils.HTMLEncode(l);
- out.println("<SPAN class=\""+c+"\">"+l+"</SPAN>");
- }
- p.close();
- } catch (Exception ex) {
- /* Ignored. */
- }
- out.println("</PRE>");
- </jsp:scriptlet>
- </TD></TR>
- </TABLE></TD></TR>
- </TABLE></BODY></HTML></jsp:text>
- </jsp:root>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 2206 | David Markley |
Removed all use of the common tag library and any specific inclusion of the crimson API. |
22 years ago | |
#4 | 2070 | David Markley | Updated to work with Tomcat 4.0.4 | 23 years ago | |
#3 | 1845 | David Markley | Fixed spacing issues on the diff and view pages. | 23 years ago | |
#2 | 1842 | David Markley | Updated pages to include titles and added view and diff pages. | 23 years ago | |
#1 | 1836 | David Markley | Added file information and improved item listings. | 23 years ago |