GitClient: Introduce execWithEditor()

Change-Id: I3a7edde4b978cb8e99fe0020d69a0a5e3e09c0fb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-12-08 20:41:43 +01:00
parent 287a7c9268
commit 0cdfac0cb5
3 changed files with 17 additions and 4 deletions

View File

@@ -1197,7 +1197,7 @@ void GitClient::log(const FilePath &workingDirectory, const QString &fileName,
if (!fileName.isEmpty()) if (!fileName.isEmpty())
arguments << "--" << fileName; arguments << "--" << fileName;
vcsExec(workingDir, arguments, editor); vcsExecWithEditor(workingDir, arguments, editor);
} }
void GitClient::reflog(const FilePath &workingDirectory, const QString &ref) void GitClient::reflog(const FilePath &workingDirectory, const QString &ref)
@@ -1226,7 +1226,7 @@ void GitClient::reflog(const FilePath &workingDirectory, const QString &ref)
if (logCount > 0) if (logCount > 0)
arguments << "-n" << QString::number(logCount); arguments << "-n" << QString::number(logCount);
vcsExec(workingDir, arguments, editor); vcsExecWithEditor(workingDir, arguments, editor);
} }
// Do not show "0000" or "^32ae4" // Do not show "0000" or "^32ae4"
@@ -1342,7 +1342,7 @@ VcsBaseEditorWidget *GitClient::annotate(
arguments << revision; arguments << revision;
arguments << "--" << file; arguments << "--" << file;
editor->setDefaultLineNumber(lineNumber); editor->setDefaultLineNumber(lineNumber);
vcsExec(workingDir, arguments, editor); vcsExecWithEditor(workingDir, arguments, editor);
return editor; return editor;
} }
@@ -3229,7 +3229,7 @@ void GitClient::subversionLog(const FilePath &workingDirectory) const
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, codecFor(CodecNone), VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile, codecFor(CodecNone),
"svnLog", sourceFile); "svnLog", sourceFile);
editor->setWorkingDirectory(workingDirectory); editor->setWorkingDirectory(workingDirectory);
vcsExec(workingDirectory, arguments, editor); vcsExecWithEditor(workingDirectory, arguments, editor);
} }
void GitClient::subversionDeltaCommit(const FilePath &workingDirectory) const void GitClient::subversionDeltaCommit(const FilePath &workingDirectory) const

View File

@@ -192,6 +192,16 @@ void VcsBaseClientImpl::vcsExec(const FilePath &workingDirectory,
command->start(); command->start();
} }
void VcsBaseClientImpl::vcsExecWithEditor(const Utils::FilePath &workingDirectory,
const QStringList &arguments,
VcsBaseEditorWidget *editor) const
{
VcsCommand *command = createCommand(workingDirectory, editor, NoOutputBind);
command->setCodec(editor->codec());
command->addJob({vcsBinary(), arguments}, vcsTimeoutS());
command->start();
}
int VcsBaseClientImpl::vcsTimeoutS() const int VcsBaseClientImpl::vcsTimeoutS() const
{ {
return m_baseSettings->timeout.value(); return m_baseSettings->timeout.value();

View File

@@ -99,6 +99,9 @@ public:
VcsBaseEditorWidget *editor = nullptr, VcsBaseEditorWidget *editor = nullptr,
bool useOutputToWindow = false, bool useOutputToWindow = false,
RunFlags additionalFlags = RunFlags::None) const; RunFlags additionalFlags = RunFlags::None) const;
void vcsExecWithEditor(const Utils::FilePath &workingDirectory,
const QStringList &arguments,
VcsBaseEditorWidget *editor) const;
protected: protected:
void resetCachedVcsInfo(const Utils::FilePath &workingDir); void resetCachedVcsInfo(const Utils::FilePath &workingDir);