}
}
private PushOperation createPushOperation(boolean calledFromRepoPage) {
try {
final PushOperationSpecification spec;
final RemoteConfig config = repoPage.getSelection().getConfig();
if (calledFromRepoPage) {
// obtain the push ref specs from the configuration
// use our own list here, as the config returns a non-modifiable
// list
final Collection<RefSpec> pushSpecs = new ArrayList<RefSpec>();
pushSpecs.addAll(config.getPushRefSpecs());
final Collection<RemoteRefUpdate> updates = Transport
.findRemoteRefUpdatesFor(localDb, pushSpecs,
config.getFetchRefSpecs());
spec = new PushOperationSpecification();
for (final URIish uri : repoPage.getSelection().getPushURIs())
spec.addURIRefUpdates(uri, ConfirmationPage
.copyUpdates(updates));
} else if (confirmPage.isConfirmed()) {
final PushOperationResult confirmedResult = confirmPage
.getConfirmedResult();
spec = confirmedResult.deriveSpecification(confirmPage
.isRequireUnchangedSelected());
} else {
final Collection<RefSpec> fetchSpecs;
if (config != null)
fetchSpecs = config.getFetchRefSpecs();
else
fetchSpecs = null;
final Collection<RemoteRefUpdate> updates = Transport
.findRemoteRefUpdatesFor(localDb, refSpecPage
.getRefSpecs(), fetchSpecs);
if (updates.isEmpty()) {
ErrorDialog.openError(getShell(),
UIText.PushWizard_missingRefsTitle, null,
new Status(IStatus.ERROR, Activator.getPluginId(),
UIText.PushWizard_missingRefsMessage));
return null;
}
spec = new PushOperationSpecification();
for (final URIish uri : repoPage.getSelection().getPushURIs())
spec.addURIRefUpdates(uri, ConfirmationPage
.copyUpdates(updates));
}
int timeout = Activator.getDefault().getPreferenceStore().getInt(
UIPreferences.REMOTE_CONNECTION_TIMEOUT);
return new PushOperation(localDb, spec, false, timeout);