use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitRollbackEnvironment method resetHardLocal.
public static void resetHardLocal(final Project project, final VirtualFile root) {
GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.RESET);
handler.addParameters("--hard");
handler.endOptions();
GitHandlerUtil.runInCurrentThread(handler, null);
}
use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitNewChangesCollector method collectChanges.
// calls 'git status' and parses the output, feeding myChanges.
private void collectChanges(Collection<FilePath> dirtyPaths) throws VcsException {
GitSimpleHandler handler = statusHandler(dirtyPaths);
String output = handler.run();
parseOutput(output, handler);
}
use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitNewChangesCollector method statusHandler.
private GitSimpleHandler statusHandler(Collection<FilePath> dirtyPaths) {
GitSimpleHandler handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.STATUS);
// untracked files are stored separately
final String[] params = { "--porcelain", "-z", "--untracked-files=no" };
handler.addParameters(params);
handler.endOptions();
handler.addRelativePaths(dirtyPaths);
if (handler.isLargeCommandLine()) {
// if there are too much files, just get all changes for the project
handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.STATUS);
handler.addParameters(params);
handler.endOptions();
}
handler.setSilent(true);
return handler;
}
use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitOldChangesCollector method collectUnmergedAndUnversioned.
/**
* Collect unversioned and unmerged files
*
* @throws VcsException if there is a problem with running git
*/
private void collectUnmergedAndUnversioned() throws VcsException {
Collection<FilePath> dirtyPaths = dirtyPaths(false);
if (dirtyPaths.isEmpty()) {
return;
}
// prepare handler
GitSimpleHandler handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.LS_FILES);
handler.addParameters("-v", "--unmerged");
handler.setSilent(true);
handler.setStdoutSuppressed(true);
// run handler and collect changes
parseFiles(handler.run());
// prepare handler
handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.LS_FILES);
handler.addParameters("-v", "--others", "--exclude-standard");
handler.setSilent(true);
handler.setStdoutSuppressed(true);
handler.endOptions();
handler.addRelativePaths(dirtyPaths);
if (handler.isLargeCommandLine()) {
handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.LS_FILES);
handler.addParameters("-v", "--others", "--exclude-standard");
handler.setSilent(true);
handler.setStdoutSuppressed(true);
handler.endOptions();
}
// run handler and collect changes
parseFiles(handler.run());
}
use of git4idea.commands.GitSimpleHandler in project intellij-community by JetBrains.
the class GitAnnotationProvider method doAnnotate.
@NotNull
private GitFileAnnotation doAnnotate(@NotNull final FilePath repositoryFilePath, @Nullable final VcsRevisionNumber revision, @NotNull final VirtualFile file) throws VcsException {
setProgressIndicatorText(GitBundle.message("computing.annotation", file.getName()));
VirtualFile root = GitUtil.getGitRoot(repositoryFilePath);
GitSimpleHandler h = new GitSimpleHandler(myProject, root, GitCommand.BLAME);
h.setStdoutSuppressed(true);
h.addParameters("--porcelain", "-l", "-t", "-w");
if (revision == null) {
h.addParameters("HEAD");
} else {
h.addParameters(revision.asString());
}
h.endOptions();
h.addRelativePaths(repositoryFilePath);
String output = h.run();
GitFileAnnotation fileAnnotation = parseAnnotations(revision, file, root, output);
loadFileHistoryInBackground(fileAnnotation);
return fileAnnotation;
}
Aggregations