forked from qt-creator/qt-creator
Vcs: Move vcsSynchronousExec into VcsBaseClientImpl
Use it in favor of git's synchronousGit method. Change-Id: I1fc8031cb6d258073b64163aeeeaeac84443fb8c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1611,7 +1611,7 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
|
|||||||
const unsigned flags = VcsBasePlugin::ShowStdOutInLogWindow
|
const unsigned flags = VcsBasePlugin::ShowStdOutInLogWindow
|
||||||
| VcsBasePlugin::ExpectRepoChanges
|
| VcsBasePlugin::ExpectRepoChanges
|
||||||
| VcsBasePlugin::ShowSuccessMessage;
|
| VcsBasePlugin::ShowSuccessMessage;
|
||||||
const SynchronousProcessResponse response = synchronousGit(workingDirectory, arguments, flags);
|
const SynchronousProcessResponse response = vcsSynchronousExec(workingDirectory, arguments, flags);
|
||||||
const bool rc = response.result == SynchronousProcessResponse::Finished;
|
const bool rc = response.result == SynchronousProcessResponse::Finished;
|
||||||
if (!rc)
|
if (!rc)
|
||||||
msgCannotRun(arguments, workingDirectory, response.stdErr.toLocal8Bit(), errorMessage);
|
msgCannotRun(arguments, workingDirectory, response.stdErr.toLocal8Bit(), errorMessage);
|
||||||
@@ -1948,17 +1948,6 @@ bool GitClient::isValidRevision(const QString &revision) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronous git execution using Utils::SynchronousProcess, with
|
|
||||||
// log windows updating.
|
|
||||||
SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirectory,
|
|
||||||
const QStringList &gitArguments,
|
|
||||||
unsigned flags,
|
|
||||||
QTextCodec *outputCodec) const
|
|
||||||
{
|
|
||||||
return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), gitArguments, vcsTimeoutS(),
|
|
||||||
flags, outputCodec, processEnvironment());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt)
|
void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt)
|
||||||
{
|
{
|
||||||
if (!m_updatedSubmodules.isEmpty() || submoduleList(workingDirectory).isEmpty())
|
if (!m_updatedSubmodules.isEmpty() || submoduleList(workingDirectory).isEmpty())
|
||||||
@@ -2211,7 +2200,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
|
|||||||
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
||||||
| VcsBasePlugin::SuppressStdErrInLogWindow
|
| VcsBasePlugin::SuppressStdErrInLogWindow
|
||||||
| VcsBasePlugin::SuppressFailMessageInLogWindow;
|
| VcsBasePlugin::SuppressFailMessageInLogWindow;
|
||||||
const SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
|
||||||
QStringList branches;
|
QStringList branches;
|
||||||
branches << tr("<Detached HEAD>");
|
branches << tr("<Detached HEAD>");
|
||||||
QString headSha;
|
QString headSha;
|
||||||
@@ -2779,7 +2768,7 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
|||||||
| VcsBasePlugin::ShowStdOutInLogWindow
|
| VcsBasePlugin::ShowStdOutInLogWindow
|
||||||
| VcsBasePlugin::ExpectRepoChanges
|
| VcsBasePlugin::ExpectRepoChanges
|
||||||
| VcsBasePlugin::ShowSuccessMessage;
|
| VcsBasePlugin::ShowSuccessMessage;
|
||||||
const SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
|
||||||
ConflictHandler conflictHandler(0, workingDirectory, abortCommand);
|
ConflictHandler conflictHandler(0, workingDirectory, abortCommand);
|
||||||
// Notify about changed files or abort the rebase.
|
// Notify about changed files or abort the rebase.
|
||||||
const bool ok = resp.result == SynchronousProcessResponse::Finished;
|
const bool ok = resp.result == SynchronousProcessResponse::Finished;
|
||||||
@@ -2904,7 +2893,7 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory)
|
|||||||
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
||||||
| VcsBasePlugin::ShowStdOutInLogWindow
|
| VcsBasePlugin::ShowStdOutInLogWindow
|
||||||
| VcsBasePlugin::ShowSuccessMessage;
|
| VcsBasePlugin::ShowSuccessMessage;
|
||||||
synchronousGit(workingDirectory, args, flags);
|
vcsSynchronousExec(workingDirectory, args, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::subversionLog(const QString &workingDirectory)
|
void GitClient::subversionLog(const QString &workingDirectory)
|
||||||
@@ -3152,8 +3141,8 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
|||||||
|
|
||||||
arguments.clear();
|
arguments.clear();
|
||||||
arguments << QLatin1String("fetch");
|
arguments << QLatin1String("fetch");
|
||||||
const SynchronousProcessResponse resp =
|
const SynchronousProcessResponse resp
|
||||||
synchronousGit(workingDirectory.path(), arguments, flags);
|
= vcsSynchronousExec(workingDirectory.path(), arguments, flags);
|
||||||
if (resp.result != SynchronousProcessResponse::Finished)
|
if (resp.result != SynchronousProcessResponse::Finished)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -3176,8 +3165,8 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
|||||||
QStringList arguments(QLatin1String("clone"));
|
QStringList arguments(QLatin1String("clone"));
|
||||||
arguments << QLatin1String(url) << workingDirectory.dirName();
|
arguments << QLatin1String(url) << workingDirectory.dirName();
|
||||||
workingDirectory.cdUp();
|
workingDirectory.cdUp();
|
||||||
const SynchronousProcessResponse resp =
|
const SynchronousProcessResponse resp
|
||||||
synchronousGit(workingDirectory.path(), arguments, flags);
|
= vcsSynchronousExec(workingDirectory.path(), arguments, flags);
|
||||||
resetCachedVcsInfo(workingDirectory.absolutePath());
|
resetCachedVcsInfo(workingDirectory.absolutePath());
|
||||||
return (resp.result == SynchronousProcessResponse::Finished);
|
return (resp.result == SynchronousProcessResponse::Finished);
|
||||||
}
|
}
|
||||||
|
@@ -373,12 +373,6 @@ private:
|
|||||||
bool useOutputToWindow = false, unsigned additionalFlags = 0,
|
bool useOutputToWindow = false, unsigned additionalFlags = 0,
|
||||||
int editorLineNumber = -1);
|
int editorLineNumber = -1);
|
||||||
|
|
||||||
// Synchronous git execution using Utils::SynchronousProcess, with
|
|
||||||
// log windows updating (using VcsBasePlugin::runVcs with flags).
|
|
||||||
inline Utils::SynchronousProcessResponse
|
|
||||||
synchronousGit(const QString &workingDirectory, const QStringList &arguments,
|
|
||||||
unsigned flags = 0, QTextCodec *outputCodec = 0) const;
|
|
||||||
|
|
||||||
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
||||||
unsigned synchronousGitVersion(QString *errorMessage = 0) const;
|
unsigned synchronousGitVersion(QString *errorMessage = 0) const;
|
||||||
|
|
||||||
|
@@ -400,13 +400,13 @@ bool VcsBaseClient::synchronousPush(const QString &workingDir,
|
|||||||
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QString &workingDirectory,
|
Utils::SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString &workingDir,
|
||||||
const QStringList &args,
|
const QStringList &args,
|
||||||
unsigned flags,
|
unsigned flags,
|
||||||
QTextCodec *outputCodec) const
|
QTextCodec *outputCodec) const
|
||||||
{
|
{
|
||||||
return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), args, vcsTimeoutS(), flags,
|
return VcsBasePlugin::runVcs(workingDir, vcsBinary(), args, vcsTimeoutS(), flags,
|
||||||
outputCodec);
|
outputCodec, processEnvironment());
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
|
void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
|
||||||
|
@@ -115,6 +115,13 @@ protected:
|
|||||||
QByteArray *outputData, QByteArray *errorData = 0,
|
QByteArray *outputData, QByteArray *errorData = 0,
|
||||||
unsigned flags = 0) const;
|
unsigned flags = 0) const;
|
||||||
|
|
||||||
|
// Synchronous VCS execution using Utils::SynchronousProcess, with
|
||||||
|
// log windows updating (using VcsBasePlugin::runVcs with flags)
|
||||||
|
Utils::SynchronousProcessResponse vcsSynchronousExec(const QString &workingDir,
|
||||||
|
const QStringList &args,
|
||||||
|
unsigned flags = 0,
|
||||||
|
QTextCodec *outputCodec = 0) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void commandFinishedGotoLine(QWidget*);
|
void commandFinishedGotoLine(QWidget*);
|
||||||
@@ -226,13 +233,6 @@ protected:
|
|||||||
|
|
||||||
QString vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const;
|
QString vcsEditorTitle(const QString &vcsCmd, const QString &sourceId) const;
|
||||||
|
|
||||||
// Synchronous VCS execution using Utils::SynchronousProcess, with
|
|
||||||
// log windows updating (using VcsBasePlugin::runVcs with flags)
|
|
||||||
Utils::SynchronousProcessResponse vcsSynchronousExec(const QString &workingDir,
|
|
||||||
const QStringList &args,
|
|
||||||
unsigned flags = 0,
|
|
||||||
QTextCodec *outputCodec = 0) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void statusParser(const QString&);
|
void statusParser(const QString&);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user