diff options
author | James Moger <james.moger@gitblit.com> | 2013-09-30 09:30:04 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-09-30 10:11:28 -0400 |
commit | 699e71e76b15081baf746c6ce9c9144f7e5f1ff9 (patch) | |
tree | 4a9ea25c258caeae3dea4bc1de809f47bc615d81 /src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java | |
parent | 235ad956fa84cad4fac1b2e69a0c9e4f50376ea3 (diff) | |
download | gitblit-699e71e76b15081baf746c6ce9c9144f7e5f1ff9.tar.gz gitblit-699e71e76b15081baf746c6ce9c9144f7e5f1ff9.zip |
Trim trailing whitespace and organize imports
Change-Id: I9f91138b20219be6e3c4b28251487df262bff6cc
Diffstat (limited to 'src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java')
-rw-r--r-- | src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java b/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java index 8ca42854..47ff143a 100644 --- a/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java +++ b/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java @@ -34,9 +34,9 @@ import com.gitblit.utils.DiffUtils.DiffStat; /**
* Generates an html snippet of a diff in Gitblit's style, tracks changed paths,
* and calculates diff stats.
- *
+ *
* @author James Moger
- *
+ *
*/
public class GitBlitDiffFormatter extends DiffFormatter {
@@ -47,22 +47,22 @@ public class GitBlitDiffFormatter extends DiffFormatter { private PathChangeModel currentPath;
private int left, right;
-
+
public GitBlitDiffFormatter(OutputStream os, String commitId) {
super(os);
this.os = os;
this.diffStat = new DiffStat(commitId);
}
-
+
@Override
public void format(DiffEntry ent) throws IOException {
currentPath = diffStat.addPath(ent);
super.format(ent);
}
-
+
/**
* Output a hunk header
- *
+ *
* @param aStartLine
* within first source
* @param aEndLine
@@ -88,7 +88,7 @@ public class GitBlitDiffFormatter extends DiffFormatter { left = aStartLine + 1;
right = bStartLine + 1;
}
-
+
protected void writeRange(final char prefix, final int begin, final int cnt) throws IOException {
os.write(' ');
os.write(prefix);
@@ -127,7 +127,7 @@ public class GitBlitDiffFormatter extends DiffFormatter { throws IOException {
// update entry diffstat
currentPath.update(prefix);
-
+
// output diff
os.write("<tr>".getBytes());
switch (prefix) {
@@ -162,7 +162,7 @@ public class GitBlitDiffFormatter extends DiffFormatter { /**
* Workaround function for complex private methods in DiffFormatter. This
* sets the html for the diff headers.
- *
+ *
* @return
*/
public String getHtml() {
@@ -191,10 +191,10 @@ public class GitBlitDiffFormatter extends DiffFormatter { } else {
// use a
line = line.substring("diff --git ".length()).trim();
- line = line.substring(line.startsWith("\"a/") ? 3 : 2);
+ line = line.substring(line.startsWith("\"a/") ? 3 : 2);
line = line.substring(0, line.indexOf(" b/") > -1 ? line.indexOf(" b/") : line.indexOf("\"b/")).trim();
}
-
+
if (line.charAt(0) == '"') {
line = line.substring(1);
}
@@ -205,7 +205,7 @@ public class GitBlitDiffFormatter extends DiffFormatter { sb.append("</tbody></table></div>\n");
inFile = false;
}
-
+
sb.append(MessageFormat.format("<div class='header'><div class=\"diffHeader\" id=\"{0}\"><i class=\"icon-file\"></i> ", line)).append(line).append("</div></div>");
sb.append("<div class=\"diff\">");
sb.append("<table><tbody>");
@@ -229,7 +229,7 @@ public class GitBlitDiffFormatter extends DiffFormatter { sb.append("</table></div>");
return sb.toString();
}
-
+
public DiffStat getDiffStat() {
return diffStat;
}
|