git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH 0/6] Diff processing utilities

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 2, 2009, 02:08 UTC
Message-ID
<1241230127-28279-1-git-send-email-spearce@spearce.org>

Back in late 2008 Dscho started writing some basic diff routines for JGit. That work got partially shelved when he had to move onto more important day-job topics. This series is starting to revive some portions of his work, and bring it into JGit.

In particular I want at least this much merged, so I can use it in Gerrit Code Review to massage an existing patch file before I display it. Currently most of that logic is within Gerrit, and I'd much rather push it down into JGit where anyone can reuse it.

To be clear, this series *does not* contain a way to create a diff. Dscho wrote much more code which is not yet ready for inclusion.

After applying this series we have an EditList describing what happened in an existing patch we parsed with the existing Patch class, and a DiffFormatter which can be used to reflow a patch script if the repository has both the pre and post image objects.

The formatter part is really only useful if the repository created the patch script, or received the objects over a git native object transport, like Gerrit Code Review does with SSH.

Dscho, can you give us yea-or-nay for SBO lines for the patches I've attributed to you?

Johannes E. Schindelin (3):
  Add diff.Edit to describe an edit region within a file
  Add diff.RawText to index a file content for later compares
  Add diff.DiffFormatter to create Git style unified patch scripts
Shawn O. Pearce (3):
  Add set to IntList
  Add diff.EditList to provide for a list of Edit instances
  Teach FileHeader, HunkHeader how to create an EditList
 .../spearce/jgit/patch/testEditList_Types.patch    |   24 +++
 .../tst/org/spearce/jgit/diff/EditListTest.java    |  121 +++++++++++++
 .../tst/org/spearce/jgit/diff/EditTest.java        |  139 ++++++++++++++
 .../tst/org/spearce/jgit/diff/RawTextTest.java     |   93 ++++++++++
 .../tst/org/spearce/jgit/patch/EditListTest.java   |   95 ++++++++++
 .../tst/org/spearce/jgit/util/IntListTest.java     |   21 +++
 .../src/org/spearce/jgit/diff/DiffFormatter.java   |  187 +++++++++++++++++++
 .../src/org/spearce/jgit/diff/Edit.java            |  189 ++++++++++++++++++++
 .../src/org/spearce/jgit/diff/EditList.java        |   93 ++++++++++
 .../src/org/spearce/jgit/diff/RawText.java         |  172 ++++++++++++++++++
 .../src/org/spearce/jgit/diff/Sequence.java        |   78 ++++++++
 .../src/org/spearce/jgit/patch/FileHeader.java     |    9 +
 .../src/org/spearce/jgit/patch/HunkHeader.java     |   48 +++++
 .../src/org/spearce/jgit/util/IntList.java         |   17 ++
 14 files changed, 1286 insertions(+), 0 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/patch/testEditList_Types.patch
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/diff/EditListTest.java
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/diff/EditTest.java
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/diff/RawTextTest.java
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/patch/EditListTest.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/diff/DiffFormatter.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/diff/Edit.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/diff/EditList.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/diff/RawText.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/diff/Sequence.java
Next: Shawn O. Pearce
Message 1 of 15 in “Diff processing utilities”
  1. 0/6 Diff processing utilitiesShawn O. Pearce, May 2, 2009
  2. 1/6 Add set to IntListShawn O. Pearce, May 2, 2009
  3. 2/6 Add diff.Edit to describe an edit region within a fileShawn O. Pearce, May 2, 2009
  4. 3/6 Add diff.EditList to provide for a list of Edit instancesShawn O. Pearce, May 2, 2009
  5. 4/6 Add diff.RawText to index a file content for later comparesShawn O. Pearce, May 2, 2009
  6. 5/6 Teach FileHeader, HunkHeader how to create an EditListShawn O. Pearce, May 2, 2009
  7. 6/6 Add diff.DiffFormatter to create Git style unified patch scriptsShawn O. Pearce, May 2, 2009
  8. 6/6 Add diff.DiffFormatter to create Git style unified patch scriptsShawn O. Pearce, May 3, 2009
  9. 6/6 Add diff.DiffFormatter to create Git style unified patch scriptsShawn O. Pearce, May 3, 2009
  10. Robin RosenbergMay 3, 2009
  11. Shawn O. PearceMay 4, 2009
  12. Johannes SchindelinMay 4, 2009
  13. Shawn O. PearceMay 4, 2009
  14. Johannes SchindelinMay 4, 2009
  15. Johannes SchindelinMay 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.