Class WorkingTree
-
- All Implemented Interfaces:
public abstract class WorkingTreeA 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.
-
-
Field Summary
Fields Modifier and Type Field Description private final FileworkingDirprivate final VcsTypevcsType
-
Constructor Summary
Constructors Constructor Description WorkingTree(File workingDir, VcsType vcsType)
-
Method Summary
Modifier and Type Method Description final FilegetWorkingDir()final VcsTypegetVcsType()VcsInfogetInfo()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 BooleanisValid()Return true if the workingDir is managed by this VCS, false otherwise. abstract BooleanisShallow()Return whether this is a shallow working tree with truncated history. abstract StringgetRemoteUrl()Return the clone URL of the associated remote repository. abstract StringgetRevision()Return the VCS-specific working tree revision. abstract FilegetRootPath()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 StringguessRevisionName(String project, String version)Search tags / symbolic names for fixed VCS revisions for a match based on the given project and version. final StringgetPathToRoot(File path)Return the relative path to path with respect to the VCS root. -
-
Constructor Detail
-
WorkingTree
WorkingTree(File workingDir, VcsType vcsType)
-
-
Method Detail
-
getWorkingDir
final File getWorkingDir()
-
getVcsType
final VcsType getVcsType()
-
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.
-
isValid
abstract Boolean isValid()
Return true if the workingDir is managed by this VCS, false otherwise.
-
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.
-
listRemoteBranches
abstract List<String> listRemoteBranches()
Return the list of branches available in the remote repository.
-
listRemoteTags
abstract List<String> listRemoteTags()
Return the list of tags available in the remote repository.
-
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.
-
getPathToRoot
final String getPathToRoot(File path)
Return the relative path to path with respect to the VCS root.
-
-
-
-