extract utility

Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/3534860d
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/3534860d
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/3534860d

Branch: refs/heads/master
Commit: 3534860d069aa6afdb418a010051ff2d921c6149
Parents: 6ca4c9c
Author: imod <d...@fortysix.ch>
Authored: Thu Jun 20 16:46:10 2013 +0200
Committer: imod <d...@fortysix.ch>
Committed: Thu Jun 20 16:46:10 2013 +0200

----------------------------------------------------------------------
 .../git/jgit/command/diff/JGitDiffCommand.java  | 22 ++------------------
 1 file changed, 2 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/3534860d/src/main/java/org/apache/maven/scm/provider/git/jgit/command/diff/JGitDiffCommand.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/maven/scm/provider/git/jgit/command/diff/JGitDiffCommand.java
 
b/src/main/java/org/apache/maven/scm/provider/git/jgit/command/diff/JGitDiffCommand.java
index db77fe9..cd4c5ae 100644
--- 
a/src/main/java/org/apache/maven/scm/provider/git/jgit/command/diff/JGitDiffCommand.java
+++ 
b/src/main/java/org/apache/maven/scm/provider/git/jgit/command/diff/JGitDiffCommand.java
@@ -11,18 +11,17 @@ import java.util.Map;
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
-import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmResult;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.diff.AbstractDiffCommand;
 import org.apache.maven.scm.command.diff.DiffScmResult;
 import org.apache.maven.scm.provider.ScmProviderRepository;
 import org.apache.maven.scm.provider.git.command.GitCommand;
+import org.apache.maven.scm.provider.git.jgit.command.JGitUtils;
 import org.codehaus.plexus.util.StringUtils;
 import org.eclipse.jgit.api.DiffCommand;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.diff.DiffEntry;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.ObjectReader;
 import org.eclipse.jgit.lib.Repository;
@@ -61,7 +60,7 @@ public class JGitDiffCommand extends AbstractDiffCommand 
implements GitCommand {
                        Map<String, CharSequence> differences = new 
HashMap<String, CharSequence>();
 
                        for (DiffEntry diffEntry : entries) {
-                               changedFiles.add(new 
ScmFile(diffEntry.getNewPath(), 
getFileStatusForModificationType(diffEntry.getChangeType())));
+                               changedFiles.add(new 
ScmFile(diffEntry.getNewPath(), 
JGitUtils.getScmFileStatus(diffEntry.getChangeType())));
                        }
 
                        return new DiffScmResult(changedFiles, differences, 
out.toString(), new ScmResult("JGit diff", "diff", null, true));
@@ -70,23 +69,6 @@ public class JGitDiffCommand extends AbstractDiffCommand 
implements GitCommand {
                }
        }
 
-       private ScmFileStatus getFileStatusForModificationType(ChangeType 
changeType) {
-               switch (changeType) {
-               case ADD:
-                       return ScmFileStatus.ADDED;
-               case MODIFY:
-                       return ScmFileStatus.MODIFIED;
-               case DELETE:
-                       return ScmFileStatus.DELETED;
-               case RENAME:
-                       return ScmFileStatus.RENAMED;
-               case COPY:
-                       return ScmFileStatus.COPIED;
-               default:
-                       return ScmFileStatus.UNKNOWN;
-               }
-       }
-
        private AbstractTreeIterator getTreeIterator(Repository repo, String 
name) throws IOException {
                final ObjectId id = repo.resolve(name);
                if (id == null)

Reply via email to