use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.
the class GitRepositoriesViewFetchAndPushTest method testFetchFromOrigin.
private void testFetchFromOrigin(boolean useRemote) throws Exception {
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile);
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile2);
Repository repository = lookupRepository(clonedRepositoryFile2);
// add the configuration for push from cloned2
repository.getConfig().setString("remote", "origin", "push", "refs/heads/*:refs/heads/*");
repository.getConfig().save();
SWTBotTree tree = getOrOpenView().bot().tree();
String destinationString = clonedRepositoryFile.getParentFile().getName() + " - " + "origin";
String dialogTitle = NLS.bind(UIText.FetchResultDialog_title, destinationString);
selectNode(tree, useRemote, true);
runFetch(tree);
bot.waitUntil(Conditions.shellIsActive(dialogTitle));
SWTBotShell confirm = bot.shell(dialogTitle);
assertEquals("Wrong result tree row count", 0, confirm.bot().tree().rowCount());
confirm.close();
deleteAllProjects();
shareProjects(clonedRepositoryFile2);
String objid = repository.exactRef("refs/heads/master").getTarget().getObjectId().name();
objid = objid.substring(0, 7);
touchAndSubmit(null);
// push from other repository
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 60, TimeUnit.SECONDS);
PushOperationUI op = new PushOperationUI(repository, "origin", false);
op.start();
TestUtil.openJobResultDialog(jobJoiner.join());
String pushdialogTitle = NLS.bind(UIText.PushResultDialog_title, op.getDestinationString());
bot.shell(pushdialogTitle).close();
deleteAllProjects();
refreshAndWait();
selectNode(tree, useRemote, true);
runFetch(tree);
bot.waitUntil(Conditions.shellIsActive(dialogTitle));
confirm = bot.shell(dialogTitle);
SWTBotTreeItem[] treeItems = confirm.bot().tree().getAllItems();
boolean found = false;
for (SWTBotTreeItem item : treeItems) {
found = item.getText().contains(objid);
if (found)
break;
}
assertTrue(found);
confirm.close();
selectNode(tree, useRemote, true);
runFetch(tree);
confirm = bot.shell(dialogTitle);
assertEquals("Wrong result tree row count", 0, confirm.bot().tree().rowCount());
}
use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.
the class PushConfiguredRemoteCommand method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
RepositoryTreeNode node = getSelectedNodes(event).get(0);
RemoteConfig config = getRemoteConfig(node);
if (config == null) {
MessageDialog.openInformation(getShell(event), UIText.SimplePushActionHandler_NothingToPushDialogTitle, UIText.SimplePushActionHandler_NothingToPushDialogMessage);
return null;
}
new PushOperationUI(node.getRepository(), config.getName(), false).start();
return null;
}
use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.
the class SimplePushActionHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final Repository repository = getRepository(true, event);
if (repository == null)
return null;
RemoteConfig config = SimpleConfigurePushDialog.getConfiguredRemote(repository);
if (config == null) {
MessageDialog.openInformation(getShell(event), UIText.SimplePushActionHandler_NothingToPushDialogTitle, UIText.SimplePushActionHandler_NothingToPushDialogMessage);
return null;
}
PushOperationUI op = new PushOperationUI(repository, config.getName(), false);
op.start();
return null;
}
use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.
the class PushUpstreamOrBranchActionHandler method pushOrConfigure.
/**
* @param repository
* @param config
* @param shell
*/
public static void pushOrConfigure(final Repository repository, RemoteConfig config, Shell shell) {
if (config != null) {
PushOperationUI op = new PushOperationUI(repository, config.getName(), false);
op.start();
} else {
Ref head = getHeadIfSymbolic(repository);
if (head != null) {
PushBranchWizard pushBranchWizard = new PushBranchWizard(repository, head);
PushWizardDialog dlg = new PushWizardDialog(shell, pushBranchWizard);
dlg.open();
}
}
}
use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.
the class LocalRepositoryTestCase method createRemoteRepository.
protected File createRemoteRepository(File repositoryDir) throws Exception {
Repository myRepository = lookupRepository(repositoryDir);
File gitDir = new File(testDirectory, REPO2);
Repository myRemoteRepository = FileRepositoryBuilder.create(gitDir);
myRemoteRepository.create(true);
// double-check that this is bare
assertTrue(myRemoteRepository.isBare());
createStableBranch(myRepository);
// now we configure a pure push destination
myRepository.getConfig().setString("remote", "push", "pushurl", "file:///" + myRemoteRepository.getDirectory().getPath());
myRepository.getConfig().setString("remote", "push", "push", "+refs/heads/*:refs/heads/*");
// and a pure fetch destination
myRepository.getConfig().setString("remote", "fetch", "url", "file:///" + myRemoteRepository.getDirectory().getPath());
myRepository.getConfig().setString("remote", "fetch", "fetch", "+refs/heads/*:refs/heads/*");
// a destination with both fetch and push urls and specs
myRepository.getConfig().setString("remote", "both", "pushurl", "file:///" + myRemoteRepository.getDirectory().getPath());
myRepository.getConfig().setString("remote", "both", "push", "+refs/heads/*:refs/heads/*");
myRepository.getConfig().setString("remote", "both", "url", "file:///" + myRemoteRepository.getDirectory().getPath());
myRepository.getConfig().setString("remote", "both", "fetch", "+refs/heads/*:refs/heads/*");
// a destination with only a fetch url and push and fetch specs
myRepository.getConfig().setString("remote", "mixed", "push", "+refs/heads/*:refs/heads/*");
myRepository.getConfig().setString("remote", "mixed", "url", "file:///" + myRemoteRepository.getDirectory().getPath());
myRepository.getConfig().setString("remote", "mixed", "fetch", "+refs/heads/*:refs/heads/*");
myRepository.getConfig().save();
// and push
PushOperationUI pa = new PushOperationUI(myRepository, "push", false);
pa.execute(null);
try {
// delete the stable branch again
RefUpdate op = myRepository.updateRef("refs/heads/stable");
// $NON-NLS-1$
op.setRefLogMessage(// $NON-NLS-1$
"branch deleted", false);
// we set the force update in order
// to avoid having this rejected
// due to minor issues
op.setForceUpdate(true);
op.delete();
} catch (IOException ioe) {
throw new InvocationTargetException(ioe);
}
return myRemoteRepository.getDirectory();
}
Aggregations