private void revalidateImpl(final RepositorySelection newRepoSelection) {
if (label.isDisposed() || !isCurrentPage())
return;
final ListRemoteOperation listRemoteOp;
final URIish uri = newRepoSelection.getURI();
try {
final Repository db = FileRepositoryBuilder
.create(new File("/tmp")); //$NON-NLS-1$
int timeout = Activator.getDefault().getPreferenceStore().getInt(
UIPreferences.REMOTE_CONNECTION_TIMEOUT);
listRemoteOp = new ListRemoteOperation(db, uri, timeout);
if (credentials != null)
listRemoteOp
.setCredentialsProvider(new EGitCredentialsProvider(
credentials.getUser(), credentials
.getPassword()));
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
listRemoteOp.run(monitor);
}
});
} catch (InvocationTargetException e) {
Throwable why = e.getCause();
transportError(why);
if (showDetailedFailureDialog())
SourceBranchFailureDialog.show(getShell(), uri);
return;
} catch (IOException e) {
transportError(UIText.SourceBranchPage_cannotCreateTemp);
return;
} catch (InterruptedException e) {
transportError(UIText.SourceBranchPage_remoteListingCancelled);
return;
}
final Ref idHEAD = listRemoteOp.getRemoteRef(Constants.HEAD);
head = null;
boolean headIsMaster = false;
final String masterBranchRef = Constants.R_HEADS + Constants.MASTER;
for (final Ref r : listRemoteOp.getRemoteRefs()) {
final String n = r.getName();
if (!n.startsWith(Constants.R_HEADS))
continue;
availableRefs.add(r);
if (idHEAD == null || headIsMaster)