diff options
author | Shawn Pearce <spearce@spearce.org> | 2010-12-29 14:29:49 -0500 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2010-12-29 14:29:49 -0500 |
commit | 4170913b1bcc7d63813da4fd83d19ea2ba646775 (patch) | |
tree | 0bb0d17529d98b2ee4d12141933f83b09bcc1fc4 /org.eclipse.jgit | |
parent | f0ca6b558504d2a7c5a0e6ea88c6fa1fac12da34 (diff) | |
parent | e272ca0f1429440af3fde06387b8815a7f9d4547 (diff) | |
download | jgit-4170913b1bcc7d63813da4fd83d19ea2ba646775.tar.gz jgit-4170913b1bcc7d63813da4fd83d19ea2ba646775.zip |
Merge "CheckoutResult: return paths instead of Files"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java | 19 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java | 15 |
2 files changed, 12 insertions, 22 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java index cb261a0ace..dcd8fc3fc5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java @@ -42,11 +42,8 @@ */ package org.eclipse.jgit.api; -import java.io.File; import java.io.IOException; import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; import org.eclipse.jgit.JGitText; import org.eclipse.jgit.api.CheckoutResult.Status; @@ -141,11 +138,8 @@ public class CheckoutCommand extends GitCommand<Ref> { try { dco.checkout(); } catch (CheckoutConflictException e) { - List<File> fileList = new ArrayList<File>(); - for (String filePath : dco.getConflicts()) { - fileList.add(new File(repo.getWorkTree(), filePath)); - } - status = new CheckoutResult(Status.CONFLICTS, fileList); + status = new CheckoutResult(Status.CONFLICTS, dco + .getConflicts()); throw e; } Ref ref = repo.getRef(name); @@ -183,12 +177,9 @@ public class CheckoutCommand extends GitCommand<Ref> { throw new JGitInternalException(MessageFormat.format(JGitText .get().checkoutUnexpectedResult, updateResult.name())); - if (!repo.isBare() && !dco.getToBeDeleted().isEmpty()) { - List<File> fileList = new ArrayList<File>(); - for (String filePath : dco.getToBeDeleted()) { - fileList.add(new File(repo.getWorkTree(), filePath)); - } - status = new CheckoutResult(Status.NONDELETED, fileList); + if (!dco.getToBeDeleted().isEmpty()) { + status = new CheckoutResult(Status.NONDELETED, dco + .getToBeDeleted()); } else status = CheckoutResult.OK_RESULT; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java index bddfe2be58..19b64229dd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java @@ -42,7 +42,6 @@ */ package org.eclipse.jgit.api; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -97,20 +96,20 @@ public class CheckoutResult { private final Status myStatus; - private final List<File> conflictList; + private final List<String> conflictList; - private final List<File> undeletedList; + private final List<String> undeletedList; - CheckoutResult(Status status, List<File> fileList) { + CheckoutResult(Status status, List<String> fileList) { myStatus = status; if (status == Status.CONFLICTS) this.conflictList = fileList; else - this.conflictList = new ArrayList<File>(0); + this.conflictList = new ArrayList<String>(0); if (status == Status.NONDELETED) this.undeletedList = fileList; else - this.undeletedList = new ArrayList<File>(0); + this.undeletedList = new ArrayList<String>(0); } @@ -125,7 +124,7 @@ public class CheckoutResult { * @return the list of files that created a checkout conflict, or an empty * list if {@link #getStatus()} is not {@link Status#CONFLICTS}; */ - public List<File> getConflictList() { + public List<String> getConflictList() { return conflictList; } @@ -134,7 +133,7 @@ public class CheckoutResult { * an empty list if {@link #getStatus()} is not * {@link Status#NONDELETED}; */ - public List<File> getUndeletedList() { + public List<String> getUndeletedList() { return undeletedList; } |