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
|
||||
| VcsBasePlugin::ExpectRepoChanges
|
||||
| VcsBasePlugin::ShowSuccessMessage;
|
||||
const SynchronousProcessResponse response = synchronousGit(workingDirectory, arguments, flags);
|
||||
const SynchronousProcessResponse response = vcsSynchronousExec(workingDirectory, arguments, flags);
|
||||
const bool rc = response.result == SynchronousProcessResponse::Finished;
|
||||
if (!rc)
|
||||
msgCannotRun(arguments, workingDirectory, response.stdErr.toLocal8Bit(), errorMessage);
|
||||
@@ -1948,17 +1948,6 @@ bool GitClient::isValidRevision(const QString &revision) const
|
||||
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)
|
||||
{
|
||||
if (!m_updatedSubmodules.isEmpty() || submoduleList(workingDirectory).isEmpty())
|
||||
@@ -2211,7 +2200,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
|
||||
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
||||
| VcsBasePlugin::SuppressStdErrInLogWindow
|
||||
| VcsBasePlugin::SuppressFailMessageInLogWindow;
|
||||
const SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
|
||||
QStringList branches;
|
||||
branches << tr("<Detached HEAD>");
|
||||
QString headSha;
|
||||
@@ -2779,7 +2768,7 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
| VcsBasePlugin::ShowStdOutInLogWindow
|
||||
| VcsBasePlugin::ExpectRepoChanges
|
||||
| VcsBasePlugin::ShowSuccessMessage;
|
||||
const SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(workingDirectory, arguments, flags);
|
||||
ConflictHandler conflictHandler(0, workingDirectory, abortCommand);
|
||||
// Notify about changed files or abort the rebase.
|
||||
const bool ok = resp.result == SynchronousProcessResponse::Finished;
|
||||
@@ -2904,7 +2893,7 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory)
|
||||
const unsigned flags = VcsBasePlugin::SshPasswordPrompt
|
||||
| VcsBasePlugin::ShowStdOutInLogWindow
|
||||
| VcsBasePlugin::ShowSuccessMessage;
|
||||
synchronousGit(workingDirectory, args, flags);
|
||||
vcsSynchronousExec(workingDirectory, args, flags);
|
||||
}
|
||||
|
||||
void GitClient::subversionLog(const QString &workingDirectory)
|
||||
@@ -3152,8 +3141,8 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
||||
|
||||
arguments.clear();
|
||||
arguments << QLatin1String("fetch");
|
||||
const SynchronousProcessResponse resp =
|
||||
synchronousGit(workingDirectory.path(), arguments, flags);
|
||||
const SynchronousProcessResponse resp
|
||||
= vcsSynchronousExec(workingDirectory.path(), arguments, flags);
|
||||
if (resp.result != SynchronousProcessResponse::Finished)
|
||||
return false;
|
||||
|
||||
@@ -3176,8 +3165,8 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url)
|
||||
QStringList arguments(QLatin1String("clone"));
|
||||
arguments << QLatin1String(url) << workingDirectory.dirName();
|
||||
workingDirectory.cdUp();
|
||||
const SynchronousProcessResponse resp =
|
||||
synchronousGit(workingDirectory.path(), arguments, flags);
|
||||
const SynchronousProcessResponse resp
|
||||
= vcsSynchronousExec(workingDirectory.path(), arguments, flags);
|
||||
resetCachedVcsInfo(workingDirectory.absolutePath());
|
||||
return (resp.result == SynchronousProcessResponse::Finished);
|
||||
}
|
||||
|
@@ -373,12 +373,6 @@ private:
|
||||
bool useOutputToWindow = false, unsigned additionalFlags = 0,
|
||||
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.
|
||||
unsigned synchronousGitVersion(QString *errorMessage = 0) const;
|
||||
|
||||
|
@@ -400,13 +400,13 @@ bool VcsBaseClient::synchronousPush(const QString &workingDir,
|
||||
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QString &workingDirectory,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
Utils::SynchronousProcessResponse VcsBaseClientImpl::vcsSynchronousExec(const QString &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
{
|
||||
return VcsBasePlugin::runVcs(workingDirectory, vcsBinary(), args, vcsTimeoutS(), flags,
|
||||
outputCodec);
|
||||
return VcsBasePlugin::runVcs(workingDir, vcsBinary(), args, vcsTimeoutS(), flags,
|
||||
outputCodec, processEnvironment());
|
||||
}
|
||||
|
||||
void VcsBaseClient::annotate(const QString &workingDir, const QString &file,
|
||||
|
@@ -115,6 +115,13 @@ protected:
|
||||
QByteArray *outputData, QByteArray *errorData = 0,
|
||||
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:
|
||||
void saveSettings();
|
||||
void commandFinishedGotoLine(QWidget*);
|
||||
@@ -226,13 +233,6 @@ protected:
|
||||
|
||||
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:
|
||||
void statusParser(const QString&);
|
||||
|
||||
|
Reference in New Issue
Block a user