public class DiffEntry
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DiffEntry.ChangeType
General type of change a single file-level patch describes.
|
static class |
DiffEntry.Side
Specify the old or new side for more generalized access.
|
Modifier and Type | Field and Description |
---|---|
protected DiffEntry.ChangeType |
changeType
General type of change indicated by the patch.
|
static java.lang.String |
DEV_NULL
Magical file name used for file adds or deletes.
|
protected AbbreviatedObjectId |
newId
ObjectId listed on the index line for the new (post-image)
|
protected FileMode |
newMode
New mode of the file, if described by the patch, else null.
|
protected java.lang.String |
newPath
File name of the new (post-image).
|
protected AbbreviatedObjectId |
oldId
ObjectId listed on the index line for the old (pre-image)
|
protected FileMode |
oldMode
Old mode of the file, if described by the patch, else null.
|
protected java.lang.String |
oldPath
File name of the old (pre-image).
|
protected int |
score
Similarity score if
changeType is a copy or rename. |
Modifier | Constructor and Description |
---|---|
protected |
DiffEntry()
Create an empty DiffEntry
|
Modifier and Type | Method and Description |
---|---|
DiffEntry.ChangeType |
getChangeType() |
AbbreviatedObjectId |
getId(DiffEntry.Side side)
Get the object id.
|
FileMode |
getMode(DiffEntry.Side side)
Get the mode associated with this file.
|
AbbreviatedObjectId |
getNewId()
Get the new object id from the
index . |
FileMode |
getNewMode() |
java.lang.String |
getNewPath()
Get the new name associated with this file.
|
AbbreviatedObjectId |
getOldId()
Get the old object id from the
index . |
FileMode |
getOldMode() |
java.lang.String |
getOldPath()
Get the old name associated with this file.
|
java.lang.String |
getPath(DiffEntry.Side side)
Get the path associated with this file.
|
int |
getScore() |
static java.util.List<DiffEntry> |
scan(TreeWalk walk)
Convert the TreeWalk into DiffEntry headers.
|
static java.util.List<DiffEntry> |
scan(TreeWalk walk,
boolean includeTrees)
Convert the TreeWalk into DiffEntry headers, depending on
includeTrees it will add tree objects into result or not. |
java.lang.String |
toString() |
public static final java.lang.String DEV_NULL
protected java.lang.String oldPath
protected java.lang.String newPath
protected FileMode oldMode
protected FileMode newMode
protected DiffEntry.ChangeType changeType
protected int score
changeType
is a copy or rename.protected AbbreviatedObjectId oldId
protected AbbreviatedObjectId newId
public static java.util.List<DiffEntry> scan(TreeWalk walk) throws java.io.IOException
walk
- the TreeWalk to walk through. Must have exactly two trees.java.io.IOException
- the repository cannot be accessed.java.lang.IllegalArgumentException
- When given TreeWalk doesn't have exactly two trees.public static java.util.List<DiffEntry> scan(TreeWalk walk, boolean includeTrees) throws java.io.IOException
includeTrees
it will add tree objects into result or not.walk
- the TreeWalk to walk through. Must have exactly two trees and
when includeTrees
parameter is true
it can't
be recursive.includeTrees
- include tree object's.java.io.IOException
- the repository cannot be accessed.java.lang.IllegalArgumentException
- when includeTrees
is true and given TreeWalk is
recursive. Or when given TreeWalk doesn't have exactly two
treespublic java.lang.String getOldPath()
The meaning of the old name can differ depending on the semantic meaning of this patch:
/dev/null
getNewPath()
public java.lang.String getNewPath()
The meaning of the new name can differ depending on the semantic meaning of this patch:
getOldPath()
/dev/null
public java.lang.String getPath(DiffEntry.Side side)
side
- which path to obtain.public FileMode getOldMode()
public FileMode getNewMode()
public FileMode getMode(DiffEntry.Side side)
side
- which mode to obtain.public DiffEntry.ChangeType getChangeType()
getNewPath()
public int getScore()
getOldPath()
and
getNewPath()
if getChangeType()
is
DiffEntry.ChangeType.COPY
or DiffEntry.ChangeType.RENAME
.public AbbreviatedObjectId getOldId()
index
.public AbbreviatedObjectId getNewId()
index
.public AbbreviatedObjectId getId(DiffEntry.Side side)
side
- the side of the id to get.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2012. All Rights Reserved.