gitective - mongo

gitective JGit MongoDB connector

License

License

GroupId

GroupId

org.gitective
ArtifactId

ArtifactId

gitective-mongo
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

gitective - mongo
gitective JGit MongoDB connector
Source Code Management

Source Code Management

https://github.com/kevinsawicki/jgit-mongo

Download gitective-mongo

How to add to project

<!-- https://jarcasting.com/artifacts/org.gitective/gitective-mongo/ -->
<dependency>
    <groupId>org.gitective</groupId>
    <artifactId>gitective-mongo</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.gitective/gitective-mongo/
implementation 'org.gitective:gitective-mongo:0.1'
// https://jarcasting.com/artifacts/org.gitective/gitective-mongo/
implementation ("org.gitective:gitective-mongo:0.1")
'org.gitective:gitective-mongo:jar:0.1'
<dependency org="org.gitective" name="gitective-mongo" rev="0.1">
  <artifact name="gitective-mongo" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.gitective', module='gitective-mongo', version='0.1')
)
libraryDependencies += "org.gitective" % "gitective-mongo" % "0.1"
[org.gitective/gitective-mongo "0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.mongodb : mongo-java-driver jar 2.7.3
org.eclipse.jgit : org.eclipse.jgit jar 1.3.0.201202151440-r
org.eclipse.jgit : org.eclipse.jgit.storage.dht jar 1.3.0.201202151440-r

Project Modules

There are no modules declared in this project.

JGit MongoDB connector

This project is a JGit DHT implementation using MongoDB as the backing database that uses the Mongo Java Driver library for connecting to MongoDB.

Example

The code snippet below shows how to fetch the linux-2.6 Git repository into MongoDB using a JGit repository.

Repository repo = MongoDatabase.open("linux-26");
repo.create(true);
StoredConfig config = repo.getConfig();
RemoteConfig remoteConfig = new RemoteConfig(config, "origin");
URIish uri = new URIish("git://github.com/mirrors/linux-2.6.git");
remoteConfig.addURI(uri);
remoteConfig.update(config);
config.save();
RefSpec spec = new RefSpec("refs/heads/*:refs/remotes/origin/*");
Git.wrap(repo).fetch().setRemote("origin").setRefSpecs(spec).call();

You could the walk the commits imported into MongoDB using the following:

Repository repo = MongoDatabase.open("linux-26");
RevWalk walk = new RevWalk(repo);
walk.markStart(walk.parseCommit(repo.resolve("origin/master")));
for (RevCommit commit : walk)
    System.out.println(commit.getShortMessage());

Building from source

The JGit-MongoDB connector can be built using Maven. The pom.xml to build the core plug-in is located at the root of the org.gitective.mongo folder.

cd jgit-mongo/org.gitective.mongo
mvn clean install

Dependencies

  • JGit
  • MongoDB Java Driver

License

MIT License

Versions

Version
0.1