Browse Source

Add toString() to HunkHeader

Since FileHeader provides toString() method (via DiffEntry) we could add
a similar method to HunkHeader.

Change-Id: I7886e5b8f775fa8e8478ac5af37d90b6ef677d8b
stable-1.3
Tomasz Zarna 13 years ago
parent
commit
eb5df588d8
  1. 13
      org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java

13
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]); final int end = s.indexOf('\n', offsets[fileIdx]);
offsets[fileIdx] = end < 0 ? s.length() : end + 1; 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();
}
} }

Loading…
Cancel
Save