https://github.com/dkandalov/vcs-reader
Minimal Java library for reading VCS commits (git, hg, svn)
https://github.com/dkandalov/vcs-reader
git mercurial svn vcs
Last synced: about 1 year ago
JSON representation
Minimal Java library for reading VCS commits (git, hg, svn)
- Host: GitHub
- URL: https://github.com/dkandalov/vcs-reader
- Owner: dkandalov
- License: other
- Created: 2014-07-27T10:18:58.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-06-05T22:52:08.000Z (almost 8 years ago)
- Last Synced: 2025-03-24T06:11:32.788Z (about 1 year ago)
- Topics: git, mercurial, svn, vcs
- Language: Java
- Homepage: http://vcsreader.org
- Size: 21.2 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## Vcs Reader
This is a library for Java (and JVM languages) with minimal API to read information about commits from version control systems (VCS).
It uses native commands to clone/update/log commits and supports
[Git](https://git-scm.com/),
[Mercurial](https://www.mercurial-scm.org/),
[Subversion](https://subversion.apache.org/).
### Why?
Libraries which can read commits from VCS usually support only one VCS
and have lots of additional features which make them complicated.
Vcs Reader was designed to support read-only access to multiple VCS with single API.
### How to install
Download (wget, curl, etc.) from here https://repo1.maven.org/maven2/org/vcsreader/vcsreader
Maven:
```xml
org.vcsreader
vcsreader
1.0.0
```
Gradle:
```groovy
repositories {
mavenCentral()
}
dependencies {
compile 'org.vcsreader:vcsreader:1.0.0'
}
```
### API Example (Java)
```java
public class ReadCommits {
public static void main(String[] args) {
VcsProject vcsProject = new VcsProject(new GitVcsRoot(".hamcrest-clone", "https://github.com/hamcrest/JavaHamcrest"));
if (!new File(".hamcrest-clone").exists()) {
System.out.println("Cloning...");
vcsProject.cloneIt();
}
LogResult logResult = vcsProject.log(TimeRange.beforeNow());
for (VcsCommit commit : logResult.commits()) {
System.out.println(commit.getDateTime() + " " + commit.getAuthor());
}
}
}
```
You can find more examples [here](https://github.com/dkandalov/vcs-reader-examples).
### Features
- Log commits and changed files (including their content) within date range.
- Automatic detection of file content charset and its conversion to Java string.
- Clone and update repository (for git and hg).
- Access to private repos which require authentication by VCS command line.
This has to be setup to automatically authenticate (e.g. using VCS config or SSH keys).
- Ignored merge commits with only changes by original author reported.
- Filtering for Svn to include changes only under source root (and exclude changes under other locations).