summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTomasz Zarna2011-12-08 12:11:01 (EST)
committer Tomasz Zarna2011-12-08 12:11:01 (EST)
commiteb5df588d889f33d97efbfc9d465d6cf01da636a (patch)
tree536fab3af2e03e8182ee3d5929adb96e54764ab2
parent2b3d48acc291f62c2c924be810e93e3a2e11615f (diff)
downloadjgit-eb5df588d889f33d97efbfc9d465d6cf01da636a.zip
jgit-eb5df588d889f33d97efbfc9d465d6cf01da636a.tar.gz
jgit-eb5df588d889f33d97efbfc9d465d6cf01da636a.tar.bz2
Add toString() to HunkHeaderrefs/changes/66/4766/2
Since FileHeader provides toString() method (via DiffEntry) we could add a similar method to HunkHeader. Change-Id: I7886e5b8f775fa8e8478ac5af37d90b6ef677d8b
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java
index a6ea74e..26a71cd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java
@@ -401,4 +401,17 @@ public class HunkHeader {
final int end = s.indexOf('\n', offsets[fileIdx]);
offsets[fileIdx] = end < 0 ? s.length() : end + 1;
}
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append("HunkHeader[");
+ buf.append(getOldImage().getStartLine());
+ buf.append(',');
+ buf.append(getOldImage().getLineCount());
+ buf.append("->");
+ buf.append(getNewStartLine()).append(',').append(getNewLineCount());
+ buf.append(']');
+ return buf.toString();
+ }
}