[JGIT PATCH 0/5] Patch parsing API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is an API to parse a Git style patch file and extract the
critical metadata from the header lines, including the hunk headers
and what lines they correspond to in the pre and post image files.

It requires the two other series I already sent out today for
QuotedString and AbbreviatedObjectId.

There's TODO markers left where we still need to insert code to
create some sort of warning object, and then hang the warnings off
the Patch class.  Given the size of the code I'm inclined to do that
as yet an additional patch, rather than squash it into this series.

My short-term roadmap related to this part of JGit:

 * Compute and collect warnings from malformed git-style patches
 * Correctly parse "git diff --cc" style output
 * Get it into egit.git

I'm stopping development once I have the diff --cc output parsing
correctly.  My rationale is right now I need the patch metadata
parsing in Gerrit 2, so that's what I'm teaching JGit to do.  Maybe
later in the month or early next I'll add patch application support,
because I also want that in Gerrit 2.  Patch application is not
currently a blocking item for me; but reading the patch metadata is.

Traditional patch support is really stubbed out too; there's a very
small subset of traditional (non-git) style patches this code can
scan the metadata from, but no tests to verify it.  Gerrit 2 gets
all of its data from a "git diff" process, so I only need support
for git diffs right now.  Yes, I'd like to add traditional patch
support too, but it won't be until later in 2009 that I would even
think about working on that myself.


Shawn O. Pearce (5):
  Add toByteArray() to TemporaryBuffer
  Add copy(InputStream) to TemporaryBuffer
  Define FileHeader to parse the header block of a git diff
  Define Patch to parse a sequence of patch FileHeaders
  Add HunkHeader to represent a single hunk of a file within a patch

 .../tst/org/spearce/jgit/patch/FileHeaderTest.java |  395 ++++++++++++++++
 .../tst/org/spearce/jgit/patch/PatchTest.java      |  155 +++++++
 .../patch/testParse_ConfigCaseInsensitive.patch    |   67 +++
 .../src/org/spearce/jgit/patch/FileHeader.java     |  480 ++++++++++++++++++++
 .../src/org/spearce/jgit/patch/HunkHeader.java     |  185 ++++++++
 .../src/org/spearce/jgit/patch/Patch.java          |  267 +++++++++++
 .../src/org/spearce/jgit/util/TemporaryBuffer.java |   51 ++
 7 files changed, 1600 insertions(+), 0 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/FileHeaderTest.java
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/PatchTest.java
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/testParse_ConfigCaseInsensitive.patch
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/patch/FileHeader.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux