git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 0/5] Patch parsing API
@ 2008-12-11  4:58 Shawn O. Pearce
  2008-12-11  4:58 ` [JGIT PATCH 1/5] Add toByteArray() to TemporaryBuffer Shawn O. Pearce
  0 siblings, 1 reply; 15+ messages in thread
From: Shawn O. Pearce @ 2008-12-11  4:58 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-12-11 20:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11  4:58 [JGIT PATCH 0/5] Patch parsing API Shawn O. Pearce
2008-12-11  4:58 ` [JGIT PATCH 1/5] Add toByteArray() to TemporaryBuffer Shawn O. Pearce
2008-12-11  4:58   ` [JGIT PATCH 2/5] Add copy(InputStream) " Shawn O. Pearce
2008-12-11  4:58     ` [JGIT PATCH 3/5] Define FileHeader to parse the header block of a git diff Shawn O. Pearce
2008-12-11  4:58       ` [JGIT PATCH 4/5] Define Patch to parse a sequence of patch FileHeaders Shawn O. Pearce
2008-12-11  4:58         ` [JGIT PATCH 5/5] Add HunkHeader to represent a single hunk of a file within a patch Shawn O. Pearce
2008-12-11 18:34         ` [JGIT PATCH 4/5] Define Patch to parse a sequence of patch FileHeaders Robin Rosenberg
2008-12-11 18:39           ` Shawn O. Pearce
2008-12-11 20:23             ` Robin Rosenberg
2008-12-11 20:27               ` Shawn O. Pearce
2008-12-11 20:39             ` Robin Rosenberg
2008-12-11 20:41               ` Shawn O. Pearce
2008-12-11 15:40     ` [JGIT PATCH 2/5] Add copy(InputStream) to TemporaryBuffer Robin Rosenberg
2008-12-11 15:52       ` Shawn O. Pearce
2008-12-11 16:53         ` [JGIT PATCH 2/5 v2] " Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).