/** * Convert push remote refs update specification from * {@link org.eclipse.jgit.transport.RefSpec} form to * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands * wildcards by matching source part to local refs. expectedOldObjectId in * RemoteRefUpdate is set according to leases. Tracking branch is configured * if RefSpec destination matches source of any fetch ref spec for this * transport remote configuration. * <p> * Conversion is performed for context of this transport (database, fetch * specifications). * * @param specs * collection of RefSpec to convert. * @param leases * map from ref to lease (containing expected old object id) * @return collection of set up * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. * @throws java.io.IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. * @since 4.7 */ public Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Collection<RefSpec> specs, final Map<String, RefLeaseSpec> leases) throws IOException { return findRemoteRefUpdatesFor(local, specs, leases, fetch); }
/** * Convert push remote refs update specification from * {@link org.eclipse.jgit.transport.RefSpec} form to * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands * wildcards by matching source part to local refs. expectedOldObjectId in * RemoteRefUpdate is always set as null. Tracking branch is configured if * RefSpec destination matches source of any fetch ref spec for this * transport remote configuration. * <p> * Conversion is performed for context of this transport (database, fetch * specifications). * * @param specs * collection of RefSpec to convert. * @return collection of set up * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. * @throws java.io.IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. */ public Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Collection<RefSpec> specs) throws IOException { return findRemoteRefUpdatesFor(local, specs, Collections.emptyMap(), fetch); }
/** * Convert push remote refs update specification from * {@link org.eclipse.jgit.transport.RefSpec} form to * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands * wildcards by matching source part to local refs. expectedOldObjectId in * RemoteRefUpdate is always set as null. Tracking branch is configured if * RefSpec destination matches source of any fetch ref spec for this * transport remote configuration. * * @param db * local database. * @param specs * collection of RefSpec to convert. * @param fetchSpecs * fetch specifications used for finding localtracking refs. May * be null or empty collection. * @return collection of set up * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. * @throws java.io.IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. */ public static Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Repository db, final Collection<RefSpec> specs, Collection<RefSpec> fetchSpecs) throws IOException { return findRemoteRefUpdatesFor(db, specs, Collections.emptyMap(), fetchSpecs); }
toPush = findRemoteRefUpdatesFor(push); } catch (final IOException e) { throw new TransportException(MessageFormat.format(
.findRemoteRefUpdatesFor(refSpecs, refLeaseSpecs);
/** * Convert push remote refs update specification from {@link RefSpec} form * to {@link RemoteRefUpdate}. Conversion expands wildcards by matching * source part to local refs. expectedOldObjectId in RemoteRefUpdate is * always set as null. Tracking branch is configured if RefSpec destination * matches source of any fetch ref spec for this transport remote * configuration. * <p> * Conversion is performed for context of this transport (database, fetch * specifications). * * @param specs * collection of RefSpec to convert. * @return collection of set up {@link RemoteRefUpdate}. * @throws IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. */ public Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Collection<RefSpec> specs) throws IOException { return findRemoteRefUpdatesFor(local, specs, fetch); }
/** * Convert push remote refs update specification from * {@link org.eclipse.jgit.transport.RefSpec} form to * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands * wildcards by matching source part to local refs. expectedOldObjectId in * RemoteRefUpdate is set according to leases. Tracking branch is configured * if RefSpec destination matches source of any fetch ref spec for this * transport remote configuration. * <p> * Conversion is performed for context of this transport (database, fetch * specifications). * * @param specs * collection of RefSpec to convert. * @param leases * map from ref to lease (containing expected old object id) * @return collection of set up * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. * @throws java.io.IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. * @since 4.7 */ public Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Collection<RefSpec> specs, final Map<String, RefLeaseSpec> leases) throws IOException { return findRemoteRefUpdatesFor(local, specs, leases, fetch); }
/** * Convert push remote refs update specification from * {@link org.eclipse.jgit.transport.RefSpec} form to * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands * wildcards by matching source part to local refs. expectedOldObjectId in * RemoteRefUpdate is always set as null. Tracking branch is configured if * RefSpec destination matches source of any fetch ref spec for this * transport remote configuration. * <p> * Conversion is performed for context of this transport (database, fetch * specifications). * * @param specs * collection of RefSpec to convert. * @return collection of set up * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. * @throws java.io.IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. */ public Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Collection<RefSpec> specs) throws IOException { return findRemoteRefUpdatesFor(local, specs, Collections.emptyMap(), fetch); }
/** * Convert push remote refs update specification from * {@link org.eclipse.jgit.transport.RefSpec} form to * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. Conversion expands * wildcards by matching source part to local refs. expectedOldObjectId in * RemoteRefUpdate is always set as null. Tracking branch is configured if * RefSpec destination matches source of any fetch ref spec for this * transport remote configuration. * * @param db * local database. * @param specs * collection of RefSpec to convert. * @param fetchSpecs * fetch specifications used for finding localtracking refs. May * be null or empty collection. * @return collection of set up * {@link org.eclipse.jgit.transport.RemoteRefUpdate}. * @throws java.io.IOException * when problem occurred during conversion or specification set * up: most probably, missing objects or refs. */ public static Collection<RemoteRefUpdate> findRemoteRefUpdatesFor( final Repository db, final Collection<RefSpec> specs, Collection<RefSpec> fetchSpecs) throws IOException { return findRemoteRefUpdatesFor(db, specs, Collections.emptyMap(), fetchSpecs); }
.findRemoteRefUpdatesFor(repository, pushRefSpecs, config.getFetchRefSpecs()); spec.addURIRefUpdates(uri, remoteRefUpdates);
toPush = findRemoteRefUpdatesFor(push); } catch (final IOException e) { throw new TransportException(MessageFormat.format(
toPush = findRemoteRefUpdatesFor(push); } catch (final IOException e) { throw new TransportException(MessageFormat.format(
transport.findRemoteRefUpdatesFor(refSpecs);
pushSpecs.addAll(config.getPushRefSpecs()); final Collection<RemoteRefUpdate> updates = Transport .findRemoteRefUpdatesFor(localDb, pushSpecs, config.getFetchRefSpecs()); spec = new PushOperationSpecification(); .findRemoteRefUpdatesFor(localDb, refSpecPage .getRefSpecs(), fetchSpecs); if (updates.isEmpty()) {
.findRemoteRefUpdatesFor(refSpecs, refLeaseSpecs);
try { final Collection<RemoteRefUpdate> updates = Transport .findRemoteRefUpdatesFor(local, displayedRefSpecs, fetchSpecs); if (updates.isEmpty()) {
@Override public boolean performFinish() { try { int timeout = Activator.getDefault().getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); PushOperationSpecification specification = new PushOperationSpecification(); RepositorySelection remote = repoPage.getSelection(); RefSpec refSpec = new RefSpec(). setSourceDestination(pushObj.name(), targetPage.getTargetRef()). setForceUpdate(targetPage.isForceUpdate()); // Include fetchSpecs in calculation so that tracking refs are also updated RemoteConfig remoteConfig = remote.getConfig(); List<RefSpec> fetchSpecs = remoteConfig != null ? remoteConfig.getFetchRefSpecs() : null; Collection<RemoteRefUpdate> remoteRefUpdates = Transport .findRemoteRefUpdatesFor(repo, Collections.singleton(refSpec), fetchSpecs); specification.addURIRefUpdates(remote.getURI(true), remoteRefUpdates); PushOperation pop = new PushOperation(repo, specification, false, timeout); PushJob job = new PushWizard.PushJob(repo, pop, null, PushWizard.getDestinationString(remote)); job.setUser(true); job.schedule(); repoPage.saveUriInPrefs(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, true); } return true; }