forked from qt-creator/qt-creator
GitClient: Replace DynamicSetup with dynamic task setup
Change-Id: I1a56e34274c5d7ace8fb8866c128c8dee03d2ad8 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -232,35 +232,31 @@ FileListDiffController::FileListDiffController(IDocument *document, const QStrin
|
|||||||
const TreeStorage<QString> diffInputStorage = inputStorage();
|
const TreeStorage<QString> diffInputStorage = inputStorage();
|
||||||
|
|
||||||
const auto setupStaged = [this, stagedFiles](QtcProcess &process) {
|
const auto setupStaged = [this, stagedFiles](QtcProcess &process) {
|
||||||
|
if (stagedFiles.isEmpty())
|
||||||
|
return TaskAction::StopWithError;
|
||||||
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), stagedFiles));
|
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), stagedFiles));
|
||||||
setupCommand(process, addConfigurationArguments(
|
setupCommand(process, addConfigurationArguments(
|
||||||
QStringList({"diff", "--cached", "--"}) + stagedFiles));
|
QStringList({"diff", "--cached", "--"}) + stagedFiles));
|
||||||
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
|
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
|
||||||
|
return TaskAction::Continue;
|
||||||
};
|
};
|
||||||
const auto onStagedDone = [storage](const QtcProcess &process) {
|
const auto onStagedDone = [storage](const QtcProcess &process) {
|
||||||
storage->m_stagedOutput = process.cleanedStdOut();
|
storage->m_stagedOutput = process.cleanedStdOut();
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto setupUnstaged = [this, unstagedFiles](QtcProcess &process) {
|
const auto setupUnstaged = [this, unstagedFiles](QtcProcess &process) {
|
||||||
|
if (unstagedFiles.isEmpty())
|
||||||
|
return TaskAction::StopWithError;
|
||||||
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), unstagedFiles));
|
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), unstagedFiles));
|
||||||
setupCommand(process, addConfigurationArguments(
|
setupCommand(process, addConfigurationArguments(
|
||||||
QStringList({"diff", "--"}) + unstagedFiles));
|
QStringList({"diff", "--"}) + unstagedFiles));
|
||||||
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
|
VcsOutputWindow::appendCommand(process.workingDirectory(), process.commandLine());
|
||||||
|
return TaskAction::Continue;
|
||||||
};
|
};
|
||||||
const auto onUnstagedDone = [storage](const QtcProcess &process) {
|
const auto onUnstagedDone = [storage](const QtcProcess &process) {
|
||||||
storage->m_unstagedOutput = process.cleanedStdOut();
|
storage->m_unstagedOutput = process.cleanedStdOut();
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto onStagingDynamicSetup = [stagedFiles, unstagedFiles] {
|
|
||||||
QSet<int> config;
|
|
||||||
if (!stagedFiles.isEmpty())
|
|
||||||
config.insert(0);
|
|
||||||
if (!unstagedFiles.isEmpty())
|
|
||||||
config.insert(1);
|
|
||||||
if (config.isEmpty())
|
|
||||||
return GroupConfig{GroupAction::StopWithError};
|
|
||||||
return GroupConfig{GroupAction::ContinueSelected, config};
|
|
||||||
};
|
|
||||||
const auto onStagingDone = [storage, diffInputStorage] {
|
const auto onStagingDone = [storage, diffInputStorage] {
|
||||||
*diffInputStorage.activeStorage() = storage->m_stagedOutput + storage->m_unstagedOutput;
|
*diffInputStorage.activeStorage() = storage->m_stagedOutput + storage->m_unstagedOutput;
|
||||||
};
|
};
|
||||||
@@ -271,7 +267,6 @@ FileListDiffController::FileListDiffController(IDocument *document, const QStrin
|
|||||||
Group {
|
Group {
|
||||||
parallel,
|
parallel,
|
||||||
continueOnDone,
|
continueOnDone,
|
||||||
DynamicSetup(onStagingDynamicSetup),
|
|
||||||
Process(setupStaged, onStagedDone),
|
Process(setupStaged, onStagedDone),
|
||||||
Process(setupUnstaged, onUnstagedDone),
|
Process(setupUnstaged, onUnstagedDone),
|
||||||
OnGroupDone(onStagingDone)
|
OnGroupDone(onStagingDone)
|
||||||
|
Reference in New Issue
Block a user