/** * Open new transport instances to connect two repositories. * * @param local existing local repository. * @param remote location of the remote repository - may be URI or remote configuration name. * @param op planned use of the returned Transport; the URI may differ based on the type of * connection desired. * @return the list of new transport instances for every URI in remote configuration. * @throws URISyntaxException the location is not a remote defined in the configuration file and * is not a well-formed URL. * @throws NotSupportedException the protocol specified is not supported. */ public static List<Transport> openAll( final Repository local, final String remote, final Operation op) throws NotSupportedException, URISyntaxException { final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote); if (doesNotExist(cfg)) { final ArrayList<Transport> transports = new ArrayList<Transport>(1); transports.add(open(local, new URIish(remote))); return transports; } return openAll(local, cfg, op); }
/** * Create a new transport instance. * * @param local the repository this instance will fetch into, or push out of. This must be the * repository passed to {@link #open(Repository, URIish)}. * @param uri the URI used to access the remote repository. This must be the URI passed to {@link * #open(Repository, URIish)}. */ protected Transport(final Repository local, final URIish uri) { final TransferConfig tc = local.getConfig().getTransfer(); this.local = local; this.uri = uri; this.checkFetchedObjects = tc.isFsckObjects(); }
/** * Open a new transport instance to connect two repositories. * * @param local existing local repository. * @param remote location of the remote repository - may be URI or remote configuration name. * @param op planned use of the returned Transport; the URI may differ based on the type of * connection desired. * @return the new transport instance. Never null. In case of multiple URIs in remote * configuration, only the first is chosen. * @throws URISyntaxException the location is not a remote defined in the configuration file and * is not a well-formed URL. * @throws NotSupportedException the protocol specified is not supported. */ public static Transport open(final Repository local, final String remote, final Operation op) throws NotSupportedException, URISyntaxException { final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote); if (doesNotExist(cfg)) return open(local, new URIish(remote)); return open(local, cfg, op); }