Package org.eclipse.jgit.patch
Class CombinedFileHeader
- java.lang.Object
-
- org.eclipse.jgit.diff.DiffEntry
-
- org.eclipse.jgit.patch.FileHeader
-
- org.eclipse.jgit.patch.CombinedFileHeader
-
public class CombinedFileHeader extends FileHeader
A file in the Git "diff --cc" or "diff --combined" format.A combined diff shows an n-way comparison between two or more ancestors and the final revision. Its primary function is to perform code reviews on a merge which introduces changes not in any ancestor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.patch.FileHeader
FileHeader.PatchType
-
Nested classes/interfaces inherited from class org.eclipse.jgit.diff.DiffEntry
DiffEntry.ChangeType, DiffEntry.Side
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
MODE
private AbbreviatedObjectId[]
oldIds
private FileMode[]
oldModes
-
Fields inherited from class org.eclipse.jgit.patch.FileHeader
buf, DELETED_FILE_MODE, endOffset, forwardBinaryHunk, INDEX, NEW_FILE_MODE, NEW_NAME, OLD_NAME, patchType, reverseBinaryHunk, startOffset
-
-
Constructor Summary
Constructors Constructor Description CombinedFileHeader(byte[] b, int offset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<? extends CombinedHunkHeader>
getHunks()
Get hunks altering this file; in order of appearance in patchAbbreviatedObjectId
getOldId()
Get the old object id from theindex
.AbbreviatedObjectId
getOldId(int nthParent)
Get the ObjectId of the nth ancestorFileMode
getOldMode()
Get the old file modeFileMode
getOldMode(int nthParent)
Get the file mode of the nth ancestorint
getParentCount()
java.lang.String
getScriptText(java.nio.charset.Charset[] charsetGuess)
java.lang.String
getScriptText(java.nio.charset.Charset ocs, java.nio.charset.Charset ncs)
Convert the patch script for this file into a string.(package private) HunkHeader
newHunkHeader(int offset)
private void
parseDeletedFileMode(int ptr, int eol)
(package private) int
parseGitHeaders(int ptr, int end)
protected void
parseIndexLine(int ptr, int eol)
private void
parseModeLine(int ptr, int eol)
protected void
parseNewFileMode(int ptr, int eol)
-
Methods inherited from class org.eclipse.jgit.patch.FileHeader
addHunk, getBuffer, getEndOffset, getForwardBinaryHunk, getPatchType, getReverseBinaryHunk, getScriptText, getStartOffset, hasMetaDataChanges, isHunkHdr, parseFileMode, parseGitFileName, parseNewName, parseOldName, parseTraditionalHeaders, toEditList
-
Methods inherited from class org.eclipse.jgit.diff.DiffEntry
getChangeType, getDiffAttribute, getId, getMode, getNewId, getNewMode, getNewPath, getOldPath, getPath, getScore, getTreeFilterMarks, isMarked, scan, scan, scan, toString
-
-
-
-
Field Detail
-
MODE
private static final byte[] MODE
-
oldIds
private AbbreviatedObjectId[] oldIds
-
oldModes
private FileMode[] oldModes
-
-
Method Detail
-
getHunks
public java.util.List<? extends CombinedHunkHeader> getHunks()
Get hunks altering this file; in order of appearance in patch- Overrides:
getHunks
in classFileHeader
- Returns:
- hunks altering this file; in order of appearance in patch.
-
getParentCount
public int getParentCount()
- Overrides:
getParentCount
in classFileHeader
- Returns:
- number of ancestor revisions mentioned in this diff.
-
getOldMode
public FileMode getOldMode()
Get the old file mode- Overrides:
getOldMode
in classDiffEntry
- Returns:
- get the file mode of the first parent.
-
getOldMode
public FileMode getOldMode(int nthParent)
Get the file mode of the nth ancestor- Parameters:
nthParent
- the ancestor to get the mode of- Returns:
- the mode of the requested ancestor.
-
getOldId
public AbbreviatedObjectId getOldId()
Get the old object id from theindex
.
-
getOldId
public AbbreviatedObjectId getOldId(int nthParent)
Get the ObjectId of the nth ancestor- Parameters:
nthParent
- the ancestor to get the object id of- Returns:
- the id of the requested ancestor.
-
getScriptText
public java.lang.String getScriptText(java.nio.charset.Charset ocs, java.nio.charset.Charset ncs)
Convert the patch script for this file into a string.- Overrides:
getScriptText
in classFileHeader
- Parameters:
ocs
- hint character set to decode the old lines with.ncs
- hint character set to decode the new lines with.- Returns:
- the patch script, as a Unicode string.
-
getScriptText
public java.lang.String getScriptText(java.nio.charset.Charset[] charsetGuess)
Convert the patch script for this file into a string.
- Overrides:
getScriptText
in classFileHeader
-
parseGitHeaders
int parseGitHeaders(int ptr, int end)
- Overrides:
parseGitHeaders
in classFileHeader
-
parseIndexLine
protected void parseIndexLine(int ptr, int eol)
- Overrides:
parseIndexLine
in classFileHeader
-
parseNewFileMode
protected void parseNewFileMode(int ptr, int eol)
- Overrides:
parseNewFileMode
in classFileHeader
-
newHunkHeader
HunkHeader newHunkHeader(int offset)
- Overrides:
newHunkHeader
in classFileHeader
-
parseModeLine
private void parseModeLine(int ptr, int eol)
-
parseDeletedFileMode
private void parseDeletedFileMode(int ptr, int eol)
-
-