diff options
author | Bernard Leach <leachbj@bouncycastle.org> | 2011-04-20 07:51:40 +1000 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-04-19 17:11:01 -0500 |
commit | 1a867d10b974cab4d43d77f5b392f4f07807ebd8 (patch) | |
tree | 9a9b47b5568b5d4ec01dfd54c4952d2f0dae279c /org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java | |
parent | b69284f72d717f50981c822edbff1dc3313cdd58 (diff) | |
download | jgit-1a867d10b974cab4d43d77f5b392f4f07807ebd8.tar.gz jgit-1a867d10b974cab4d43d77f5b392f4f07807ebd8.zip |
Added support to IndexDiff to return information on conflicts
Change-Id: I43c13eb72a44f80135c93525fce0c0280b0e64a2
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java index 73bda08581..b2c05ae5f7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java @@ -52,6 +52,7 @@ import java.util.HashSet; import java.util.Set; import org.eclipse.jgit.dircache.DirCache; +import org.eclipse.jgit.dircache.DirCacheEntry; import org.eclipse.jgit.dircache.DirCacheIterator; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; @@ -76,6 +77,7 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter; * <li>removed files</li> * <li>missing files</li> * <li>modified files</li> + * <li>conflicting files</li> * <li>untracked files</li> * <li>files with assume-unchanged flag</li> * </ul> @@ -153,6 +155,8 @@ public class IndexDiff { private Set<String> untracked = new HashSet<String>(); + private Set<String> conflicts = new HashSet<String>(); + private Set<String> assumeUnchanged; private DirCache dirCache; @@ -320,6 +324,12 @@ public class IndexDiff { modified.add(treeWalk.getPathString()); } } + + final DirCacheEntry dirCacheEntry = dirCacheIterator + .getDirCacheEntry(); + if (dirCacheEntry != null && dirCacheEntry.getStage() > 0) { + conflicts.add(treeWalk.getPathString()); + } } } @@ -378,6 +388,13 @@ public class IndexDiff { } /** + * @return list of files that are in conflict + */ + public Set<String> getConflicting() { + return conflicts; + } + + /** * @return list of files with the flag assume-unchanged */ public Set<String> getAssumeUnchanged() { |