[JGIT PATCH 00/15] More patch parsing support
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Dec 12, 2008, 02:46 UTC
- Message-ID
- <1229049981-14152-1-git-send-email-spearce@spearce.org>
Unit test improvements, introduction of IntList (which Dscho also needs for his diff code, its probably a drop-in replacement for him), and support for parsing the meta data of binary patches.
I'm writing the "diff --cc" parser right now but the unit tests for it still fail so I'm not including those changes just yet.
Shawn O. Pearce (15):
Correct use of TemporaryBuffer in Patch
Add tests for TemporaryBuffer
Add IntList as a more efficient representation of List<Integer>
Add lineMap computer to RawParseUtils to index locations of line
starts
Define FileHeader.PatchType to report the style of patch used
Test for non-git binary files and mark them as PatchType.BINARY
Set empty patches with no Git metadata to PatchType.BINARY
Always use the FileHeader buffer during Patch.parseHunks
Parse "GIT binary patch" style patch metadata
Record patch parsing errors for later inspection by applications
Fix Patch.parse to honor the end point passed in
Correctly handle hunk headers such as "@@ -0,0 +1 @@"
Patch parse test comparing "git log -p" output to "git log --numstat"
Abstract the hunk header testing into a method
Treat "diff --combined" the same as "diff --cc".../spearce/jgit/patch/EGitPatchHistoryTest.java | 221 ++++++++++++ .../tst/org/spearce/jgit/patch/FileHeaderTest.java | 70 +++- .../tst/org/spearce/jgit/patch/PatchErrorTest.java | 174 +++++++++ .../tst/org/spearce/jgit/patch/PatchTest.java | 78 ++++ .../spearce/jgit/patch/testError_BodyTooLong.patch | 17 + .../jgit/patch/testError_DisconnectedHunk.patch | 30 ++ .../jgit/patch/testError_GarbageBetweenFiles.patch | 33 ++ .../patch/testError_GitBinaryNoForwardHunk.patch | 10 + .../jgit/patch/testError_TruncatedNew.patch | 15 + .../jgit/patch/testError_TruncatedOld.patch | 15 + .../spearce/jgit/patch/testParse_GitBinary.patch | 135 +++++++ .../spearce/jgit/patch/testParse_NoBinary.patch | 83 +++++ .../tst/org/spearce/jgit/util/IntListTest.java | 156 ++++++++ .../jgit/util/RawParseUtils_LineMapTest.java | 88 +++++ .../org/spearce/jgit/util/TemporaryBufferTest.java | 374 ++++++++++++++++++++ .../tst/org/spearce/jgit/util/TestRng.java | 61 ++++ .../src/org/spearce/jgit/patch/BinaryHunk.java | 127 +++++++ .../src/org/spearce/jgit/patch/FileHeader.java | 94 +++++- .../src/org/spearce/jgit/patch/FormatError.java | 95 +++++ .../src/org/spearce/jgit/patch/HunkHeader.java | 41 ++- .../src/org/spearce/jgit/patch/Patch.java | 197 ++++++++--- .../src/org/spearce/jgit/util/IntList.java | 128 +++++++ .../src/org/spearce/jgit/util/RawParseUtils.java | 31 ++ .../src/org/spearce/jgit/util/TemporaryBuffer.java | 4 +- 24 files changed, 2187 insertions(+), 90 deletions(-) create mode 100644 org.spearce.jgit.test/exttst/org/spearce/jgit/patch/EGitPatchHistoryTest.java create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/PatchErrorTest.java create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testError_BodyTooLong.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testError_DisconnectedHunk.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testError_GarbageBetweenFiles.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testError_GitBinaryNoForwardHunk.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testError_TruncatedNew.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testError_TruncatedOld.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testParse_GitBinary.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testParse_NoBinary.patch create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/util/IntListTest.java create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/util/RawParseUtils_LineMapTest.java create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/util/TemporaryBufferTest.java create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/util/TestRng.java create mode 100644 org.spearce.jgit/src/org/spearce/jgit/patch/BinaryHunk.java create mode 100644 org.spearce.jgit/src/org/spearce/jgit/patch/FormatError.java create mode 100644 org.spearce.jgit/src/org/spearce/jgit/util/IntList.java