Class LastModifiedRequest

java.lang.Object
com.atlassian.bitbucket.commit.AbstractCommitRequest
com.atlassian.bitbucket.commit.LastModifiedRequest

public class LastModifiedRequest extends AbstractCommitRequest
Describes a request to retrieve the commits that last modified the files in the specified path, from a given starting commit. The result should be similar to retrieving the latest commit for each file, but may be significantly more efficient since it can be done in a single request.
Since:
4.6
  • Method Details

    • getCommitId

      @Nonnull public String getCommitId()
      Retrieves the starting commit to use. This ID serves two purposes:
      • The path's file listing will use this commit
      • The process of searching for modifications will only consider ancestors of this commit
      Typically this commit will be the tip of a Branch or Tag. Depending on which files that commit directly modified, however, it's entirely possible none of the resulting last modified commits will be this one.
      Overrides:
      getCommitId in class AbstractCommitRequest
      Returns:
      the commit to serve as the starting point when searching for modifications
    • getPath

      @Nullable public String getPath()
      Retrieves the path where file modifications should be searched. Commits which modify files directly below this path will be traversed to determine the most recent commit to modify each file. null, "" and / all indicate the root directory.

      For example, consider a repository with the following contents. Entries ending with / are directories.

       src/
         main/
           java/
             Example.java
           resources/
             atlassian-plugin.xml
       pom.xml
       
      A request for the root directory will return the commit that last modified pom.xml, the only file in the root directory. A request for src/main will not return any modifications because that path only contains subdirectories.

      For performance reasons, there is no way to use this request to recursively find the last modification for files in subdirectories. Each level must be requested individually. This aligns with how streaming directories works when the recursive flag is false.

      Overrides:
      getPath in class AbstractCommitRequest
      Returns:
      the path whose file modifications should be searched, or null to search for file modifications in the root directory