forked from qt-creator/qt-creator
Adapt to upstream change
Change-Id: I013c61805eeed05937fa46eb6e6e330d4b99ebb1 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -269,13 +269,11 @@ unsigned int FossilClient::synchronousBinaryVersion() const
|
|||||||
|
|
||||||
QStringList args("version");
|
QStringList args("version");
|
||||||
|
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(FilePath(), args);
|
||||||
vcsFullySynchronousExec(proc, FilePath(), args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
QString output = proc.stdOut();
|
const QString output = result.cleanedStdOut().trimmed();
|
||||||
output = output.trimmed();
|
|
||||||
|
|
||||||
// fossil version:
|
// fossil version:
|
||||||
// "This is fossil version 1.27 [ccdefa355b] 2013-09-30 11:47:18 UTC"
|
// "This is fossil version 1.27 [ccdefa355b] 2013-09-30 11:47:18 UTC"
|
||||||
@@ -308,24 +306,22 @@ BranchInfo FossilClient::synchronousCurrentBranch(const FilePath &workingDirecto
|
|||||||
return BranchInfo();
|
return BranchInfo();
|
||||||
|
|
||||||
// First try to get the current branch from the list of open branches
|
// First try to get the current branch from the list of open branches
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list"});
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"});
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return BranchInfo();
|
return BranchInfo();
|
||||||
|
|
||||||
const QString output = sanitizeFossilOutput(proc.stdOut());
|
const QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
BranchInfo currentBranch = Utils::findOrDefault(branchListFromOutput(output), [](const BranchInfo &b) {
|
BranchInfo currentBranch = Utils::findOrDefault(branchListFromOutput(output), [](const BranchInfo &b) {
|
||||||
return b.isCurrent();
|
return b.isCurrent();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!currentBranch.isCurrent()) {
|
if (!currentBranch.isCurrent()) {
|
||||||
// If not available from open branches, request it from the list of closed branches.
|
// If not available from open branches, request it from the list of closed branches.
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"});
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"});
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return BranchInfo();
|
return BranchInfo();
|
||||||
|
|
||||||
const QString output = sanitizeFossilOutput(proc.stdOut());
|
const QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
currentBranch = Utils::findOrDefault(branchListFromOutput(output, BranchInfo::Closed), [](const BranchInfo &b) {
|
currentBranch = Utils::findOrDefault(branchListFromOutput(output, BranchInfo::Closed), [](const BranchInfo &b) {
|
||||||
return b.isCurrent();
|
return b.isCurrent();
|
||||||
});
|
});
|
||||||
@@ -343,20 +339,19 @@ QList<BranchInfo> FossilClient::synchronousBranchQuery(const FilePath &workingDi
|
|||||||
return QList<BranchInfo>();
|
return QList<BranchInfo>();
|
||||||
|
|
||||||
// First get list of open branches
|
// First get list of open branches
|
||||||
QtcProcess proc;
|
CommandResult result = vcsFullySynchronousExec(workingDirectory, {"branch", "list"});
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list"});
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return QList<BranchInfo>();
|
return QList<BranchInfo>();
|
||||||
|
|
||||||
QString output = sanitizeFossilOutput(proc.stdOut());
|
QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
QList<BranchInfo> branches = branchListFromOutput(output);
|
QList<BranchInfo> branches = branchListFromOutput(output);
|
||||||
|
|
||||||
// Append a list of closed branches.
|
// Append a list of closed branches.
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, {"branch", "list", "--closed"});
|
result = vcsFullySynchronousExec(workingDirectory, {"branch", "list", "--closed"});
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
return QList<BranchInfo>();
|
return QList<BranchInfo>();
|
||||||
|
|
||||||
output = sanitizeFossilOutput(proc.stdOut());
|
output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
branches.append(branchListFromOutput(output, BranchInfo::Closed));
|
branches.append(branchListFromOutput(output, BranchInfo::Closed));
|
||||||
|
|
||||||
std::sort(branches.begin(), branches.end(),
|
std::sort(branches.begin(), branches.end(),
|
||||||
@@ -392,12 +387,12 @@ RevisionInfo FossilClient::synchronousRevisionQuery(const FilePath &workingDirec
|
|||||||
if (!id.isEmpty())
|
if (!id.isEmpty())
|
||||||
args << id;
|
args << id;
|
||||||
|
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args,
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args, ShellCommand::SuppressCommandLogging);
|
ShellCommand::SuppressCommandLogging);
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
return RevisionInfo();
|
return RevisionInfo();
|
||||||
|
|
||||||
const QString output = sanitizeFossilOutput(proc.stdOut());
|
const QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
|
|
||||||
QString revisionId;
|
QString revisionId;
|
||||||
QString parentId;
|
QString parentId;
|
||||||
@@ -456,12 +451,11 @@ QStringList FossilClient::synchronousTagQuery(const FilePath &workingDirectory,
|
|||||||
if (!id.isEmpty())
|
if (!id.isEmpty())
|
||||||
args << id;
|
args << id;
|
||||||
|
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return QStringList();
|
return QStringList();
|
||||||
|
|
||||||
const QString output = sanitizeFossilOutput(proc.stdOut());
|
const QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
|
|
||||||
return output.split('\n', Qt::SkipEmptyParts);
|
return output.split('\n', Qt::SkipEmptyParts);
|
||||||
}
|
}
|
||||||
@@ -479,12 +473,11 @@ RepositorySettings FossilClient::synchronousSettingsQuery(const FilePath &workin
|
|||||||
|
|
||||||
const QStringList args("settings");
|
const QStringList args("settings");
|
||||||
|
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return RepositorySettings();
|
return RepositorySettings();
|
||||||
|
|
||||||
const QString output = sanitizeFossilOutput(proc.stdOut());
|
const QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
|
|
||||||
for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) {
|
for (const QString &line : output.split('\n', Qt::SkipEmptyParts)) {
|
||||||
// parse settings line:
|
// parse settings line:
|
||||||
@@ -534,9 +527,8 @@ bool FossilClient::synchronousSetSetting(const FilePath &workingDirectory,
|
|||||||
if (isGlobal)
|
if (isGlobal)
|
||||||
args << "--global";
|
args << "--global";
|
||||||
|
|
||||||
QtcProcess proc;
|
return vcsFullySynchronousExec(workingDirectory, args).result()
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
== ProcessResult::FinishedWithSuccess;
|
||||||
return (proc.result() == ProcessResult::FinishedWithSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -591,12 +583,11 @@ QString FossilClient::synchronousUserDefaultQuery(const FilePath &workingDirecto
|
|||||||
|
|
||||||
const QStringList args({"user", "default"});
|
const QStringList args({"user", "default"});
|
||||||
|
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
QString output = sanitizeFossilOutput(proc.stdOut());
|
QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
|
|
||||||
return output.trimmed();
|
return output.trimmed();
|
||||||
}
|
}
|
||||||
@@ -608,9 +599,8 @@ bool FossilClient::synchronousSetUserDefault(const FilePath &workingDirectory, c
|
|||||||
|
|
||||||
// set repository-default user
|
// set repository-default user
|
||||||
const QStringList args({"user", "default", userName, "--user", userName});
|
const QStringList args({"user", "default", userName, "--user", userName});
|
||||||
QtcProcess proc;
|
return vcsFullySynchronousExec(workingDirectory, args).result()
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
== ProcessResult::FinishedWithSuccess;
|
||||||
return (proc.result() == ProcessResult::FinishedWithSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory)
|
QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirectory)
|
||||||
@@ -620,13 +610,11 @@ QString FossilClient::synchronousGetRepositoryURL(const FilePath &workingDirecto
|
|||||||
|
|
||||||
const QStringList args("remote-url");
|
const QStringList args("remote-url");
|
||||||
|
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
QString output = sanitizeFossilOutput(proc.stdOut());
|
const QString output = sanitizeFossilOutput(result.cleanedStdOut()).trimmed();
|
||||||
output = output.trimmed();
|
|
||||||
|
|
||||||
// Fossil returns "off" when no remote-url is set.
|
// Fossil returns "off" when no remote-url is set.
|
||||||
if (output.isEmpty() || output.toLower() == "off")
|
if (output.isEmpty() || output.toLower() == "off")
|
||||||
@@ -674,12 +662,11 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory,
|
|||||||
if (!adminUser.isEmpty())
|
if (!adminUser.isEmpty())
|
||||||
args << "--admin-user" << adminUser;
|
args << "--admin-user" << adminUser;
|
||||||
args << extraOptions << repoFilePath.toUserOutput();
|
args << extraOptions << repoFilePath.toUserOutput();
|
||||||
QtcProcess proc;
|
CommandResult result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString output = sanitizeFossilOutput(proc.stdOut());
|
QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
outputWindow->append(output);
|
outputWindow->append(output);
|
||||||
|
|
||||||
// check out the created repository file into the working directory
|
// check out the created repository file into the working directory
|
||||||
@@ -688,11 +675,11 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory,
|
|||||||
output.clear();
|
output.clear();
|
||||||
|
|
||||||
args << "open" << repoFilePath.toUserOutput();
|
args << "open" << repoFilePath.toUserOutput();
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
output = sanitizeFossilOutput(proc.stdOut());
|
output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
outputWindow->append(output);
|
outputWindow->append(output);
|
||||||
|
|
||||||
// set user default to admin if specified
|
// set user default to admin if specified
|
||||||
@@ -702,11 +689,11 @@ bool FossilClient::synchronousCreateRepository(const FilePath &workingDirectory,
|
|||||||
output.clear();
|
output.clear();
|
||||||
|
|
||||||
args << "user" << "default" << adminUser << "--user" << adminUser;
|
args << "user" << "default" << adminUser << "--user" << adminUser;
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString output = sanitizeFossilOutput(proc.stdOut());
|
QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
outputWindow->append(output);
|
outputWindow->append(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,9 +715,7 @@ bool FossilClient::synchronousMove(const FilePath &workingDir,
|
|||||||
|
|
||||||
QStringList args(vcsCommandString(MoveCommand));
|
QStringList args(vcsCommandString(MoveCommand));
|
||||||
args << extraOptions << from << to;
|
args << extraOptions << from << to;
|
||||||
QtcProcess proc;
|
return vcsFullySynchronousExec(workingDir, args).result() == ProcessResult::FinishedWithSuccess;
|
||||||
vcsFullySynchronousExec(proc, workingDir, args);
|
|
||||||
return (proc.result() == ProcessResult::FinishedWithSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions)
|
bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions)
|
||||||
@@ -745,9 +730,8 @@ bool FossilClient::synchronousPull(const FilePath &workingDir, const QString &sr
|
|||||||
}
|
}
|
||||||
|
|
||||||
args << extraOptions;
|
args << extraOptions;
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsSynchronousExec(workingDir, args, s_pullFlags);
|
||||||
vcsSynchronousExec(proc, workingDir, args, s_pullFlags);
|
const bool success = (result.result() == ProcessResult::FinishedWithSuccess);
|
||||||
const bool success = (proc.result() == ProcessResult::FinishedWithSuccess);
|
|
||||||
if (success)
|
if (success)
|
||||||
emit changed(workingDir.toVariant());
|
emit changed(workingDir.toVariant());
|
||||||
return success;
|
return success;
|
||||||
@@ -765,9 +749,8 @@ bool FossilClient::synchronousPush(const FilePath &workingDir, const QString &ds
|
|||||||
}
|
}
|
||||||
|
|
||||||
args << extraOptions;
|
args << extraOptions;
|
||||||
QtcProcess proc;
|
return vcsSynchronousExec(workingDir, args, s_pullFlags).result()
|
||||||
vcsSynchronousExec(proc, workingDir, args, s_pullFlags);
|
== ProcessResult::FinishedWithSuccess;
|
||||||
return (proc.result() == ProcessResult::FinishedWithSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &files,
|
void FossilClient::commit(const FilePath &repositoryRoot, const QStringList &files,
|
||||||
@@ -853,11 +836,10 @@ FilePath FossilClient::findTopLevelForFile(const FilePath &file) const
|
|||||||
bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
bool FossilClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||||
{
|
{
|
||||||
const QStringList args({"finfo", fileName});
|
const QStringList args({"finfo", fileName});
|
||||||
QtcProcess proc;
|
const CommandResult result = vcsFullySynchronousExec(workingDirectory, args);
|
||||||
vcsFullySynchronousExec(proc, workingDirectory, args);
|
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||||
if (proc.result() != ProcessResult::FinishedWithSuccess)
|
|
||||||
return false;
|
return false;
|
||||||
QString output = sanitizeFossilOutput(proc.stdOut());
|
QString output = sanitizeFossilOutput(result.cleanedStdOut());
|
||||||
return !output.startsWith("no history for file", Qt::CaseInsensitive);
|
return !output.startsWith("no history for file", Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,7 +1089,10 @@ void FossilClient::revertFile(const FilePath &workingDir,
|
|||||||
// Indicate file list
|
// Indicate file list
|
||||||
ShellCommand *cmd = createCommand(workingDir);
|
ShellCommand *cmd = createCommand(workingDir);
|
||||||
cmd->setCookie(QStringList(workingDir.toString() + "/" + file));
|
cmd->setCookie(QStringList(workingDir.toString() + "/" + file));
|
||||||
connect(cmd, &ShellCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection);
|
connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) {
|
||||||
|
if (success)
|
||||||
|
emit changed(cookie);
|
||||||
|
});
|
||||||
enqueueJob(cmd, args);
|
enqueueJob(cmd, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1133,7 +1118,10 @@ void FossilClient::revertAll(const FilePath &workingDir, const QString &revision
|
|||||||
// Indicate repository change
|
// Indicate repository change
|
||||||
ShellCommand *cmd = createCommand(workingDir);
|
ShellCommand *cmd = createCommand(workingDir);
|
||||||
cmd->setCookie(QStringList(workingDir.toString()));
|
cmd->setCookie(QStringList(workingDir.toString()));
|
||||||
connect(cmd, &ShellCommand::success, this, &VcsBase::VcsBaseClient::changed, Qt::QueuedConnection);
|
connect(cmd, &ShellCommand::finished, this, [this](bool success, const QVariant &cookie) {
|
||||||
|
if (success)
|
||||||
|
emit changed(cookie);
|
||||||
|
});
|
||||||
enqueueJob(createCommand(workingDir), args);
|
enqueueJob(createCommand(workingDir), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user