diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index 15ddd709c1a..2a8d4894886 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -219,6 +219,11 @@ void ShellCommand::addTask(QFuture &future) Q_UNUSED(future) } +void ShellCommand::postRunCommand(const FilePath &workingDirectory) +{ + Q_UNUSED(workingDirectory) +} + int ShellCommand::timeoutS() const { return std::accumulate(d->m_jobs.cbegin(), d->m_jobs.cend(), 0, @@ -318,6 +323,7 @@ void ShellCommand::runCommand(QtcProcess &proc, emit appendError(proc.exitMessage()); } } + postRunCommand(dir); } void ShellCommand::runFullySynchronous(QtcProcess &process, const FilePath &workingDirectory) diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index 30167fd2af8..7d3a89711c8 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -126,9 +126,8 @@ public: // This is called once per job in a thread. // When called from the UI thread it will execute fully synchronously, so no signals will // be triggered! - virtual void runCommand(QtcProcess &process, - const CommandLine &command, - const FilePath &workingDirectory = {}); + void runCommand(QtcProcess &process, const CommandLine &command, + const FilePath &workingDirectory = {}); void cancel(); @@ -149,12 +148,13 @@ signals: protected: virtual Environment environment() const; - virtual void addTask(QFuture &future); void setDisableUnixTerminal(); int timeoutS() const; FilePath workDirectory(const FilePath &wd) const; private: + virtual void addTask(QFuture &future); + virtual void postRunCommand(const Utils::FilePath &workDirectory); void run(QFutureInterface &future); // Run without a event loop in fully blocking mode. No signals will be delivered. diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index e2d8ed77950..c290e2d778e 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -82,14 +82,6 @@ Environment VcsCommand::environment() const return env; } -void VcsCommand::runCommand(QtcProcess &proc, - const CommandLine &command, - const FilePath &workingDirectory) -{ - ShellCommand::runCommand(proc, command, workingDirectory); - emitRepositoryChanged(workingDirectory); -} - void VcsCommand::addTask(QFuture &future) { const QString name = displayName(); @@ -114,13 +106,13 @@ void VcsCommand::addTask(QFuture &future) Internal::VcsPlugin::addFuture(future); } -void VcsCommand::emitRepositoryChanged(const FilePath &workingDirectory) +void VcsCommand::postRunCommand(const FilePath &workingDirectory) { if (m_preventRepositoryChanged || !(flags() & VcsCommand::ExpectRepoChanges)) return; // TODO tell the document manager that the directory now received all expected changes // Core::DocumentManager::unexpectDirectoryChange(d->m_workingDirectory); - VcsManager::emitRepositoryChanged(workDirectory(workingDirectory)); + VcsManager::emitRepositoryChanged(workingDirectory); } } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index a59eba10680..80fa69dcc8b 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -48,16 +48,12 @@ public: VcsCommand(const Utils::FilePath &defaultWorkingDirectory, const Utils::Environment &environment); - void runCommand(Utils::QtcProcess &process, - const Utils::CommandLine &command, - const Utils::FilePath &workDirectory = {}) override; - protected: Utils::Environment environment() const override; - void addTask(QFuture &future) override; private: - void emitRepositoryChanged(const Utils::FilePath &workingDirectory); + void addTask(QFuture &future) override; + void postRunCommand(const Utils::FilePath &workDirectory) override; QPointer m_progress; bool m_preventRepositoryChanged;