esoe 2 years ago
parent
commit
f514ae61cc
  1. 6
      src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java
  2. 19
      src/main/java/ru/molokoin/sourceListener/SourceListener.java
  3. BIN
      target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class
  4. BIN
      target/classes/ru/molokoin/sourceListener/SourceListener.class

6
src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java

@ -32,7 +32,7 @@ public class ListRemoteRepository { @@ -32,7 +32,7 @@ public class ListRemoteRepository {
public static void main(String[] args) throws GitAPIException {
// then clone
System.out.println("Listing remote repository " + REMOTE_URL);
System.out.println("Listing remote repository: " + REMOTE_URL);
Collection<Ref> refs = Git.lsRemoteRepository()
.setHeads(true)
.setTags(true)
@ -40,7 +40,7 @@ public class ListRemoteRepository { @@ -40,7 +40,7 @@ public class ListRemoteRepository {
.call();
for (Ref ref : refs) {
System.out.println("Ref: " + ref);
System.out.println("Ref>>>>>>>>: " + ref);
}
final Map<String, Ref> map = Git.lsRemoteRepository()
@ -60,7 +60,7 @@ public class ListRemoteRepository { @@ -60,7 +60,7 @@ public class ListRemoteRepository {
System.out.println("All refs");
for (Ref ref : refs) {
System.out.println("Ref: " + ref);
System.out.println(">>>>>Ref: " + ref.getStorage().name() + ">>>>>" + ref.getName());
}
}
}

19
src/main/java/ru/molokoin/sourceListener/SourceListener.java

@ -18,6 +18,7 @@ import org.eclipse.jgit.api.Git; @@ -18,6 +18,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.GitCommand;
import org.eclipse.jgit.events.RepositoryListener;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.databind.DatabindException;
@ -52,19 +53,23 @@ public class SourceListener { @@ -52,19 +53,23 @@ public class SourceListener {
* @return
*/
public boolean isUpdated(){
//
//Repository repository = Git.lsRemoteRepository().setRemote(opt.getLinkVC()).getRepository();
//git remote add <remote_name> <remote_uri>
//Git.lsRemoteRepository()
try {
System.out.println(Git.lsRemoteRepository().);
Repository rep = openJGitCookbookRepository();
System.out.println(">>" + rep.getIdentifier());
} catch (IOException e) {
System.out.println(e.getMessage());
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
public static Repository openJGitCookbookRepository() throws IOException {
FileRepositoryBuilder builder = new FileRepositoryBuilder();
return builder
.readEnvironment() // scan environment GIT_* variables
.findGitDir() // scan up the file system tree
.build();
}
/**
* Извлечение данных из options.json
* @return

BIN
target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class

Binary file not shown.

BIN
target/classes/ru/molokoin/sourceListener/SourceListener.class

Binary file not shown.
Loading…
Cancel
Save