use of git4idea.commands.GitLineHandler in project intellij-community by JetBrains.
the class GitStash method perform.
/**
* {@inheritDoc}
*/
protected void perform(@NotNull final Project project, @NotNull final List<VirtualFile> gitRoots, @NotNull final VirtualFile defaultRoot) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not stash changes now"))
return;
GitStashDialog d = new GitStashDialog(project, gitRoots, defaultRoot);
if (!d.showAndGet()) {
return;
}
VirtualFile root = d.getGitRoot();
final GitLineHandler h = d.handler();
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
} finally {
token.finish();
}
VfsUtil.markDirtyAndRefresh(false, true, false, root);
if (!h.errors().isEmpty()) {
showErrors(project, getActionName(), h.errors());
}
}
use of git4idea.commands.GitLineHandler in project intellij-community by JetBrains.
the class GitResetHead method perform.
/**
* {@inheritDoc}
*/
protected void perform(@NotNull Project project, @NotNull List<VirtualFile> gitRoots, @NotNull VirtualFile defaultRoot) {
GitResetDialog d = new GitResetDialog(project, gitRoots, defaultRoot);
if (!d.showAndGet()) {
return;
}
GitLineHandler h = d.handler();
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
} finally {
token.finish();
}
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
manager.updateRepository(d.getGitRoot());
VfsUtil.markDirtyAndRefresh(true, true, false, d.getGitRoot());
if (!h.errors().isEmpty()) {
showErrors(project, getActionName(), h.errors());
}
}
use of git4idea.commands.GitLineHandler in project intellij-community by JetBrains.
the class GitPullDialog method makeHandler.
public GitLineHandler makeHandler(@NotNull List<String> urls) {
GitLineHandler h = new GitLineHandler(myProject, gitRoot(), GitCommand.PULL);
h.setUrls(urls);
h.addProgressParameter();
h.addParameters("--no-stat");
if (myNoCommitCheckBox.isSelected()) {
h.addParameters("--no-commit");
} else {
if (myAddLogInformationCheckBox.isSelected()) {
h.addParameters("--log");
}
}
if (mySquashCommitCheckBox.isSelected()) {
h.addParameters("--squash");
}
if (myNoFastForwardCheckBox.isSelected()) {
h.addParameters("--no-ff");
}
String strategy = (String) myStrategy.getSelectedItem();
if (!GitMergeUtil.DEFAULT_STRATEGY.equals(strategy)) {
h.addParameters("--strategy", strategy);
}
h.addParameters("-v");
h.addProgressParameter();
final List<String> markedBranches = myBranchChooser.getMarkedElements();
String remote = getRemote();
LOG.assertTrue(remote != null, "Selected remote can't be null here.");
// git pull origin master (remote branch name in the format local to that remote)
h.addParameters(remote);
for (String branch : markedBranches) {
h.addParameters(removeRemotePrefix(branch, remote));
}
return h;
}
use of git4idea.commands.GitLineHandler in project intellij-community by JetBrains.
the class GitStashDialog method handler.
public GitLineHandler handler() {
GitLineHandler handler = new GitLineHandler(myProject, getGitRoot(), GitCommand.STASH);
handler.addParameters("save");
if (myKeepIndexCheckBox.isSelected()) {
handler.addParameters("--keep-index");
}
final String msg = myMessageTextField.getText().trim();
if (msg.length() != 0) {
handler.addParameters(msg);
}
return handler;
}
use of git4idea.commands.GitLineHandler in project google-cloud-intellij by GoogleCloudPlatform.
the class CloudAttachDialog method stash.
private boolean stash() {
if (!syncResult.hasLocalRepository()) {
LOG.error("unexpected null local repro in call to stash");
return false;
}
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not stash changes now")) {
return false;
}
final GitLineHandler handler = new GitLineHandler(project, sourceRepository.getRoot(), GitCommand.STASH);
handler.addParameters("save");
handler.addParameters("--keep-index");
String date = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date());
stashMessage = "Cloud Debugger saved changes from branch " + originalBranchName + " at " + date;
handler.addParameters(stashMessage);
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
GitHandlerUtil.doSynchronously(handler, GitBundle.getString("stashing.title"), handler.printableCommandLine());
} finally {
token.finish();
}
return true;
}
Aggregations