forked from qt-creator/qt-creator
VcsCommand: Fix clearing repository
Move a call to setRepository() from c'tor into the setup() method, as it should be called just before the process is started. Add an accompanying call to clearRepository() into the cleanup() method. Remove other manual calls to setRepository() and clearRepository(). Change-Id: I35b9d4ea72cc885bb8ae34950987a8ca18584fd1 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1008,10 +1008,7 @@ void GitClient::merge(const FilePath &workingDirectory, const QStringList &unmer
|
||||
|
||||
void GitClient::status(const FilePath &workingDirectory) const
|
||||
{
|
||||
VcsOutputWindow::setRepository(workingDirectory);
|
||||
vcsExecWithHandler(workingDirectory, {"status", "-u"}, this, [](const CommandResult &) {
|
||||
VcsOutputWindow::instance()->clearRepository();
|
||||
}, RunFlags::ShowStdOut);
|
||||
vcsExec(workingDirectory, {"status", "-u"}, RunFlags::ShowStdOut);
|
||||
}
|
||||
|
||||
static QStringList normalLogArguments()
|
||||
|
@@ -802,9 +802,7 @@ void SubversionPluginPrivate::svnStatus(const FilePath &workingDir, const QStrin
|
||||
args << SubversionClient::AddAuthOptions();
|
||||
if (!relativePath.isEmpty())
|
||||
args << SubversionClient::escapeFile(relativePath);
|
||||
VcsOutputWindow::setRepository(workingDir);
|
||||
runSvn(workingDir, args, RunFlags::ShowStdOut | RunFlags::ShowSuccessMessage);
|
||||
VcsOutputWindow::clearRepository();
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::filelog(const FilePath &workingDir,
|
||||
|
@@ -476,10 +476,8 @@ void VcsBaseClient::status(const FilePath &workingDir,
|
||||
{
|
||||
QStringList args(vcsCommandString(StatusCommand));
|
||||
args << extraOptions << file;
|
||||
VcsOutputWindow::setRepository(workingDir);
|
||||
VcsCommand *cmd = createCommand(workingDir);
|
||||
cmd->addFlags(RunFlags::ShowStdOut);
|
||||
connect(cmd, &VcsCommand::done, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
|
@@ -90,12 +90,14 @@ int VcsCommandPrivate::timeoutS() const
|
||||
|
||||
void VcsCommandPrivate::setup()
|
||||
{
|
||||
VcsOutputWindow::setRepository(m_defaultWorkingDirectory);
|
||||
if (m_flags & RunFlags::ExpectRepoChanges)
|
||||
GlobalFileChangeBlocker::instance()->forceBlocked(true);
|
||||
}
|
||||
|
||||
void VcsCommandPrivate::cleanup()
|
||||
{
|
||||
VcsOutputWindow::clearRepository();
|
||||
if (m_flags & RunFlags::ExpectRepoChanges)
|
||||
GlobalFileChangeBlocker::instance()->forceBlocked(false);
|
||||
}
|
||||
@@ -227,7 +229,6 @@ void VcsCommandPrivate::processDone()
|
||||
VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &environment) :
|
||||
d(new Internal::VcsCommandPrivate(this, workingDirectory, environment))
|
||||
{
|
||||
VcsOutputWindow::setRepository(d->m_defaultWorkingDirectory);
|
||||
connect(ICore::instance(), &ICore::coreAboutToClose, this, [this] {
|
||||
if (d->m_process && d->m_process->isRunning())
|
||||
d->cleanup();
|
||||
|
Reference in New Issue
Block a user