From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 0/5] Patch parsing API
Date: Wed, 10 Dec 2008 20:58:37 -0800 [thread overview]
Message-ID: <1228971522-28764-1-git-send-email-spearce@spearce.org> (raw)
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
next reply other threads:[~2008-12-11 5:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-11 4:58 Shawn O. Pearce [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1228971522-28764-1-git-send-email-spearce@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).