Git: Support staging a single chunk.

Add context menu in diff editor to stage/unstage a single chunk from the diff.

Task-number: QTCREATORBUG-5875
Change-Id: Ic244a0d84b5ed5f66b90d7fe8784fc1b8041d183
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Francois Ferrand
2013-09-24 14:44:22 +02:00
committed by Orgad Shaneh
parent c372f7b601
commit 367cfc8419
6 changed files with 99 additions and 9 deletions

View File

@@ -1115,6 +1115,8 @@ void GitClient::diff(const QString &workingDirectory,
workingDirectory,
argWidget);
newEditor = vcsEditor->editor();
connect(vcsEditor, SIGNAL(diffChunkApplied(VcsBase::DiffChunk)),
argWidget, SLOT(executeCommand()));
connect(vcsEditor, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)),
argWidget, SLOT(executeCommand()));
}
@@ -1222,6 +1224,8 @@ void GitClient::diff(const QString &workingDirectory,
sourceFile,
argWidget);
newEditor = vcsEditor->editor();
connect(vcsEditor, SIGNAL(diffChunkApplied(VcsBase::DiffChunk)),
argWidget, SLOT(executeCommand()));
connect(vcsEditor, SIGNAL(diffChunkReverted(VcsBase::DiffChunk)),
argWidget, SLOT(executeCommand()));
}
@@ -2433,10 +2437,11 @@ bool GitClient::synchronousCleanList(const QString &workingDirectory, QStringLis
}
bool GitClient::synchronousApplyPatch(const QString &workingDirectory,
const QString &file, QString *errorMessage)
const QString &file, QString *errorMessage,
const QStringList &arguments)
{
QStringList args;
args << QLatin1String("apply") << QLatin1String("--whitespace=fix") << file;
args << QLatin1String("apply") << QLatin1String("--whitespace=fix") << arguments << file;
QByteArray outputText;
QByteArray errorText;
const bool rc = fullySynchronousGit(workingDirectory, args, &outputText, &errorText);