From 3932c7e04838fe3cab733413b88c40b6b1111e1d Mon Sep 17 00:00:00 2001 From: esoe Date: Thu, 10 Nov 2022 17:01:07 +0300 Subject: [PATCH] test --- .../sourceListener/ListRemoteRepository.java | 66 ++++++++++++++++++ .../sourceListener/ListRemoteRepository.class | Bin 0 -> 2794 bytes 2 files changed, 66 insertions(+) create mode 100644 src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java create mode 100644 target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class diff --git a/src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java b/src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java new file mode 100644 index 0000000..03e1261 --- /dev/null +++ b/src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java @@ -0,0 +1,66 @@ +package ru.molokoin.sourceListener; +/* + Copyright 2013, 2014 Dominik Stadler + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.lib.Ref; + +import java.util.Collection; +import java.util.Map; + + +/** + * Simple snippet which shows how to list heads/tags of remote repositories without + * a local repository + * + * @author dominik.stadler at gmx.at + */ +public class ListRemoteRepository { + + private static final String REMOTE_URL = "http://molokoin.ru:3000/esoe/sourceListener.git"; + + public static void main(String[] args) throws GitAPIException { + // then clone + System.out.println("Listing remote repository " + REMOTE_URL); + Collection refs = Git.lsRemoteRepository() + .setHeads(true) + .setTags(true) + .setRemote(REMOTE_URL) + .call(); + + for (Ref ref : refs) { + System.out.println("Ref: " + ref); + } + + final Map map = Git.lsRemoteRepository() + .setHeads(true) + .setTags(true) + .setRemote(REMOTE_URL) + .callAsMap(); + + System.out.println("As map"); + for (Map.Entry entry : map.entrySet()) { + System.out.println("Key: " + entry.getKey() + ", Ref: " + entry.getValue()); + } + + refs = Git.lsRemoteRepository() + .setRemote(REMOTE_URL) + .call(); + + System.out.println("All refs"); + for (Ref ref : refs) { + System.out.println("Ref: " + ref); + } + } +} \ No newline at end of file diff --git a/target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class b/target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class new file mode 100644 index 0000000000000000000000000000000000000000..69d433145c21b02beaf41b703936a69de9811d1c GIT binary patch literal 2794 zcmb7GS#uOs6#i~9NlzvnfdFBbQ36cJ(g6fz27)05h?yjqgeXD9&g3%bq-T2U?m^;; z`@X;VY!%P)5R6(%SypNJ@$>l{Gvk@1|tZ@_d<Yf=VsTQYJz=_*`YsAX{*2`b989h;d!`Y}m{wMxC3bOjk}9M~|J9Vt`4*GautlKV zanpuO*;dYz#w?RC%$#LN*L7UaIAi&}=LX6e4cLYq8n#y;JT^}{GCFo*7t?m~L}7Em zwdEM+2(C|vrI|^Dv0Gq3kw(CyZa^HD5_8ctf*rvF*rVY=fsFy1mELr;Vy}RfQvuin zWOJ+<9ue$En}(Rc)~YxV038R=PM&OUWvvOsVr|K)ddcG9J|~kgv(t$PI$>z&5@@}b z^E$e5P$29{|Ex5pSqg2j$u+n-tm7eNK%;?iGwmt&M|EDRM+6!uD`X-NuLjD!XB5|w zz;V_bE7&H4L?fUg?_0Lf=h!x{9t$neh#owu;iSN(YWq5Raf;bmzI07qVpYA%Ee#aq zwDTBFYv?B%OLj`TI?muMW68>^EWu4B3(LAdLc`V{F zWlu{tjA4N~o{C2!7{obspZBV_Q5|C#=gl{BIhman=vc*jc#ixkGJ3rsGbga2ghIdwMZAPl zjJ4N`X3Sh8ropV)gqoJ%v=KI**WoI<>eJGvPy@XzYukm46*yNEzAvnRwFt=FVGU!R7NxtfW;^HVE!u;Dn z5>SVFt{T5;5ay4@(a5JxiNRHHtvhfNP2U7Z*72znfL&P6r(QUK4QS?912$q4jcn$7 zh&wIHOw9ql*U_7H16!N#UqJL*>0+`l03)t$dqn|Vg5G@Crsv51twA}qG;&~?POg^E_~;gZ!X zt=wKQiL=6fmIM*#O@D`MC|*-j4AZnWbx*AaAKl#EPJGKquiUWYJ6S&Fl34oC0~ zj^YN_A8-smA&y@-Y<}hYZ#aQJI8konB>q8