Commits

Sebastian Sdorra committed 18ded2a

added recursive option to browse command

  • Participants
  • Parent commits 2a06bdd

Comments (0)

Files changed (2)

File scm-core/src/main/java/sonia/scm/repository/api/BrowseCommandBuilder.java

 
   /**
    * Disabling the last commit means that every call to
-   * {@link FileObject#getDescription()} and 
-   * {@link FileObject#getLastModified()) will return {@code null}, but this 
+   * {@link FileObject#getDescription()} and
+   * {@link FileObject#getLastModified()) will return {@code null}, but this
    * will also reduce the execution time.
    *
    *
    * @param disableLastCommit true to disable the last commit message
    *
    * @return {@code this}
-   * 
+   *
    * @since 1.26
    */
   public BrowseCommandBuilder setDisableLastCommit(boolean disableLastCommit)
   }
 
   /**
+   * Enable or disable recursive file object browsing. Default is disabled.
+   *
+   * @param recursive true to enable recursive browsing
+   *
+   * @return {@code this}
+   *
+   * @since 1.26
+   */
+  public BrowseCommandBuilder setRecursive(boolean recursive)
+  {
+    this.request.setRecursive(recursive);
+
+    return this;
+  }
+
+  /**
    * Retrieve only files of the given revision.
    *
    * @param revision revision for the files

File scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java

 
     final BrowseCommandRequest other = (BrowseCommandRequest) obj;
 
-    return super.equals(obj)
+    return super.equals(obj) && Objects.equal(recursive, other.recursive)
       && Objects.equal(disableLastCommit, other.disableLastCommit);
   }
 
   @Override
   public int hashCode()
   {
-    return Objects.hashCode(super.hashCode(), disableLastCommit);
+    return Objects.hashCode(super.hashCode(), recursive, disableLastCommit);
   }
 
   /**
     return Objects.toStringHelper(this)
                   .add("path", getPath())
                   .add("revision", getRevision())
+                  .add("recursive", recursive)
                   .add("disableLastCommit", disableLastCommit)
                   .toString();
     //J+
    *
    *
    * @param disableLastCommit true to disable the last commit
-   * 
+   *
    * @since 1.26
    */
   public void setDisableLastCommit(boolean disableLastCommit)
     this.disableLastCommit = disableLastCommit;
   }
 
+  /**
+   * True to enable recursive file object browsing.
+   *
+   *
+   * @param recursive true to enable recursive browsing
+   *
+   * @since 1.26
+   */
+  public void setRecursive(boolean recursive)
+  {
+    this.recursive = recursive;
+  }
+
   //~--- get methods ----------------------------------------------------------
 
   /**
    *
    *
    * @return true if the last commit is disabled
-   * 
+   *
    * @since 1.26
    */
   boolean isDisableLastCommit()
     return disableLastCommit;
   }
 
+  /**
+   * Returns true if recursive file object browsing is enabled.
+   *
+   *
+   * @return true recursive is enabled
+   *
+   * @since 1.26
+   */
+  boolean isRecursive()
+  {
+    return recursive;
+  }
+
   //~--- fields ---------------------------------------------------------------
 
   /** disable last commit */
   private boolean disableLastCommit = false;
+
+  /** browse file objects recursive */
+  private boolean recursive = false;
 }