public class IndexDiff extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IndexDiff.StageState
Represents the state of the index for a certain path regarding the stages
- which stages exist for a path and which not (base, ours, theirs).
|
static interface |
IndexDiff.WorkingTreeIteratorFactory
A factory to producing WorkingTreeIterators
|
Constructor and Description |
---|
IndexDiff(Repository repository,
ObjectId objectId,
WorkingTreeIterator workingTreeIterator)
Construct an Indexdiff
|
IndexDiff(Repository repository,
String revstr,
WorkingTreeIterator workingTreeIterator)
Construct an IndexDiff
|
Modifier and Type | Method and Description |
---|---|
boolean |
diff()
Run the diff operation.
|
boolean |
diff(ProgressMonitor monitor,
int estWorkTreeSize,
int estIndexSize,
String title)
Run the diff operation.
|
Set<String> |
getAdded()
Get list of files added to the index, not in the tree
|
Set<String> |
getAssumeUnchanged()
Get list of files with the flag assume-unchanged
|
Set<String> |
getChanged()
Get list of files changed from tree to index
|
Set<String> |
getConflicting()
Get list of files that are in conflict, corresponds to the keys of
getConflictingStageStates() |
Map<String,IndexDiff.StageState> |
getConflictingStageStates()
Get the map from each path of
getConflicting() to its
corresponding IndexDiff.StageState |
Set<String> |
getIgnoredNotInIndex()
The method returns the list of ignored files and folders.
|
FileMode |
getIndexMode(String path)
Get the file mode of the given path in the index
|
Set<String> |
getMissing()
Get list of files in index, but not filesystem
|
Set<String> |
getModified()
Get list of files modified on disk relative to the index
|
Set<String> |
getPathsWithIndexMode(FileMode mode)
Get the list of paths that IndexDiff has detected to differ and have the
given file mode
|
Set<String> |
getRemoved()
Get list of files removed from index, but in tree
|
Set<String> |
getUntracked()
Get list of files that are not ignored, and not in the index.
|
Set<String> |
getUntrackedFolders()
Get list of folders containing only untracked files/folders
|
void |
setFilter(TreeFilter filter)
Sets a filter.
|
void |
setIgnoreSubmoduleMode(SubmoduleWalk.IgnoreSubmoduleMode mode)
Defines how modifications in submodules are treated
|
void |
setWorkingTreeItFactory(IndexDiff.WorkingTreeIteratorFactory wTreeIt)
Allows higher layers to set the factory for WorkingTreeIterators.
|
public IndexDiff(Repository repository, String revstr, WorkingTreeIterator workingTreeIterator) throws IOException
repository
- a Repository
object.revstr
- symbolic name e.g. HEAD An EmptyTreeIterator is used if
revstr
cannot be resolved.workingTreeIterator
- iterator for working directoryIOException
public IndexDiff(Repository repository, ObjectId objectId, WorkingTreeIterator workingTreeIterator) throws IOException
repository
- a Repository
object.objectId
- tree id. If null, an EmptyTreeIterator is used.workingTreeIterator
- iterator for working directoryIOException
public void setIgnoreSubmoduleMode(SubmoduleWalk.IgnoreSubmoduleMode mode)
mode
- defines how modifications in submodules are treatedpublic void setWorkingTreeItFactory(IndexDiff.WorkingTreeIteratorFactory wTreeIt)
wTreeIt
- public void setFilter(TreeFilter filter)
filter
- a TreeFilter
object.public boolean diff() throws IOException
diff(ProgressMonitor, int, int, String)
if a progress
monitor is required.IOException
public boolean diff(ProgressMonitor monitor, int estWorkTreeSize, int estIndexSize, String title) throws IOException
The operation may be aborted by the progress monitor. In that event it
will report what was found before the cancel operation was detected.
Callers should ignore the result if monitor.isCancelled() is true. If a
progress monitor is not needed, callers should use diff()
instead. Progress reporting is crude and approximate and only intended
for informing the user.
monitor
- for reporting progress, may be nullestWorkTreeSize
- number or estimated files in the working treeestIndexSize
- number of estimated entries in the cachetitle
- a String
object.IOException
public Set<String> getAdded()
public Set<String> getChanged()
public Set<String> getRemoved()
public Set<String> getMissing()
public Set<String> getModified()
public Set<String> getUntracked()
public Set<String> getConflicting()
getConflictingStageStates()
getConflictingStageStates()
public Map<String,IndexDiff.StageState> getConflictingStageStates()
getConflicting()
to its
corresponding IndexDiff.StageState
getConflicting()
to its
corresponding IndexDiff.StageState
public Set<String> getIgnoredNotInIndex()
public Set<String> getAssumeUnchanged()
public Set<String> getUntrackedFolders()
public FileMode getIndexMode(String path)
path
- a String
object.public Set<String> getPathsWithIndexMode(FileMode mode)
mode
- a FileMode
object.Copyright © 2017 Eclipse JGit Project. All rights reserved.