From eb5df588d889f33d97efbfc9d465d6cf01da636a Mon Sep 17 00:00:00 2001 From: Tomasz Zarna Date: Thu, 8 Dec 2011 18:11:01 +0100 Subject: [PATCH] Add toString() to HunkHeader Since FileHeader provides toString() method (via DiffEntry) we could add a similar method to HunkHeader. Change-Id: I7886e5b8f775fa8e8478ac5af37d90b6ef677d8b --- .../src/org/eclipse/jgit/patch/HunkHeader.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 a6ea74eb1..26a71cd4c 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(); + } }