|
|
|
@ -4,20 +4,28 @@ import java.io.BufferedInputStream;
@@ -4,20 +4,28 @@ import java.io.BufferedInputStream;
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.net.URI; |
|
|
|
|
import java.nio.file.Path; |
|
|
|
|
import java.nio.file.Paths; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.Enumeration; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.zip.ZipEntry; |
|
|
|
|
import java.util.zip.ZipFile; |
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.api.CheckoutCommand; |
|
|
|
|
import org.eclipse.jgit.api.FetchCommand; |
|
|
|
|
import org.eclipse.jgit.api.Git; |
|
|
|
|
import org.eclipse.jgit.api.LsRemoteCommand; |
|
|
|
|
import org.eclipse.jgit.api.PullCommand; |
|
|
|
|
import org.eclipse.jgit.api.Status; |
|
|
|
|
import org.eclipse.jgit.api.errors.GitAPIException; |
|
|
|
|
import org.eclipse.jgit.api.errors.InvalidRemoteException; |
|
|
|
|
import org.eclipse.jgit.api.errors.TransportException; |
|
|
|
|
import org.eclipse.jgit.diff.DiffEntry; |
|
|
|
|
import org.eclipse.jgit.lib.Ref; |
|
|
|
|
import org.eclipse.jgit.lib.Repository; |
|
|
|
|
import org.eclipse.jgit.revwalk.RevCommit; |
|
|
|
|
import org.eclipse.jgit.transport.FetchResult; |
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.exc.StreamReadException; |
|
|
|
@ -155,10 +163,29 @@ public class GitListener {
@@ -155,10 +163,29 @@ public class GitListener {
|
|
|
|
|
} |
|
|
|
|
Git git = new Git(ear.getRepo()); |
|
|
|
|
|
|
|
|
|
Collection<Ref> c= git.lsRemote().call(); |
|
|
|
|
for (Ref ref : c) { |
|
|
|
|
System.out.println("ref >>>>>>>>>> " + ref); |
|
|
|
|
//получаем сведения об удаленных комитах
|
|
|
|
|
git.fetch().call(); |
|
|
|
|
//System.out.println(">>>>>>>>>>>>>>>>>>>" + git.fetch().getRemote());
|
|
|
|
|
Status status = git.status().call(); |
|
|
|
|
System.out.println("Git Change: " + status.getChanged()); |
|
|
|
|
System.out.println("Git Modified: " + status.getModified()); |
|
|
|
|
System.out.println("Git UncommittedChanges: " + status.getUncommittedChanges()); |
|
|
|
|
System.out.println("Git Untracked: " + status.getUntracked()); |
|
|
|
|
|
|
|
|
|
//выводим список комитов
|
|
|
|
|
try { |
|
|
|
|
for (RevCommit c : git.log().all().call()) |
|
|
|
|
System.out.println(c + ": " + c.getShortMessage()); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
System.out.println("git.log().all().call() >>>>>>> " + e.getMessage()); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
//забираем обновления с удаленного репозитария
|
|
|
|
|
// CheckoutCommand checkout = git.checkout();
|
|
|
|
|
// checkout.setName("master");
|
|
|
|
|
// checkout.call();
|
|
|
|
|
// PullCommand pullCmd = git.pull();
|
|
|
|
|
// pullCmd.call();
|
|
|
|
|
git.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|