|
|
|
@ -46,6 +46,7 @@ import java.net.URISyntaxException;
|
|
|
|
|
import java.text.MessageFormat; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@ -153,6 +154,28 @@ public class LsRemoteCommand extends
|
|
|
|
|
public Collection<Ref> call() throws GitAPIException, |
|
|
|
|
InvalidRemoteException, |
|
|
|
|
org.eclipse.jgit.api.errors.TransportException { |
|
|
|
|
return execute().values(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Same as {@link #call()}, but return Map instead of Collection. |
|
|
|
|
* |
|
|
|
|
* @return a map from names to references in the remote repository |
|
|
|
|
* @throws InvalidRemoteException |
|
|
|
|
* when called with an invalid remote uri |
|
|
|
|
* @throws org.eclipse.jgit.api.errors.TransportException |
|
|
|
|
* for errors that occurs during transport |
|
|
|
|
* @since 3.5 |
|
|
|
|
*/ |
|
|
|
|
public Map<String, Ref> callAsMap() throws GitAPIException, |
|
|
|
|
InvalidRemoteException, |
|
|
|
|
org.eclipse.jgit.api.errors.TransportException { |
|
|
|
|
return Collections.unmodifiableMap(execute()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Map<String, Ref> execute() throws GitAPIException, |
|
|
|
|
InvalidRemoteException, |
|
|
|
|
org.eclipse.jgit.api.errors.TransportException { |
|
|
|
|
checkCallable(); |
|
|
|
|
|
|
|
|
|
Transport transport = null; |
|
|
|
@ -184,7 +207,7 @@ public class LsRemoteCommand extends
|
|
|
|
|
refmap.put(r.getName(), r); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return refmap.values(); |
|
|
|
|
return refmap; |
|
|
|
|
} catch (URISyntaxException e) { |
|
|
|
|
throw new InvalidRemoteException(MessageFormat.format( |
|
|
|
|
JGitText.get().invalidRemote, remote)); |
|
|
|
|