forked from qt-creator/qt-creator
Remove spaces in initializer lists
Format initializer lists code style like. Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -207,7 +207,7 @@ QStringList BaseController::addHeadWhenCommandInProgress() const
|
||||
// instead of showing unsupported combined diff format.
|
||||
GitClient::CommandInProgress commandInProgress = GitPlugin::client()->checkCommandInProgress(m_directory);
|
||||
if (commandInProgress != GitClient::NoCommand)
|
||||
return { HEAD };
|
||||
return {HEAD};
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
|
||||
void RepositoryDiffController::reload()
|
||||
{
|
||||
QStringList args = { "diff" };
|
||||
QStringList args = {"diff"};
|
||||
args.append(addHeadWhenCommandInProgress());
|
||||
runCommand(QList<QStringList>() << addConfigurationArguments(args));
|
||||
}
|
||||
@@ -246,7 +246,7 @@ private:
|
||||
|
||||
void FileDiffController::reload()
|
||||
{
|
||||
QStringList args = { "diff" };
|
||||
QStringList args = {"diff"};
|
||||
args.append(addHeadWhenCommandInProgress());
|
||||
args << "--" << m_fileName;
|
||||
|
||||
@@ -275,13 +275,13 @@ void FileListDiffController::reload()
|
||||
{
|
||||
QList<QStringList> argLists;
|
||||
if (!m_stagedFiles.isEmpty()) {
|
||||
QStringList stagedArgs = { "diff", "--cached", "--" };
|
||||
QStringList stagedArgs = {"diff", "--cached", "--"};
|
||||
stagedArgs << m_stagedFiles;
|
||||
argLists << addConfigurationArguments(stagedArgs);
|
||||
}
|
||||
|
||||
if (!m_unstagedFiles.isEmpty()) {
|
||||
QStringList unstagedArgs = { "diff" };
|
||||
QStringList unstagedArgs = {"diff"};
|
||||
unstagedArgs << addHeadWhenCommandInProgress() << "--" << m_unstagedFiles;
|
||||
argLists << addConfigurationArguments(unstagedArgs);
|
||||
}
|
||||
@@ -308,7 +308,7 @@ private:
|
||||
|
||||
void ProjectDiffController::reload()
|
||||
{
|
||||
QStringList args = { "diff" };
|
||||
QStringList args = {"diff"};
|
||||
args << addHeadWhenCommandInProgress() << "--" << m_projectPaths;
|
||||
runCommand(QList<QStringList>() << addConfigurationArguments(args));
|
||||
}
|
||||
@@ -331,7 +331,7 @@ private:
|
||||
|
||||
void BranchDiffController::reload()
|
||||
{
|
||||
QStringList args = { "diff" };
|
||||
QStringList args = {"diff"};
|
||||
args << addHeadWhenCommandInProgress() << m_branch;
|
||||
runCommand(QList<QStringList>() << addConfigurationArguments(args));
|
||||
}
|
||||
@@ -358,7 +358,7 @@ private:
|
||||
|
||||
void ShowController::reload()
|
||||
{
|
||||
const QStringList args = { "show", "-s", noColorOption, decorateOption, showFormatC, m_id };
|
||||
const QStringList args = {"show", "-s", noColorOption, decorateOption, showFormatC, m_id};
|
||||
m_state = GettingDescription;
|
||||
runCommand(QList<QStringList>() << args, GitPlugin::client()->encoding(m_directory, "i18n.commitEncoding"));
|
||||
}
|
||||
@@ -377,8 +377,8 @@ void ShowController::reloadFinished(bool success)
|
||||
QTC_ASSERT(m_state != Idle, return);
|
||||
|
||||
if (m_state == GettingDescription && success) {
|
||||
const QStringList args = { "show", "--format=format:", // omit header, already generated
|
||||
noColorOption, decorateOption, m_id };
|
||||
const QStringList args = {"show", "--format=format:", // omit header, already generated
|
||||
noColorOption, decorateOption, m_id};
|
||||
m_state = GettingDiff;
|
||||
runCommand(QList<QStringList>() << addConfigurationArguments(args));
|
||||
return;
|
||||
@@ -446,7 +446,7 @@ public:
|
||||
m_patienceButton->setVisible(diffButton->isChecked());
|
||||
m_ignoreWSButton->setVisible(diffButton->isChecked());
|
||||
QAction *firstParentButton =
|
||||
addToggleButton({ "-m", "--first-parent" },
|
||||
addToggleButton({"-m", "--first-parent"},
|
||||
tr("First Parent"),
|
||||
tr("Follow only the first parent on merge commits."));
|
||||
mapSetting(firstParentButton, settings.boolPointer(GitSettings::firstParentKey));
|
||||
@@ -631,7 +631,7 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const
|
||||
|
||||
bool GitClient::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return vcsFullySynchronousExec(workingDirectory, { "ls-files", "--error-unmatch", fileName }).result
|
||||
return vcsFullySynchronousExec(workingDirectory, {"ls-files", "--error-unmatch", fileName}).result
|
||||
== SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ void GitClient::stage(const QString &patch, bool revert)
|
||||
patchFile.write(patchData);
|
||||
patchFile.close();
|
||||
|
||||
QStringList args = { "--cached" };
|
||||
QStringList args = {"--cached"};
|
||||
if (revert)
|
||||
args << "--reverse";
|
||||
QString errorMessage;
|
||||
@@ -767,7 +767,7 @@ void GitClient::diffProject(const QString &workingDirectory, const QString &proj
|
||||
workingDirectory, tr("Git Diff Project"),
|
||||
[this, workingDirectory, projectDirectory]
|
||||
(IDocument *doc) -> DiffEditorController* {
|
||||
return new ProjectDiffController(doc, workingDirectory, { projectDirectory });
|
||||
return new ProjectDiffController(doc, workingDirectory, {projectDirectory});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -819,7 +819,7 @@ void GitClient::merge(const QString &workingDirectory,
|
||||
void GitClient::status(const QString &workingDirectory)
|
||||
{
|
||||
VcsOutputWindow::setRepository(workingDirectory);
|
||||
VcsCommand *command = vcsExec(workingDirectory, { "status", "-u" }, nullptr, true);
|
||||
VcsCommand *command = vcsExec(workingDirectory, {"status", "-u"}, nullptr, true);
|
||||
connect(command, &VcsCommand::finished, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository,
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
@@ -853,7 +853,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||
editor->setWorkingDirectory(workingDir);
|
||||
|
||||
QStringList arguments = { "log", noColorOption, decorateOption };
|
||||
QStringList arguments = {"log", noColorOption, decorateOption};
|
||||
int logCount = settings().intValue(GitSettings::logCountKey);
|
||||
if (logCount > 0)
|
||||
arguments << "-n" << QString::number(logCount);
|
||||
@@ -874,7 +874,7 @@ void GitClient::reflog(const QString &workingDirectory)
|
||||
"reflogRepository", workingDirectory);
|
||||
editor->setWorkingDirectory(workingDirectory);
|
||||
|
||||
QStringList arguments = { "reflog", noColorOption, decorateOption };
|
||||
QStringList arguments = {"reflog", noColorOption, decorateOption};
|
||||
int logCount = settings().intValue(GitSettings::logCountKey);
|
||||
if (logCount > 0)
|
||||
arguments << "-n" << QString::number(logCount);
|
||||
@@ -921,7 +921,7 @@ VcsBaseEditorWidget *GitClient::annotate(
|
||||
int lineNumber, const QStringList &extraOptions)
|
||||
{
|
||||
const Id editorId = Git::Constants::GIT_BLAME_EDITOR_ID;
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, { file }, revision);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, {file}, revision);
|
||||
const QString title = tr("Git Blame \"%1\"").arg(id);
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, file);
|
||||
|
||||
@@ -942,7 +942,7 @@ VcsBaseEditorWidget *GitClient::annotate(
|
||||
}
|
||||
|
||||
editor->setWorkingDirectory(workingDir);
|
||||
QStringList arguments = { "blame", "--root" };
|
||||
QStringList arguments = {"blame", "--root"};
|
||||
arguments << effectiveArgs << "--" << file;
|
||||
if (!revision.isEmpty())
|
||||
arguments << revision;
|
||||
@@ -971,7 +971,7 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
|
||||
QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory,
|
||||
const QString &ref)
|
||||
{
|
||||
QStringList arguments = { "checkout", ref };
|
||||
QStringList arguments = {"checkout", ref};
|
||||
|
||||
QStringList localBranches = synchronousRepositoryBranches(workingDirectory);
|
||||
if (localBranches.contains(ref))
|
||||
@@ -996,7 +996,7 @@ QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory,
|
||||
return arguments;
|
||||
|
||||
QString output;
|
||||
const QStringList forEachRefArgs = { "refs/remotes/", "--format=%(objectname) %(refname:short)" };
|
||||
const QStringList forEachRefArgs = {"refs/remotes/", "--format=%(objectname) %(refname:short)"};
|
||||
if (!synchronousForEachRefCmd(workingDirectory, forEachRefArgs, &output))
|
||||
return arguments;
|
||||
|
||||
@@ -1033,7 +1033,7 @@ QStringList GitClient::setupCheckoutArguments(const QString &workingDirectory,
|
||||
|
||||
void GitClient::reset(const QString &workingDirectory, const QString &argument, const QString &commit)
|
||||
{
|
||||
QStringList arguments = { "reset", argument };
|
||||
QStringList arguments = {"reset", argument};
|
||||
if (!commit.isEmpty())
|
||||
arguments << commit;
|
||||
|
||||
@@ -1055,13 +1055,13 @@ void GitClient::reset(const QString &workingDirectory, const QString &argument,
|
||||
|
||||
void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
|
||||
{
|
||||
vcsExec(workingDirectory, { "add", fileName });
|
||||
vcsExec(workingDirectory, {"add", fileName});
|
||||
}
|
||||
|
||||
bool GitClient::synchronousLog(const QString &workingDirectory, const QStringList &arguments,
|
||||
QString *output, QString *errorMessageIn, unsigned flags)
|
||||
{
|
||||
QStringList allArguments = { "log", noColorOption };
|
||||
QStringList allArguments = {"log", noColorOption};
|
||||
|
||||
allArguments.append(arguments);
|
||||
|
||||
@@ -1080,7 +1080,7 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis
|
||||
|
||||
bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
|
||||
{
|
||||
return vcsFullySynchronousExec(workingDirectory, QStringList({ "add" }) + files).result
|
||||
return vcsFullySynchronousExec(workingDirectory, QStringList({"add"}) + files).result
|
||||
== SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
@@ -1088,7 +1088,7 @@ bool GitClient::synchronousDelete(const QString &workingDirectory,
|
||||
bool force,
|
||||
const QStringList &files)
|
||||
{
|
||||
QStringList arguments = { "rm" };
|
||||
QStringList arguments = {"rm"};
|
||||
if (force)
|
||||
arguments << "--force";
|
||||
arguments.append(files);
|
||||
@@ -1100,7 +1100,7 @@ bool GitClient::synchronousMove(const QString &workingDirectory,
|
||||
const QString &from,
|
||||
const QString &to)
|
||||
{
|
||||
return vcsFullySynchronousExec(workingDirectory, { "mv", from, to }).result
|
||||
return vcsFullySynchronousExec(workingDirectory, {"mv", from, to}).result
|
||||
== SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
@@ -1108,7 +1108,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
const QStringList &files,
|
||||
QString *errorMessage)
|
||||
{
|
||||
QStringList arguments = { "reset" };
|
||||
QStringList arguments = {"reset"};
|
||||
if (files.isEmpty())
|
||||
arguments << "--hard";
|
||||
else
|
||||
@@ -1137,7 +1137,7 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
// Initialize repository
|
||||
bool GitClient::synchronousInit(const QString &workingDirectory)
|
||||
{
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, { "init" });
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, {"init"});
|
||||
// '[Re]Initialized...'
|
||||
VcsOutputWindow::append(resp.stdOut());
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
@@ -1160,7 +1160,7 @@ bool GitClient::synchronousCheckoutFiles(const QString &workingDirectory, QStrin
|
||||
revision = HEAD;
|
||||
if (files.isEmpty())
|
||||
files = QStringList(".");
|
||||
QStringList arguments = { "checkout" };
|
||||
QStringList arguments = {"checkout"};
|
||||
if (revertStaging)
|
||||
arguments << revision;
|
||||
arguments << "--" << files;
|
||||
@@ -1224,7 +1224,7 @@ static inline bool splitCommitParents(const QString &line,
|
||||
bool GitClient::synchronousRevListCmd(const QString &workingDirectory, const QStringList &extraArguments,
|
||||
QString *output, QString *errorMessage) const
|
||||
{
|
||||
const QStringList arguments = QStringList({ "rev-list", noColorOption }) + extraArguments;
|
||||
const QStringList arguments = QStringList({"rev-list", noColorOption}) + extraArguments;
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDirectory, arguments, silentFlags);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
@@ -1248,7 +1248,7 @@ bool GitClient::synchronousParentRevisions(const QString &workingDirectory,
|
||||
}
|
||||
QString outputText;
|
||||
QString errorText;
|
||||
if (!synchronousRevListCmd(workingDirectory, { "--parents", "--max-count=1", revision },
|
||||
if (!synchronousRevListCmd(workingDirectory, {"--parents", "--max-count=1", revision},
|
||||
&outputText, &errorText)) {
|
||||
*errorMessage = msgParentRevisionFailed(workingDirectory, revision, errorText);
|
||||
return false;
|
||||
@@ -1285,7 +1285,7 @@ QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory
|
||||
{
|
||||
QString branch;
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDirectory, { "symbolic-ref", HEAD }, silentFlags);
|
||||
workingDirectory, {"symbolic-ref", HEAD}, silentFlags);
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
branch = resp.stdOut().trimmed();
|
||||
} else {
|
||||
@@ -1308,7 +1308,7 @@ QString GitClient::synchronousCurrentLocalBranch(const QString &workingDirectory
|
||||
bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
const QStringList arguments = { "show-ref", "--head", "--abbrev=10", "--dereference" };
|
||||
const QStringList arguments = {"show-ref", "--head", "--abbrev=10", "--dereference"};
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDirectory, arguments, silentFlags);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
@@ -1359,7 +1359,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const
|
||||
|
||||
// No tag or remote branch - try git describe
|
||||
const SynchronousProcessResponse resp =
|
||||
vcsFullySynchronousExec(workingDirectory, { "describe" }, VcsCommand::NoOutput);
|
||||
vcsFullySynchronousExec(workingDirectory, {"describe"}, VcsCommand::NoOutput);
|
||||
if (resp.result == SynchronousProcessResponse::Finished) {
|
||||
const QString stdOut = resp.stdOut().trimmed();
|
||||
if (!stdOut.isEmpty())
|
||||
@@ -1371,7 +1371,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const
|
||||
bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
|
||||
QString *output, QString *errorMessage) const
|
||||
{
|
||||
const QStringList arguments = { "rev-parse", ref };
|
||||
const QStringList arguments = {"rev-parse", ref};
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDirectory, arguments, silentFlags);
|
||||
*output = resp.stdOut().trimmed();
|
||||
@@ -1397,7 +1397,7 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
|
||||
QString &precedes, QString &follows) const
|
||||
{
|
||||
const SynchronousProcessResponse resp1 = vcsFullySynchronousExec(
|
||||
workingDirectory, { "describe", "--contains", revision }, silentFlags);
|
||||
workingDirectory, {"describe", "--contains", revision}, silentFlags);
|
||||
precedes = resp1.stdOut();
|
||||
int tilde = precedes.indexOf('~');
|
||||
if (tilde != -1)
|
||||
@@ -1410,7 +1410,7 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
|
||||
synchronousParentRevisions(workingDirectory, revision, &parents, &errorMessage);
|
||||
for (const QString &p : Utils::asConst(parents)) {
|
||||
const SynchronousProcessResponse resp2 = vcsFullySynchronousExec(
|
||||
workingDirectory, { "describe", "--tags", "--abbrev=0", p }, silentFlags);
|
||||
workingDirectory, {"describe", "--tags", "--abbrev=0", p}, silentFlags);
|
||||
QString pf = resp2.stdOut();
|
||||
pf.truncate(pf.lastIndexOf('\n'));
|
||||
if (!pf.isEmpty()) {
|
||||
@@ -1426,7 +1426,7 @@ void GitClient::branchesForCommit(const QString &revision)
|
||||
auto controller = qobject_cast<DiffEditorController *>(sender());
|
||||
QString workingDirectory = controller->baseDirectory();
|
||||
VcsCommand *command = vcsExec(
|
||||
workingDirectory, { "branch", noColorOption, "-a", "--contains", revision}, nullptr,
|
||||
workingDirectory, {"branch", noColorOption, "-a", "--contains", revision}, nullptr,
|
||||
false, 0, workingDirectory);
|
||||
connect(command, &VcsCommand::stdOutText, controller,
|
||||
&DiffEditorController::informationForCommitReceived);
|
||||
@@ -1435,13 +1435,13 @@ void GitClient::branchesForCommit(const QString &revision)
|
||||
bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &commit)
|
||||
{
|
||||
return !vcsFullySynchronousExec(
|
||||
workingDirectory, { "branch", "-r", "--contains", commit }, silentFlags).rawStdOut.isEmpty();
|
||||
workingDirectory, {"branch", "-r", "--contains", commit}, silentFlags).rawStdOut.isEmpty();
|
||||
}
|
||||
|
||||
bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QString &branch)
|
||||
{
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDirectory, { "merge-base", HEAD, branch }, silentFlags);
|
||||
workingDirectory, {"merge-base", HEAD, branch}, silentFlags);
|
||||
return resp.stdOut().trimmed() == synchronousTopRevision(workingDirectory);
|
||||
}
|
||||
|
||||
@@ -1449,8 +1449,8 @@ bool GitClient::isFastForwardMerge(const QString &workingDirectory, const QStrin
|
||||
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
|
||||
const QString &format) const
|
||||
{
|
||||
const QStringList arguments = { "log", noColorOption, ("--pretty=format:" + format),
|
||||
"--max-count=1", revision };
|
||||
const QStringList arguments = {"log", noColorOption, ("--pretty=format:" + format),
|
||||
"--max-count=1", revision};
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDirectory, arguments, silentFlags);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
@@ -1524,7 +1524,7 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
|
||||
bool unstagedOnly,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
QStringList arguments = { "stash", "save" };
|
||||
QStringList arguments = {"stash", "save"};
|
||||
if (unstagedOnly)
|
||||
arguments << "--keep-index";
|
||||
if (!message.isEmpty())
|
||||
@@ -1638,7 +1638,7 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi
|
||||
|
||||
QString output;
|
||||
QString error;
|
||||
if (!synchronousRemoteCmd(workingDirectory, { "-v" }, &output, &error, true)) {
|
||||
if (!synchronousRemoteCmd(workingDirectory, {"-v"}, &output, &error, true)) {
|
||||
msgCannotRun(error, errorMessage);
|
||||
return result;
|
||||
}
|
||||
@@ -1662,7 +1662,7 @@ QStringList GitClient::synchronousSubmoduleStatus(const QString &workingDirector
|
||||
{
|
||||
// get submodule status
|
||||
const SynchronousProcessResponse resp =
|
||||
vcsFullySynchronousExec(workingDirectory, { "submodule", "status" }, silentFlags);
|
||||
vcsFullySynchronousExec(workingDirectory, {"submodule", "status"}, silentFlags);
|
||||
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
msgCannotRun(tr("Cannot retrieve submodule status of \"%1\": %2")
|
||||
@@ -1741,7 +1741,7 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString &
|
||||
*errorMessage = msgCannotShow(id);
|
||||
return false;
|
||||
}
|
||||
const QStringList arguments = { "show", decorateOption, noColorOption, id };
|
||||
const QStringList arguments = {"show", decorateOption, noColorOption, id};
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
|
||||
@@ -1756,7 +1756,7 @@ bool GitClient::cleanList(const QString &workingDirectory, const QString &module
|
||||
const QString &flag, QStringList *files, QString *errorMessage)
|
||||
{
|
||||
const QString directory = workingDirectory + '/' + modulePath;
|
||||
const QStringList arguments = { "clean", "--dry-run", flag };
|
||||
const QStringList arguments = {"clean", "--dry-run", flag};
|
||||
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(directory, arguments);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
@@ -1801,7 +1801,7 @@ bool GitClient::synchronousApplyPatch(const QString &workingDirectory,
|
||||
const QString &file, QString *errorMessage,
|
||||
const QStringList &extraArguments)
|
||||
{
|
||||
QStringList arguments = { "apply", "--whitespace=fix" };
|
||||
QStringList arguments = {"apply", "--whitespace=fix"};
|
||||
arguments << extraArguments << file;
|
||||
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
|
||||
@@ -1913,7 +1913,7 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p
|
||||
}
|
||||
}
|
||||
|
||||
VcsCommand *cmd = vcsExec(workingDirectory, { "submodule", "update" }, nullptr, true,
|
||||
VcsCommand *cmd = vcsExec(workingDirectory, {"submodule", "update"}, nullptr, true,
|
||||
VcsCommand::ExpectRepoChanges);
|
||||
connect(cmd, &VcsCommand::finished, this, &GitClient::finishSubmoduleUpdate);
|
||||
}
|
||||
@@ -1929,7 +1929,7 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
|
||||
QString *output, QString *errorMessage) const
|
||||
{
|
||||
// Run 'status'. Note that git returns exitcode 1 if there are no added files.
|
||||
QStringList arguments = { "status" };
|
||||
QStringList arguments = {"status"};
|
||||
if (mode & NoUntracked)
|
||||
arguments << "--untracked-files=no";
|
||||
else
|
||||
@@ -2107,7 +2107,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
|
||||
| VcsCommand::SuppressStdErr
|
||||
| VcsCommand::SuppressFailMessage;
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(
|
||||
workingDirectory, { "ls-remote", repositoryURL, HEAD, "refs/heads/*" }, flags);
|
||||
workingDirectory, {"ls-remote", repositoryURL, HEAD, "refs/heads/*"}, flags);
|
||||
QStringList branches;
|
||||
branches << tr("<Detached HEAD>");
|
||||
QString headSha;
|
||||
@@ -2177,7 +2177,7 @@ void GitClient::launchRepositoryBrowser(const QString &workingDirectory)
|
||||
{
|
||||
const QString repBrowserBinary = settings().stringValue(GitSettings::repositoryBrowserCmd);
|
||||
if (!repBrowserBinary.isEmpty())
|
||||
QProcess::startDetached(repBrowserBinary, { workingDirectory }, workingDirectory);
|
||||
QProcess::startDetached(repBrowserBinary, {workingDirectory}, workingDirectory);
|
||||
}
|
||||
|
||||
bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
||||
@@ -2228,7 +2228,7 @@ bool GitClient::launchGitGui(const QString &workingDirectory) {
|
||||
if (gitBinary.isEmpty()) {
|
||||
success = false;
|
||||
} else {
|
||||
success = QProcess::startDetached(gitBinary.toString(), { "gui" },
|
||||
success = QProcess::startDetached(gitBinary.toString(), {"gui"},
|
||||
workingDirectory);
|
||||
}
|
||||
|
||||
@@ -2289,7 +2289,7 @@ bool GitClient::readDataFromCommit(const QString &repoDirectory, const QString &
|
||||
QString *commitTemplate)
|
||||
{
|
||||
// Get commit data as "SHA1<lf>author<lf>email<lf>message".
|
||||
const QStringList arguments = { "log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit };
|
||||
const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit};
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(repoDirectory, arguments, silentFlags);
|
||||
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
@@ -2337,7 +2337,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
// Run status. Note that it has exitcode 1 if there are no added files.
|
||||
QString output;
|
||||
if (commitData.commitType == FixupCommit) {
|
||||
synchronousLog(repoDirectory, { HEAD, "--not", "--remotes", "-n1" }, &output, errorMessage);
|
||||
synchronousLog(repoDirectory, {HEAD, "--not", "--remotes", "-n1"}, &output, errorMessage);
|
||||
if (output.isEmpty()) {
|
||||
*errorMessage = msgNoCommits(false);
|
||||
return false;
|
||||
@@ -2529,7 +2529,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
return false;
|
||||
|
||||
// Do the final commit
|
||||
QStringList arguments = { "commit" };
|
||||
QStringList arguments = {"commit"};
|
||||
if (commitType == FixupCommit) {
|
||||
arguments << "--fixup" << amendSHA1;
|
||||
} else {
|
||||
@@ -2668,7 +2668,7 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
|
||||
|
||||
void GitClient::fetch(const QString &workingDirectory, const QString &remote)
|
||||
{
|
||||
QStringList const arguments = { "fetch", (remote.isEmpty() ? "--all" : remote) };
|
||||
QStringList const arguments = {"fetch", (remote.isEmpty() ? "--all" : remote)};
|
||||
VcsCommand *command = vcsExec(workingDirectory, arguments, nullptr, true,
|
||||
VcsCommand::ShowSuccessMessage);
|
||||
connect(command, &VcsCommand::success,
|
||||
@@ -2693,7 +2693,7 @@ bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase)
|
||||
{
|
||||
QString abortCommand;
|
||||
QStringList arguments = { "pull" };
|
||||
QStringList arguments = {"pull"};
|
||||
if (rebase) {
|
||||
arguments << "--rebase";
|
||||
abortCommand = "rebase";
|
||||
@@ -2720,7 +2720,7 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
|
||||
}
|
||||
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(
|
||||
workingDir, { abortCommand, "--abort" },
|
||||
workingDir, {abortCommand, "--abort"},
|
||||
VcsCommand::ExpectRepoChanges | VcsCommand::ShowSuccessMessage);
|
||||
VcsOutputWindow::append(resp.stdOut());
|
||||
}
|
||||
@@ -2746,7 +2746,7 @@ bool GitClient::synchronousSetTrackingBranch(const QString &workingDirectory,
|
||||
const QString &branch, const QString &tracking)
|
||||
{
|
||||
return vcsFullySynchronousExec(
|
||||
workingDirectory, { "branch", "--set-upstream-to=" + tracking, branch }).result
|
||||
workingDirectory, {"branch", "--set-upstream-to=" + tracking, branch}).result
|
||||
== SynchronousProcessResponse::Finished;
|
||||
}
|
||||
|
||||
@@ -2787,7 +2787,7 @@ void GitClient::handleMergeConflicts(const QString &workingDir, const QString &c
|
||||
if (mergeOrAbort.clickedButton() == mergeToolButton)
|
||||
merge(workingDir);
|
||||
else if (!abortCommand.isEmpty())
|
||||
executeAndHandleConflicts(workingDir, { abortCommand, "--skip" }, abortCommand);
|
||||
executeAndHandleConflicts(workingDir, {abortCommand, "--skip"}, abortCommand);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2803,12 +2803,12 @@ void GitClient::synchronousSubversionFetch(const QString &workingDirectory)
|
||||
const unsigned flags = VcsCommand::SshPasswordPrompt
|
||||
| VcsCommand::ShowStdOut
|
||||
| VcsCommand::ShowSuccessMessage;
|
||||
vcsSynchronousExec(workingDirectory, { "svn", "fetch" }, flags);
|
||||
vcsSynchronousExec(workingDirectory, {"svn", "fetch"}, flags);
|
||||
}
|
||||
|
||||
void GitClient::subversionLog(const QString &workingDirectory)
|
||||
{
|
||||
QStringList arguments = { "svn", "log" };
|
||||
QStringList arguments = {"svn", "log"};
|
||||
int logCount = settings().intValue(GitSettings::logCountKey);
|
||||
if (logCount > 0)
|
||||
arguments << ("--limit=" + QString::number(logCount));
|
||||
@@ -2825,14 +2825,14 @@ void GitClient::subversionLog(const QString &workingDirectory)
|
||||
|
||||
void GitClient::push(const QString &workingDirectory, const QStringList &pushArgs)
|
||||
{
|
||||
vcsExec(workingDirectory, QStringList({ "push" }) + pushArgs, nullptr, true);
|
||||
vcsExec(workingDirectory, QStringList({"push"}) + pushArgs, nullptr, true);
|
||||
}
|
||||
|
||||
bool GitClient::synchronousMerge(const QString &workingDirectory, const QString &branch,
|
||||
bool allowFastForward)
|
||||
{
|
||||
QString command = "merge";
|
||||
QStringList arguments = { command };
|
||||
QStringList arguments = {command};
|
||||
if (!allowFastForward)
|
||||
arguments << "--no-ff";
|
||||
arguments << branch;
|
||||
@@ -2854,18 +2854,18 @@ bool GitClient::canRebase(const QString &workingDirectory) const
|
||||
|
||||
void GitClient::rebase(const QString &workingDirectory, const QString &argument)
|
||||
{
|
||||
VcsCommand *command = vcsExecAbortable(workingDirectory, { "rebase", argument });
|
||||
VcsCommand *command = vcsExecAbortable(workingDirectory, {"rebase", argument});
|
||||
GitProgressParser::attachToCommand(command);
|
||||
}
|
||||
|
||||
void GitClient::cherryPick(const QString &workingDirectory, const QString &argument)
|
||||
{
|
||||
vcsExecAbortable(workingDirectory, { "cherry-pick", argument });
|
||||
vcsExecAbortable(workingDirectory, {"cherry-pick", argument});
|
||||
}
|
||||
|
||||
void GitClient::revert(const QString &workingDirectory, const QString &argument)
|
||||
{
|
||||
vcsExecAbortable(workingDirectory, { "revert", argument });
|
||||
vcsExecAbortable(workingDirectory, {"revert", argument});
|
||||
}
|
||||
|
||||
// Executes a command asynchronously. Work tree is expected to be clean.
|
||||
@@ -2893,7 +2893,7 @@ bool GitClient::synchronousRevert(const QString &workingDirectory, const QString
|
||||
// Do not stash if --continue or --abort is given as the commit
|
||||
if (!commit.startsWith('-') && !beginStashScope(workingDirectory, command))
|
||||
return false;
|
||||
return executeAndHandleConflicts(workingDirectory, { command, "--no-edit", commit }, command);
|
||||
return executeAndHandleConflicts(workingDirectory, {command, "--no-edit", commit}, command);
|
||||
}
|
||||
|
||||
bool GitClient::synchronousCherryPick(const QString &workingDirectory, const QString &commit)
|
||||
@@ -2904,7 +2904,7 @@ bool GitClient::synchronousCherryPick(const QString &workingDirectory, const QSt
|
||||
if (isRealCommit && !beginStashScope(workingDirectory, command))
|
||||
return false;
|
||||
|
||||
QStringList arguments = { command };
|
||||
QStringList arguments = {command};
|
||||
if (isRealCommit && isRemoteCommit(workingDirectory, commit))
|
||||
arguments << "-x";
|
||||
arguments << commit;
|
||||
@@ -2914,7 +2914,7 @@ bool GitClient::synchronousCherryPick(const QString &workingDirectory, const QSt
|
||||
|
||||
void GitClient::interactiveRebase(const QString &workingDirectory, const QString &commit, bool fixup)
|
||||
{
|
||||
QStringList arguments = { "rebase", "-i" };
|
||||
QStringList arguments = {"rebase", "-i"};
|
||||
if (fixup)
|
||||
arguments << "--autosquash";
|
||||
arguments << commit + '^';
|
||||
@@ -2938,7 +2938,7 @@ QString GitClient::msgNoCommits(bool includeRemote)
|
||||
|
||||
void GitClient::stashPop(const QString &workingDirectory, const QString &stash)
|
||||
{
|
||||
QStringList arguments = { "stash", "pop" };
|
||||
QStringList arguments = {"stash", "pop"};
|
||||
if (!stash.isEmpty())
|
||||
arguments << stash;
|
||||
VcsCommand *cmd = vcsExec(workingDirectory, arguments, nullptr, true, VcsCommand::ExpectRepoChanges);
|
||||
@@ -2950,7 +2950,7 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
||||
bool pop,
|
||||
const QString &branch /* = QString()*/) const
|
||||
{
|
||||
QStringList arguments = { "stash" };
|
||||
QStringList arguments = {"stash"};
|
||||
if (branch.isEmpty())
|
||||
arguments << QLatin1String(pop ? "pop" : "apply") << stash;
|
||||
else
|
||||
@@ -2961,7 +2961,7 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
||||
bool GitClient::synchronousStashRemove(const QString &workingDirectory, const QString &stash,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
QStringList arguments = { "stash" };
|
||||
QStringList arguments = {"stash"};
|
||||
if (stash.isEmpty())
|
||||
arguments << "clear";
|
||||
else
|
||||
@@ -2984,7 +2984,7 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, QList<Stas
|
||||
{
|
||||
stashes->clear();
|
||||
|
||||
const QStringList arguments = { "stash", "list", noColorOption };
|
||||
const QStringList arguments = {"stash", "list", noColorOption};
|
||||
const SynchronousProcessResponse resp = vcsFullySynchronousExec(workingDirectory, arguments);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
msgCannotRun(arguments, workingDirectory, resp.stdErr(), errorMessage);
|
||||
@@ -3002,18 +3002,18 @@ bool GitClient::synchronousStashList(const QString &workingDirectory, QList<Stas
|
||||
// Read a single-line config value, return trimmed
|
||||
QString GitClient::readConfigValue(const QString &workingDirectory, const QString &configVar) const
|
||||
{
|
||||
return readOneLine(workingDirectory, { "config", configVar });
|
||||
return readOneLine(workingDirectory, {"config", configVar});
|
||||
}
|
||||
|
||||
void GitClient::setConfigValue(const QString &workingDirectory, const QString &configVar,
|
||||
const QString &value) const
|
||||
{
|
||||
readOneLine(workingDirectory, { "config", configVar, value });
|
||||
readOneLine(workingDirectory, {"config", configVar, value});
|
||||
}
|
||||
|
||||
QString GitClient::readGitVar(const QString &workingDirectory, const QString &configVar) const
|
||||
{
|
||||
return readOneLine(workingDirectory, { "var", configVar });
|
||||
return readOneLine(workingDirectory, {"var", configVar});
|
||||
}
|
||||
|
||||
QString GitClient::readOneLine(const QString &workingDirectory, const QStringList &arguments) const
|
||||
@@ -3052,7 +3052,7 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
|
||||
|
||||
// run git --version
|
||||
const SynchronousProcessResponse resp = vcsSynchronousExec(
|
||||
QString(), { "--version" }, silentFlags);
|
||||
QString(), {"--version"}, silentFlags);
|
||||
if (resp.result != SynchronousProcessResponse::Finished) {
|
||||
msgCannotRun(tr("Cannot determine Git version: %1").arg(resp.stdErr()), errorMessage);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user