mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 11:11:07 +01:00
added modifications support to svn changesetviewer
This commit is contained in:
@@ -40,10 +40,13 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
import org.tmatesoft.svn.core.SVNLogEntry;
|
||||
import org.tmatesoft.svn.core.SVNLogEntryPath;
|
||||
import org.tmatesoft.svn.core.SVNURL;
|
||||
import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
|
||||
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
@@ -51,6 +54,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -134,6 +138,35 @@ public class SvnChangesetViewer implements ChangesetViewer
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* TODO: type replaced
|
||||
*
|
||||
*
|
||||
* @param modifications
|
||||
* @param entry
|
||||
*/
|
||||
private void appendModification(Modifications modifications,
|
||||
SVNLogEntryPath entry)
|
||||
{
|
||||
switch (entry.getType())
|
||||
{
|
||||
case SVNLogEntryPath.TYPE_ADDED :
|
||||
modifications.getAdded().add(entry.getPath());
|
||||
|
||||
break;
|
||||
|
||||
case SVNLogEntryPath.TYPE_DELETED :
|
||||
modifications.getRemoved().add(entry.getPath());
|
||||
|
||||
break;
|
||||
|
||||
case SVNLogEntryPath.TYPE_MODIFIED :
|
||||
modifications.getModified().add(entry.getPath());
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -142,11 +175,25 @@ public class SvnChangesetViewer implements ChangesetViewer
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private Changeset createChangeset(SVNLogEntry entry)
|
||||
{
|
||||
return new Changeset(String.valueOf(entry.getRevision()),
|
||||
Changeset changeset = new Changeset(String.valueOf(entry.getRevision()),
|
||||
entry.getDate().getTime(), entry.getAuthor(),
|
||||
entry.getMessage());
|
||||
Map<String, SVNLogEntryPath> changeMap = entry.getChangedPaths();
|
||||
|
||||
if (Util.isNotEmpty(changeMap))
|
||||
{
|
||||
Modifications modifications = changeset.getModifications();
|
||||
|
||||
for (SVNLogEntryPath e : changeMap.values())
|
||||
{
|
||||
appendModification(modifications, e);
|
||||
}
|
||||
}
|
||||
|
||||
return changeset;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
@@ -349,6 +350,20 @@ public class Util
|
||||
return (collection == null) || collection.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param map
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isEmpty(Map<?, ?> map)
|
||||
{
|
||||
return (map == null) || map.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -404,6 +419,20 @@ public class Util
|
||||
return (collection != null) &&!collection.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param map
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean isNotEmpty(Map<?, ?> map)
|
||||
{
|
||||
return (map != null) &&!map.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user