Class WorkingTree

  • All Implemented Interfaces:

    
    public abstract class WorkingTree
    
                        

    A class representing a local VCS working tree. The passed workingDir does not necessarily need to be the root directory of the tree. The root directory can be determined by calling getRootPath.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final File workingDir
      private final VcsType vcsType
    • Constructor Summary

      Constructors 
      Constructor Description
      WorkingTree(File workingDir, VcsType vcsType)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final File getWorkingDir()
      final VcsType getVcsType()
      VcsInfo getInfo() Conveniently return all VCS information about how this working tree was created, so it could be easily recreated from that information.
      Map<String, VcsInfo> getNested() Return the map of nested repositories, for example Git submodules or Git-Repo modules.
      abstract Boolean isValid() Return true if the workingDir is managed by this VCS, false otherwise.
      abstract Boolean isShallow() Return whether this is a shallow working tree with truncated history.
      abstract String getRemoteUrl() Return the clone URL of the associated remote repository.
      abstract String getRevision() Return the VCS-specific working tree revision.
      abstract File getRootPath() Return the root directory of this working tree.
      abstract List<String> listRemoteBranches() Return the list of branches available in the remote repository.
      abstract List<String> listRemoteTags() Return the list of tags available in the remote repository.
      final String guessRevisionName(String project, String version) Search tags / symbolic names for fixed VCS revisions for a match based on the given project and version.
      final String getPathToRoot(File path) Return the relative path to path with respect to the VCS root.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WorkingTree

        WorkingTree(File workingDir, VcsType vcsType)
    • Method Detail

      • getInfo

         VcsInfo getInfo()

        Conveniently return all VCS information about how this working tree was created, so it could be easily recreated from that information. However, note that the returned path just contains the relative path of workingDir to getRootPath. It is not related to the path argument that was used for downloading, and at the example of Git, it does not reflect the (single) path that was cloned in a sparse checkout.

      • getNested

         Map<String, VcsInfo> getNested()

        Return the map of nested repositories, for example Git submodules or Git-Repo modules. The key is the path to the nested repository relative to the root of this working tree.

      • isShallow

         abstract Boolean isShallow()

        Return whether this is a shallow working tree with truncated history.

      • getRemoteUrl

         abstract String getRemoteUrl()

        Return the clone URL of the associated remote repository.

      • getRevision

         abstract String getRevision()

        Return the VCS-specific working tree revision.

      • getRootPath

         abstract File getRootPath()

        Return the root directory of this working tree.

      • guessRevisionName

         final String guessRevisionName(String project, String version)

        Search tags / symbolic names for fixed VCS revisions for a match based on the given project and version. Return the matching VCS revision (which is never blank), or throw an IOException if no or multiple matching revisions are found.