1. Sebastian Sdorra
  2. scm-manager

Commits

Sebastian Sdorra  committed 2f9816b

improve performance and memory consumption of svn log command

  • Participants
  • Parent commits bf48a86
  • Branches default

Comments (0)

Files changed (2)

File scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnUtil.java

View file
  • Ignore whitespace
 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.collect.Lists;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
 //~--- JDK imports ------------------------------------------------------------
 
+import java.util.List;
 import java.util.Map;
 
 /**
    * @param entry
    */
   public static void appendModification(Modifications modifications,
-          SVNLogEntryPath entry)
+    SVNLogEntryPath entry)
   {
     appendModification(modifications, entry.getType(), entry.getPath());
   }
    * @param entry
    */
   public static void appendModification(Modifications modifications,
-          SVNChangeEntry entry)
+    SVNChangeEntry entry)
   {
     appendModification(modifications, entry.getType(), entry.getPath());
   }
    * @param path
    */
   public static void appendModification(Modifications modifications, char type,
-          String path)
+    String path)
   {
     if (path.startsWith("/"))
     {
    * Method description
    *
    *
+   * @param entries
+   *
+   * @return
+   */
+  public static List<Changeset> createChangesets(List<SVNLogEntry> entries)
+  {
+    List<Changeset> changesets = Lists.newArrayList();
+
+    for (SVNLogEntry entry : entries)
+    {
+      changesets.add(createChangeset(entry));
+    }
+
+    return changesets;
+  }
+
+  /**
+   * Method description
+   *
+   *
    * @param clientManager
    */
   public static void dispose(SVNClientManager clientManager)
    * @throws RepositoryException
    */
   public static long getRevisionNumber(String revision)
-          throws RepositoryException
+    throws RepositoryException
   {
     long revisionNumber = -1;
 

File scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/spi/SvnLogCommand.java

View file
  • Ignore whitespace
         pathArray = new String[] { request.getPath() };
       }
 
-      List<Changeset> changesetList = Lists.newArrayList();
+      List<SVNLogEntry> changesetList = Lists.newArrayList();
       Collection<SVNLogEntry> entries = repository.log(pathArray, null,
                                           startRev, endRev, true, true);
 
       {
         if (entry.getRevision() <= maxRev)
         {
-          changesetList.add(SvnUtil.createChangeset(entry));
+          changesetList.add(entry);
         }
       }
 
           start, end, total);
       }
 
-      changesetList = Lists.newArrayList(changesetList.subList(start, end));
-      changesets = new ChangesetPagingResult(total, changesetList);
+      changesetList = changesetList.subList(start, end);
+      changesets = new ChangesetPagingResult(total,
+        SvnUtil.createChangesets(changesetList));
     }
     catch (NumberFormatException ex)
     {