Class Repository
java.lang.Object
org.variantsync.diffdetective.datasets.Repository
Representation of git repositories used as datasets for DiffDetective.
- Author:
- Kevin Jedelhauser, Paul Maximilian Bittner
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Path
private DiffFilter
Filter determining which files and commits to consider for diffs.private final org.variantsync.functjonal.Lazy<org.eclipse.jgit.api.Git>
private final Path
The local path where the repository can be found or should be cloned to.private PatchDiffParseOptions
Options to configure parsing and memory consumption (e.g., by not keeping full diffs in memory).private final URI
The remote url of the repository.private final RepositoryLocationType
The location from where the input repository is read from.private final String
The name of the repository. -
Constructor Summary
ConstructorDescriptionRepository
(RepositoryLocationType repoLocation, Path localPath, URI remote, String repositoryName) Creates repository of the given source and with all other settings set to default values.Repository
(RepositoryLocationType repoLocation, Path localPath, URI remote, String repositoryName, PatchDiffParseOptions parseOptions, DiffFilter diffFilter) Creates a repository. -
Method Summary
Modifier and TypeMethodDescriptionstatic Repository
fromDirectory
(Path dirPath, String repoName) Creates a repository from an existing directory.static Repository
fromRemote
(Path localPath, URI repoUri, String repoName) Creates a repository from a remote repository.static Repository
Creates a repository from a local zip file.The diff filter decides which commits and files should be considered for analyses.org.variantsync.functjonal.Lazy<org.eclipse.jgit.api.Git>
Returns the internal jgit representation of this repository that allows to inspect the repositories history and content.The path to the repository on disk.Options that should be used when parsing the evolution history.URI of the origin of this repository (i.e., usually the location on a server where this repository was cloned from).The name of this repository.private org.eclipse.jgit.api.Git
load()
Loads this repository and returns a jgit representation to access it.setDiffFilter
(DiffFilter filter) Set the diff filter for reading this repository.setParseOptions
(PatchDiffParseOptions parseOptions) Set options for parsing parts of this repository's evolution history.static Optional<Repository>
tryFromRemote
(Path localDir, String repoUri, String repoName) Creates a repository from a remote repository.
-
Field Details
-
DIFFDETECTIVE_DEFAULT_REPOSITORIES_DIRECTORY
-
repoLocation
The location from where the input repository is read from. -
localPath
The local path where the repository can be found or should be cloned to. -
remote
The remote url of the repository. May benull
if local. -
repositoryName
The name of the repository. Used for debugging. -
diffFilter
Filter determining which files and commits to consider for diffs. -
parseOptions
Options to configure parsing and memory consumption (e.g., by not keeping full diffs in memory). -
git
private final org.variantsync.functjonal.Lazy<org.eclipse.jgit.api.Git> git
-
-
Constructor Details
-
Repository
public Repository(RepositoryLocationType repoLocation, Path localPath, URI remote, String repositoryName, PatchDiffParseOptions parseOptions, DiffFilter diffFilter) Creates a repository.- Parameters:
repoLocation
-RepositoryLocationType
From which location the repository is read fromlocalPath
- The local path where the repository can be found or should be cloned to.remote
- The remote url of the repository. May benull
if local.repositoryName
- Name of the cloned repository (null
if local)parseOptions
- Omit some debug data to save RAM.diffFilter
- Filter determining which files and commits to consider for diffs.
-
Repository
public Repository(RepositoryLocationType repoLocation, Path localPath, URI remote, String repositoryName) Creates repository of the given source and with all other settings set to default values.- See Also:
-
-
Method Details
-
fromDirectory
Creates a repository from an existing directory.- Parameters:
dirPath
- The path to the repo directory relative to<WORKING_DIRECTORY>/repositories
repoName
- A name for the repository (currently not used)- Returns:
- A repository from an existing directory
-
fromZip
Creates a repository from a local zip file.- Parameters:
filePath
- The path to the zip file (absolute or relative to<WORKING_DIRECTORY>
).repoName
- A name for the repository (currently not used)- Returns:
- A repository from a local zip file
-
fromRemote
Creates a repository from a remote repository.- Parameters:
localPath
- Path to clone the repository to.repoUri
- The address of the remote repositoryrepoName
- Name of the folder, where the git repository is cloned to- Returns:
- A repository from a remote location (e.g. Github repository)
-
tryFromRemote
Creates a repository from a remote repository.- Parameters:
localDir
- Directory to clone the repository to.repoUri
- The address of the remote repositoryrepoName
- Name of the folder, where the git repository is cloned to- Returns:
- A repository from a remote location (e.g. Github repository)
-
getRepoLocation
- Returns:
- the location type indicating how this repository is stored.
-
getLocalPath
The path to the repository on disk. The path points to the root directory of the repository if the repository is stored in a directory. The path points to a zip file if the repository is stored in a zip file. The path points to a (possibly not existing) directory to which the repository should be cloned to if the repository is stored on a remote server.- Returns:
- The path to the repository on disk.
- See Also:
-
getRemoteURI
URI of the origin of this repository (i.e., usually the location on a server where this repository was cloned from). -
getRepositoryName
The name of this repository. Should be unique. -
setParseOptions
Set options for parsing parts of this repository's evolution history.- Parameters:
parseOptions
- Options for parsing the evolution history.- Returns:
- this
-
setDiffFilter
Set the diff filter for reading this repository. The diff filter decides which commits and files should be considered for analyses.- Parameters:
filter
- Filter to apply when traversing this repository's commit history.- Returns:
- this
-
getDiffFilter
The diff filter decides which commits and files should be considered for analyses. -
getParseOptions
Options that should be used when parsing the evolution history. -
getGitRepo
public org.variantsync.functjonal.Lazy<org.eclipse.jgit.api.Git> getGitRepo()Returns the internal jgit representation of this repository that allows to inspect the repositories history and content. -
load
private org.eclipse.jgit.api.Git load()Loads this repository and returns a jgit representation to access it.
-