Commit 516161c8 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: De-noise

* Remove QLatin1{String|Char} where possible
* Use initializer lists for QStringList

Change-Id: I8479f87f4fc909b5d74d854956885564209538e4
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 539e33da
......@@ -25,15 +25,12 @@
#include "annotationhighlighter.h"
#include <QDebug>
namespace Git {
namespace Internal {
GitAnnotationHighlighter::GitAnnotationHighlighter(const ChangeNumbers &changeNumbers,
QTextDocument *document) :
VcsBase::BaseAnnotationHighlighter(changeNumbers, document),
m_blank(QLatin1Char(' '))
VcsBase::BaseAnnotationHighlighter(changeNumbers, document)
{
}
......
......@@ -41,7 +41,7 @@ public:
private:
QString changeNumber(const QString &block) const override;
const QChar m_blank;
const QChar m_blank = ' ';
};
} // namespace Internal
......
......@@ -46,20 +46,20 @@ class BranchNameValidator : public QValidator
public:
BranchNameValidator(const QStringList &localBranches, QObject *parent = 0) :
QValidator(parent),
m_invalidChars(QLatin1String(
"\\s" // no whitespace
"|~" // no "~"
"|\\^" // no "^"
"|\\[" // no "["
"|\\.\\." // no ".."
"|/\\." // no slashdot
"|:" // no ":"
"|@\\{" // no "@{" sequence
"|\\\\" // no backslash
"|//" // no double slash
"|^[/-]" // no leading slash or dash
"|\"" // no quotes
)),
m_invalidChars(
"\\s" // no whitespace
"|~" // no "~"
"|\\^" // no "^"
"|\\[" // no "["
"|\\.\\." // no ".."
"|/\\." // no slashdot
"|:" // no ":"
"|@\\{" // no "@{" sequence
"|\\\\" // no backslash
"|//" // no double slash
"|^[/-]" // no leading slash or dash
"|\"" // no quotes
),
m_localBranches(localBranches)
{
}
......@@ -70,17 +70,17 @@ public:
{
Q_UNUSED(pos)
input.replace(m_invalidChars, QLatin1String("_"));
input.replace(m_invalidChars, "_");
// "Intermediate" patterns, may change to Acceptable when user edits further:
if (input.endsWith(QLatin1String(".lock"))) //..may not end with ".lock"
if (input.endsWith(".lock")) //..may not end with ".lock"
return Intermediate;
if (input.endsWith(QLatin1Char('.'))) // no dot at the end (but allowed in the middle)
if (input.endsWith('.')) // no dot at the end (but allowed in the middle)
return Intermediate;
if (input.endsWith(QLatin1Char('/'))) // no slash at the end (but allowed in the middle)
if (input.endsWith('/')) // no slash at the end (but allowed in the middle)
return Intermediate;
if (m_localBranches.contains(input, Utils::HostOsInfo::isWindowsHost()
......
......@@ -172,7 +172,7 @@ void BranchDialog::add()
QString suggestedName;
if (!isTag) {
QString suggestedNameBase;
suggestedNameBase = trackedBranch.mid(trackedBranch.lastIndexOf(QLatin1Char('/')) + 1);
suggestedNameBase = trackedBranch.mid(trackedBranch.lastIndexOf('/') + 1);
suggestedName = suggestedNameBase;
int i = 2;
while (localNames.contains(suggestedName)) {
......@@ -208,7 +208,7 @@ void BranchDialog::checkout()
const QString currentBranch = m_model->fullName(m_model->currentBranch());
const QString nextBranch = m_model->fullName(idx);
const QString popMessageStart = QCoreApplication::applicationName() +
QLatin1Char(' ') + nextBranch + QLatin1String("-AutoStash ");
' ' + nextBranch + "-AutoStash ";
BranchCheckoutDialog branchCheckoutDialog(this, currentBranch, nextBranch);
GitClient *client = GitPlugin::client();
......@@ -232,12 +232,10 @@ void BranchDialog::checkout()
} else if (branchCheckoutDialog.exec() == QDialog::Accepted) {
if (branchCheckoutDialog.makeStashOfCurrentBranch()) {
if (client->synchronousStash(m_repository,
currentBranch + QLatin1String("-AutoStash")).isEmpty()) {
if (client->synchronousStash(m_repository, currentBranch + "-AutoStash").isEmpty())
return;
}
} else if (branchCheckoutDialog.moveLocalChangesToNextBranch()) {
if (!client->beginStashScope(m_repository, QLatin1String("Checkout"), NoPrompt))
if (!client->beginStashScope(m_repository, "Checkout", NoPrompt))
return;
} else if (branchCheckoutDialog.discardLocalChanges()) {
if (!client->synchronousReset(m_repository))
......@@ -351,7 +349,7 @@ void BranchDialog::reset()
if (QMessageBox::question(this, tr("Git Reset"), tr("Hard reset branch \"%1\" to \"%2\"?")
.arg(currentName).arg(branchName),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
GitPlugin::client()->reset(m_repository, QLatin1String("--hard"), branchName);
GitPlugin::client()->reset(m_repository, "--hard", branchName);
}
}
......@@ -374,7 +372,7 @@ void BranchDialog::merge()
return;
allowFastForward = (chosen == fastForward);
}
if (client->beginStashScope(m_repository, QLatin1String("merge"), AllowUnstashed))
if (client->beginStashScope(m_repository, "merge", AllowUnstashed))
client->synchronousMerge(m_repository, branch, allowFastForward);
}
......@@ -387,7 +385,7 @@ void BranchDialog::rebase()
const QString baseBranch = m_model->fullName(idx, true);
GitClient *client = GitPlugin::client();
if (client->beginStashScope(m_repository, QLatin1String("rebase")))
if (client->beginStashScope(m_repository, "rebase"))
client->rebase(m_repository, baseBranch);
}
......
This diff is collapsed.
......@@ -119,7 +119,7 @@ void ChangeSelectionDialog::selectCommitFromRecentHistory()
return;
QString commit = change();
int tilde = commit.indexOf(QLatin1Char('~'));
int tilde = commit.indexOf('~');
if (tilde != -1)
commit.truncate(tilde);
LogChangeDialog dialog(false, this);
......@@ -219,12 +219,11 @@ void ChangeSelectionDialog::recalculateCompletion()
return;
GitClient *client = GitPlugin::client();
QStringList args;
args << QLatin1String("--format=%(refname:short)");
VcsBase::VcsCommand *command = client->asyncForEachRefCmd(workingDir, args);
VcsBase::VcsCommand *command = client->asyncForEachRefCmd(
workingDir, { "--format=%(refname:short)" });
connect(this, &QObject::destroyed, command, &VcsBase::VcsCommand::abort);
connect(command, &VcsBase::VcsCommand::stdOutText, [this](const QString &output) {
m_changeModel->setStringList(output.split(QLatin1Char('\n')));
m_changeModel->setStringList(output.split('\n'));
});
}
......@@ -245,9 +244,6 @@ void ChangeSelectionDialog::recalculateDetails()
return;
}
QStringList args;
args << QLatin1String("show") << QLatin1String("--stat=80") << ref;
m_process = new QProcess(this);
m_process->setWorkingDirectory(workingDir);
m_process->setProcessEnvironment(m_gitEnvironment);
......@@ -255,7 +251,7 @@ void ChangeSelectionDialog::recalculateDetails()
connect(m_process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
this, &ChangeSelectionDialog::setDetails);
m_process->start(m_gitExecutable.toString(), args);
m_process->start(m_gitExecutable.toString(), { "show", "--stat=80", ref });
m_process->closeWriteChannel();
if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));
......
......@@ -54,9 +54,9 @@ QString GitSubmitEditorPanelData::authorString() const
if (email.isEmpty())
return rc;
rc += QLatin1String(" <");
rc += " <";
rc += email;
rc += QLatin1Char('>');
rc += '>';
return rc;
}
......@@ -114,7 +114,7 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
{
QTC_ASSERT(stateInfo.count() == 2, return false);
if (stateInfo == QLatin1String("??")) {
if (stateInfo == "??") {
files.append(qMakePair(FileStates(UntrackedFile), file));
return true;
}
......@@ -143,7 +143,7 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
if (yState != EmptyFileState) {
QString newFile = file;
if (xState & (RenamedFile | CopiedFile))
newFile = file.mid(file.indexOf(QLatin1String(" -> ")) + 4);
newFile = file.mid(file.indexOf(" -> ") + 4);
files.append(qMakePair(yState, newFile));
}
......@@ -159,20 +159,20 @@ bool CommitData::checkLine(const QString &stateInfo, const QString &file)
\endcode */
bool CommitData::parseFilesFromStatus(const QString &output)
{
const QStringList lines = output.split(QLatin1Char('\n'));
const QStringList lines = output.split('\n');
foreach (const QString &line, lines) {
if (line.isEmpty())
continue;
if (line.startsWith(QLatin1String("## "))) {
if (line.startsWith("## ")) {
// Branch indication:
panelInfo.branch = line.mid(3);
continue;
}
QTC_ASSERT(line.at(2) == QLatin1Char(' '), continue);
QTC_ASSERT(line.at(2) == ' ', continue);
QString file = line.mid(3);
if (file.startsWith(QLatin1Char('"')))
if (file.startsWith('"'))
file.remove(0, 1).chop(1);
if (!checkLine(line.mid(0, 2), file))
return false;
......
......@@ -39,16 +39,16 @@ void BranchComboBox::init(const QString &repository)
QString currentBranch = GitPlugin::client()->synchronousCurrentLocalBranch(repository);
if (currentBranch.isEmpty()) {
m_detached = true;
currentBranch = QLatin1String("HEAD");
currentBranch = "HEAD";
addItem(currentBranch);
}
QString output;
const QString branchPrefix(QLatin1String("refs/heads/"));
QStringList args;
args << QLatin1String("--format=%(refname)") << branchPrefix;
if (!GitPlugin::client()->synchronousForEachRefCmd(m_repository, args, &output))
const QString branchPrefix("refs/heads/");
if (!GitPlugin::client()->synchronousForEachRefCmd(
m_repository, { "--format=%(refname)", branchPrefix }, &output)) {
return;
QStringList branches = output.trimmed().split(QLatin1Char('\n'));
}
QStringList branches = output.trimmed().split('\n');
foreach (const QString &ref, branches) {
const QString branch = ref.mid(branchPrefix.size());
addItem(branch);
......
......@@ -69,7 +69,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
, m_filterLineEdit(new Utils::FancyLineEdit)
, m_repositoryChooser(new Utils::PathChooser)
, m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Close))
, m_repositoryChooserLabel(new QLabel(tr("Apply in:") + QLatin1Char(' '), this))
, m_repositoryChooserLabel(new QLabel(tr("Apply in:") + ' ', this))
, m_fetchRunning(false)
{
setWindowTitle(tr("Gerrit %1@%2").arg(p->user, p->host));
......@@ -144,7 +144,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
detailsLayout->addWidget(m_detailsBrowser);
m_repositoryChooser->setExpectedKind(Utils::PathChooser::Directory);
m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History"));
m_repositoryChooser->setHistoryCompleter("Git.RepoDir.History");
QHBoxLayout *repoPathLayout = new QHBoxLayout;
repoPathLayout->addWidget(m_repositoryChooserLabel);
repoPathLayout->addWidget(m_repositoryChooser);
......
......@@ -86,9 +86,9 @@ QDebug operator<<(QDebug d, const GerritChange &c)
// Format default Url for a change
static inline QString defaultUrl(const QSharedPointer<GerritParameters> &p, int gerritNumber)
{
QString result = p->https ? QLatin1String("https://") : QLatin1String("http://");
QString result = QLatin1String(p->https ? "https://" : "http://");
result += p->host;
result += QLatin1Char('/');
result += '/';
result += QString::number(gerritNumber);
return result;
}
......@@ -146,7 +146,7 @@ QString GerritPatchSet::approvalsColumn() const
TypeReviewMap reviews; // Sort approvals into a map by type character
foreach (const GerritApproval &a, approvals) {
if (a.type != QLatin1String("STGN")) { // Qt-Project specific: Ignore "STGN" (Staged)
if (a.type != "STGN") { // Qt-Project specific: Ignore "STGN" (Staged)
const QChar typeChar = a.type.at(0);
TypeReviewMapIterator it = reviews.find(typeChar);
if (it == reviews.end())
......@@ -183,7 +183,7 @@ int GerritPatchSet::approvalLevel() const
QString GerritChange::filterString() const
{
const QChar blank = QLatin1Char(' ');
const QChar blank = ' ';
QString result = QString::number(number) + blank + title + blank
+ owner + blank + project + blank
+ branch + blank + status;
......@@ -197,10 +197,10 @@ QString GerritChange::filterString() const
QStringList GerritChange::gitFetchArguments(const QSharedPointer<GerritParameters> &p) const
{
QStringList arguments;
const QString url = QLatin1String("ssh://") + p->sshHostArgument()
+ QLatin1Char(':') + QString::number(p->port) + QLatin1Char('/')
const QString url = "ssh://" + p->sshHostArgument()
+ ':' + QString::number(p->port) + '/'
+ project;
arguments << QLatin1String("fetch") << url << currentPatchSet.ref;
arguments << "fetch" << url << currentPatchSet.ref;
return arguments;
}
......@@ -276,9 +276,9 @@ QueryContext::QueryContext(const QStringList &queries,
m_progress.setProgressRange(0, m_queries.size());
// Determine binary and common command line arguments.
m_baseArguments << QLatin1String("query") << QLatin1String("--dependencies")
<< QLatin1String("--current-patch-set")
<< QLatin1String("--format=JSON");
m_baseArguments << "query" << "--dependencies"
<< "--current-patch-set"
<< "--format=JSON";
m_binary = m_baseArguments.front();
m_baseArguments.pop_front();
......@@ -404,7 +404,7 @@ GerritModel::GerritModel(const QSharedPointer<GerritParameters> &p, QObject *par
, m_parameters(p)
{
QStringList headers; // Keep in sync with GerritChange::toHtml()
headers << QLatin1String("#") << tr("Subject") << tr("Owner")
headers << "#" << tr("Subject") << tr("Owner")
<< tr("Updated") << tr("Project")
<< tr("Approvals") << tr("Status");
setHorizontalHeaderLabels(headers);
......@@ -463,7 +463,7 @@ QString GerritModel::toHtml(const QModelIndex& index) const
if (!index.isValid())
return QString();
const GerritChangePtr c = change(index);
const QString serverPrefix = c->url.left(c->url.lastIndexOf(QLatin1Char('/')) + 1);
const QString serverPrefix = c->url.left(c->url.lastIndexOf('/') + 1);
QString result;
QTextStream str(&result);
str << "<html><head/><body><table>"
......@@ -522,14 +522,14 @@ void GerritModel::refresh(const QString &query)
queries.push_back(query);
else
{
const QString statusOpenQuery = QLatin1String("status:open");
const QString statusOpenQuery = "status:open";
if (m_parameters->user.isEmpty()) {
queries.push_back(statusOpenQuery);
} else {
// Owned by:
queries.push_back(statusOpenQuery + QLatin1String(" owner:") + m_parameters->user);
queries.push_back(statusOpenQuery + " owner:" + m_parameters->user);
// For Review by:
queries.push_back(statusOpenQuery + QLatin1String(" reviewer:") + m_parameters->user);
queries.push_back(statusOpenQuery + " reviewer:" + m_parameters->user);
}
}
......@@ -578,27 +578,27 @@ static bool parseOutput(const QSharedPointer<GerritParameters> &parameters,
QList<GerritChangePtr> &result)
{
// The output consists of separate lines containing a document each
const QString typeKey = QLatin1String("type");
const QString dependsOnKey = QLatin1String("dependsOn");
const QString neededByKey = QLatin1String("neededBy");
const QString branchKey = QLatin1String("branch");
const QString numberKey = QLatin1String("number");
const QString ownerKey = QLatin1String("owner");
const QString ownerNameKey = QLatin1String("name");
const QString ownerEmailKey = QLatin1String("email");
const QString statusKey = QLatin1String("status");
const QString projectKey = QLatin1String("project");
const QString titleKey = QLatin1String("subject");
const QString urlKey = QLatin1String("url");
const QString patchSetKey = QLatin1String("currentPatchSet");
const QString refKey = QLatin1String("ref");
const QString approvalsKey = QLatin1String("approvals");
const QString approvalsValueKey = QLatin1String("value");
const QString approvalsByKey = QLatin1String("by");
const QString lastUpdatedKey = QLatin1String("lastUpdated");
const QString typeKey = "type";
const QString dependsOnKey = "dependsOn";
const QString neededByKey = "neededBy";
const QString branchKey = "branch";
const QString numberKey = "number";
const QString ownerKey = "owner";
const QString ownerNameKey = "name";
const QString ownerEmailKey = "email";
const QString statusKey = "status";
const QString projectKey = "project";
const QString titleKey = "subject";
const QString urlKey = "url";
const QString patchSetKey = "currentPatchSet";
const QString refKey = "ref";
const QString approvalsKey = "approvals";
const QString approvalsValueKey = "value";
const QString approvalsByKey = "by";
const QString lastUpdatedKey = "lastUpdated";
const QList<QByteArray> lines = output.split('\n');
const QString approvalsTypeKey = QLatin1String("type");
const QString approvalsDescriptionKey = QLatin1String("description");
const QString approvalsTypeKey = "type";
const QString approvalsDescriptionKey = "description";
bool res = true;
result.clear();
......@@ -712,8 +712,8 @@ QList<QStandardItem *> GerritModel::changeToRow(const GerritChangePtr &c) const
row[DateColumn]->setData(c->lastUpdated, SortRole);
QString project = c->project;
if (c->branch != QLatin1String("master"))
project += QLatin1String(" (") + c->branch + QLatin1Char(')');
if (c->branch != "master")
project += " (" + c->branch + ')';
row[ProjectColumn]->setText(project);
row[StatusColumn]->setText(c->status);
row[ApprovalsColumn]->setText(c->currentPatchSet.approvalsColumn());
......@@ -759,7 +759,7 @@ void GerritModel::queryFinished(const QByteArray &output)
changes.at(i)->depth = 0;
} else {
const int dependsOnIndex = numberIndexHash.value(changes.at(i)->dependsOnNumber, -1);
if (dependsOnIndex < 0 || changes.at(dependsOnIndex)->status != QLatin1String("NEW"))
if (dependsOnIndex < 0 || changes.at(dependsOnIndex)->status != "NEW")
changes.at(i)->depth = 0;
}
}
......@@ -798,7 +798,7 @@ void GerritModel::queryFinished(const QByteArray &output)
for (; changeFromItem(parent)->depth >= 1; parent = parent->parent()) {}
parent->appendRow(newRow);
QString parentFilterString = parent->data(FilterRole).toString();
parentFilterString += QLatin1Char(' ');
parentFilterString += ' ';
parentFilterString += newRow.first()->data(FilterRole).toString();
parent->setData(QVariant(parentFilterString), FilterRole);
} else {
......
......@@ -93,8 +93,8 @@ GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
formLayout->addRow(tr("&Host:"), m_hostLineEdit);
formLayout->addRow(tr("&User:"), m_userLineEdit);
m_sshChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_sshChooser->setCommandVersionArguments(QStringList(QLatin1String("-V")));
m_sshChooser->setHistoryCompleter(QLatin1String("Git.SshCommand.History"));
m_sshChooser->setCommandVersionArguments(QStringList("-V"));
m_sshChooser->setHistoryCompleter("Git.SshCommand.History");
formLayout->addRow(tr("&ssh:"), m_sshChooser);
m_portSpinBox->setMinimum(1);
m_portSpinBox->setMaximum(65535);
......
......@@ -57,13 +57,13 @@ static inline QString detectSsh()
const QByteArray gitSsh = qgetenv("GIT_SSH");
if (!gitSsh.isEmpty())
return QString::fromLocal8Bit(gitSsh);
QString ssh = QStandardPaths::findExecutable(QLatin1String(defaultSshC));
QString ssh = QStandardPaths::findExecutable(defaultSshC);
if (!ssh.isEmpty())
return ssh;
if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
Utils::FileName path = GerritPlugin::gitBinDirectory();
if (!path.isEmpty())
ssh = path.appendPath(QLatin1String(defaultSshC)).toString();
ssh = path.appendPath(defaultSshC).toString();
}
return ssh;
}
......@@ -72,17 +72,17 @@ void GerritParameters::setPortFlagBySshType()
{
bool isPlink = false;
if (!ssh.isEmpty()) {
const QString version = Utils::PathChooser::toolVersion(ssh, QStringList(QLatin1String("-V")));
isPlink = version.contains(QLatin1String("plink"), Qt::CaseInsensitive);
const QString version = Utils::PathChooser::toolVersion(ssh, QStringList("-V"));
isPlink = version.contains("plink", Qt::CaseInsensitive);
}
portFlag = isPlink ? QLatin1String("-P") : QLatin1String(defaultPortFlag);
portFlag = isPlink ? "-P" : defaultPortFlag;
}
GerritParameters::GerritParameters()
: host(QLatin1String(defaultHostC))
: host(defaultHostC)
, port(defaultPort)
, https(true)
, portFlag(QLatin1String(defaultPortFlag))
, portFlag(defaultPortFlag)
{
}
......@@ -90,13 +90,13 @@ QStringList GerritParameters::baseCommandArguments() const
{
QStringList result;
result << ssh << portFlag << QString::number(port)
<< sshHostArgument() << QLatin1String("gerrit");
<< sshHostArgument() << "gerrit";
return result;
}
QString GerritParameters::sshHostArgument() const
{
return user.isEmpty() ? host : (user + QLatin1Char('@') + host);
return user.isEmpty() ? host : (user + '@' + host);
}
bool GerritParameters::equals(const GerritParameters &rhs) const
......@@ -107,34 +107,34 @@ bool GerritParameters::equals(const GerritParameters &rhs) const
void GerritParameters::toSettings(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(hostKeyC), host);
s->setValue(QLatin1String(userKeyC), user);
s->setValue(QLatin1String(portKeyC), port);
s->setValue(QLatin1String(portFlagKeyC), portFlag);
s->setValue(QLatin1String(sshKeyC), ssh);
s->setValue(QLatin1String(httpsKeyC), https);
s->beginGroup(settingsGroupC);
s->setValue(hostKeyC, host);
s->setValue(userKeyC, user);
s->setValue(portKeyC, port);
s->setValue(portFlagKeyC, portFlag);
s->setValue(sshKeyC, ssh);
s->setValue(httpsKeyC, https);
s->endGroup();
}
void GerritParameters::saveQueries(QSettings *s) const
{
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(savedQueriesKeyC), savedQueries.join(QLatin1Char(',')));
s->beginGroup(settingsGroupC);
s->setValue(savedQueriesKeyC, savedQueries.join(','));
s->endGroup();
}
void GerritParameters::fromSettings(const QSettings *s)
{
const QString rootKey = QLatin1String(settingsGroupC) + QLatin1Char('/');
host = s->value(rootKey + QLatin1String(hostKeyC), QLatin1String(defaultHostC)).toString();
user = s->value(rootKey + QLatin1String(userKeyC), QString()).toString();
ssh = s->value(rootKey + QLatin1String(sshKeyC), QString()).toString();
port = s->value(rootKey + QLatin1String(portKeyC), QVariant(int(defaultPort))).toInt();
portFlag = s->value(rootKey + QLatin1String(portFlagKeyC), QLatin1String(defaultPortFlag)).toString();
savedQueries = s->value(rootKey + QLatin1String(savedQueriesKeyC), QString()).toString()
.split(QLatin1Char(','));
https = s->value(rootKey + QLatin1String(httpsKeyC), QVariant(true)).toBool();
const QString rootKey = QLatin1String(settingsGroupC) + '/';
host = s->value(rootKey + hostKeyC, defaultHostC).toString();
user = s->value(rootKey + userKeyC, QString()).toString();
ssh = s->value(rootKey + sshKeyC, QString()).toString();
port = s->value(rootKey + portKeyC, QVariant(int(defaultPort))).toInt();
portFlag = s->value(rootKey + portFlagKeyC, defaultPortFlag).toString();
savedQueries = s->value(rootKey + savedQueriesKeyC, QString()).toString()
.split(',');
https = s->value(rootKey + httpsKeyC, QVariant(true)).toBool();
if (ssh.isEmpty())
ssh = detectSsh();
}
......
......@@ -243,9 +243,9 @@ void FetchContext::processError(QProcess::ProcessError e)
void FetchContext::show()
{
const QString title = QString::number(m_change->number) + QLatin1Char('/')
const QString title = QString::number(m_change->number) + '/'
+ QString::number(m_change->currentPatchSet.patchSetNumber);
GitPlugin::client()->show(m_repository, QLatin1String("FETCH_HEAD"), title);
GitPlugin::client()->show(m_repository, "FETCH_HEAD", title);
}
void FetchContext::cherryPick()
......@@ -253,12 +253,12 @@ void FetchContext::cherryPick()
// Point user to errors.
VcsBase::VcsOutputWindow::instance()->popup(IOutputPane::ModeSwitch
| IOutputPane::WithFocus);
GitPlugin::client()->synchronousCherryPick(m_repository, QLatin1String("FETCH_HEAD"));
GitPlugin::client()->synchronousCherryPick(m_repository, "FETCH_HEAD");
}
void FetchContext::checkout()
{
GitPlugin::client()->stashAndCheckout(m_repository, QLatin1String("FETCH_HEAD"));
GitPlugin::client()->stashAndCheckout(m_repository, "FETCH_HEAD");
}
void FetchContext::terminate()
......@@ -326,31 +326,26 @@ void GerritPlugin::push(const QString &topLevel)
if (dialog.exec() == QDialog::Rejected)
return;
QStringList args;
m_reviewers = dialog.reviewers();
args << dialog.selectedRemoteName();
QString target = dialog.selectedCommit();
if (target.isEmpty())
target = QLatin1String("HEAD");
target += QLatin1String(":refs/") + dialog.selectedPushType() +
QLatin1Char('/') + dialog.selectedRemoteBranchName();
target = "HEAD";
target += ":refs/" + dialog.selectedPushType() +
'/' + dialog.selectedRemoteBranchName();
const QString topic = dialog.selectedTopic();
if (!topic.isEmpty())
target += QLatin1Char('/') + topic;
target += '/' + topic;
QStringList options;
const QStringList reviewers = m_reviewers.split(QLatin1Char(','), QString::SkipEmptyParts);
const QStringList reviewers = m_reviewers.split(',', QString::SkipEmptyParts);
foreach (const QString &reviewer, reviewers)
options << QLatin1String("r=") + reviewer;
options << "r=" + reviewer;
if (!options.isEmpty())
target += QLatin1Char('%') + options.join(QLatin1Char(','));
args << target;
target += '%' + options.join(',');
GitPlugin::client()->push(topLevel, args);
GitPlugin::client()->push(topLevel, { dialog.selectedRemoteName(), target });
}
// Open or raise the Gerrit dialog window.
......@@ -432,7 +427,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
if (!remotesList.isEmpty()) {
QStringList remotes = remotesList.values();
foreach (QString remote, remotes) {
if (remote.endsWith(QLatin1String(".git")))
if (remote.endsWith(".git"))
remote.chop(4);
if (remote.contains(m_parameters->host) && remote.endsWith(change->project)) {
verifiedRepository = true;
......@@ -444,11 +439,11 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
SubmoduleDataMap submodules = GitPlugin::client()->submoduleList(repository);
foreach (const SubmoduleData &submoduleData, submodules) {
QString remote = submoduleData.url;
if (remote.endsWith(QLatin1String(".git")))
if (remote.endsWith(".git"))
remote.chop(4);
if (remote.contains(m_parameters->host) && remote.endsWith(change->project)
&& QFile::exists(repository + QLatin1Char('/') + submoduleData.dir)) {
repository = QDir::cleanPath(repository + QLatin1Char('/')
&& QFile::exists(repository + '/' + submoduleData.dir)) {
repository = QDir::cleanPath(repository + '/'
+ submoduleData.dir);
verifiedRepository = true;
break;
......@@ -504,18 +499,18 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch