forked from qt-creator/qt-creator
VcsBase & dependent: Fix const correctness
And some minor cleanups. Change-Id: Id0c2df6865ba84c054f0fb97c0ac42a76a128355 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -164,10 +164,7 @@ FilePath BazaarClient::findTopLevelForFile(const FilePath &file) const
|
||||
|
||||
bool BazaarClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args(QLatin1String("status"));
|
||||
args << fileName;
|
||||
|
||||
const CommandResult result = vcsSynchronousExec(workingDirectory, args);
|
||||
const CommandResult result = vcsSynchronousExec(workingDirectory, {"status", fileName});
|
||||
if (result.result() != ProcessResult::FinishedWithSuccess)
|
||||
return false;
|
||||
return result.rawStdOut().startsWith("unknown");
|
||||
@@ -190,7 +187,7 @@ Utils::Id BazaarClient::vcsEditorKind(VcsCommandTag cmd) const
|
||||
case LogCommand:
|
||||
return Constants::FILELOG_ID;
|
||||
default:
|
||||
return Utils::Id();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -460,8 +460,7 @@ void BazaarPluginPrivate::logCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client.log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
||||
QStringList(), true);
|
||||
m_client.log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), {}, true);
|
||||
}
|
||||
|
||||
void BazaarPluginPrivate::revertCurrentFile()
|
||||
|
@@ -33,7 +33,7 @@ QString ClearCaseEditorWidget::changeUnderCursor(const QTextCursor &c) const
|
||||
cursor.select(QTextCursor::BlockUnderCursor);
|
||||
if (!cursor.hasSelection())
|
||||
return QString();
|
||||
QString change = cursor.selectedText();
|
||||
const QString change = cursor.selectedText();
|
||||
// Annotation output has number, log output has revision numbers
|
||||
// as r1, r2...
|
||||
const QRegularExpressionMatch match = m_versionNumberPattern.match(change);
|
||||
|
@@ -892,7 +892,7 @@ void ClearCasePluginPrivate::updateStatusActions()
|
||||
FileStatus fileStatus = FileStatus::Unknown;
|
||||
bool hasFile = currentState().hasFile();
|
||||
if (hasFile) {
|
||||
QString absoluteFileName = currentState().currentFile();
|
||||
const QString absoluteFileName = currentState().currentFile();
|
||||
checkAndReIndexUnknownFile(absoluteFileName);
|
||||
fileStatus = vcsStatus(absoluteFileName);
|
||||
|
||||
@@ -1027,7 +1027,7 @@ void ClearCasePluginPrivate::undoCheckOutCurrent()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
QString file = state.relativeCurrentFile();
|
||||
const QString file = state.relativeCurrentFile();
|
||||
const QString fileName = QDir::toNativeSeparators(file);
|
||||
|
||||
QStringList args(QLatin1String("diff"));
|
||||
@@ -1219,7 +1219,7 @@ void ClearCasePluginPrivate::diffActivity()
|
||||
return;
|
||||
}
|
||||
FilePath topLevel = state.topLevel();
|
||||
QString activity = QInputDialog::getText(ICore::dialogParent(), Tr::tr("Enter Activity"),
|
||||
const QString activity = QInputDialog::getText(ICore::dialogParent(), Tr::tr("Enter Activity"),
|
||||
Tr::tr("Activity Name"), QLineEdit::Normal, m_activity);
|
||||
if (activity.isEmpty())
|
||||
return;
|
||||
@@ -1233,7 +1233,7 @@ void ClearCasePluginPrivate::diffActivity()
|
||||
QString shortver = version.mid(topLevelLen + 1);
|
||||
int atatpos = shortver.indexOf(QLatin1String("@@"));
|
||||
if (atatpos != -1) {
|
||||
QString file = shortver.left(atatpos);
|
||||
const QString file = shortver.left(atatpos);
|
||||
// latest version - updated each line
|
||||
filever[file].second = shortver;
|
||||
|
||||
@@ -1251,7 +1251,7 @@ void ClearCasePluginPrivate::diffActivity()
|
||||
}
|
||||
|
||||
if ((m_settings.diffType == GraphicalDiff) && (filever.count() == 1)) {
|
||||
QStringPair pair(filever.first());
|
||||
const QStringPair pair(filever.first());
|
||||
diffGraphical(pair.first, pair.second);
|
||||
return;
|
||||
}
|
||||
@@ -1282,8 +1282,7 @@ void ClearCasePluginPrivate::startCheckInCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
QString nativeFile = QDir::toNativeSeparators(state.relativeCurrentFile());
|
||||
startCheckIn(state.currentFileTopLevel(), QStringList(nativeFile));
|
||||
startCheckIn(state.currentFileTopLevel(), {QDir::toNativeSeparators(state.relativeCurrentFile())});
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::startCheckInAll()
|
||||
@@ -1330,7 +1329,7 @@ void ClearCasePluginPrivate::startCheckInActivity()
|
||||
for (const QString &version : versions) {
|
||||
int atatpos = version.indexOf(QLatin1String("@@"));
|
||||
if ((atatpos != -1) && (version.indexOf(QLatin1String("CHECKEDOUT"), atatpos) != -1)) {
|
||||
QString file = version.left(atatpos);
|
||||
const QString file = version.left(atatpos);
|
||||
if (file != last)
|
||||
files.append(file.mid(topLevelLen+1));
|
||||
last = file;
|
||||
@@ -1380,10 +1379,8 @@ void ClearCasePluginPrivate::startCheckIn(const FilePath &workingDir, const QStr
|
||||
setSubmitEditor(editor);
|
||||
editor->setStatusList(files);
|
||||
|
||||
if (m_viewData.isUcm && (files.size() == 1)) {
|
||||
QString activity = ccGetFileActivity(workingDir, files.first());
|
||||
editor->submitEditorWidget()->setActivity(activity);
|
||||
}
|
||||
if (m_viewData.isUcm && (files.size() == 1))
|
||||
editor->submitEditorWidget()->setActivity(ccGetFileActivity(workingDir, files.first()));
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::historyCurrentFile()
|
||||
@@ -1516,7 +1513,7 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const FilePath &workingDir, const
|
||||
if (lineNumber <= 0)
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(source);
|
||||
|
||||
QString headerSep(QLatin1String("-------------------------------------------------"));
|
||||
const QString headerSep(QLatin1String("-------------------------------------------------"));
|
||||
int pos = qMax(0, result.cleanedStdOut().indexOf(headerSep));
|
||||
// there are 2 identical headerSep lines - skip them
|
||||
int dataStart = result.cleanedStdOut().indexOf(QLatin1Char('\n'), pos) + 1;
|
||||
@@ -1549,13 +1546,12 @@ void ClearCasePluginPrivate::vcsDescribe(const FilePath &source, const QString &
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << source << topLevel << changeNr;
|
||||
QString description;
|
||||
QString relPath = QDir::toNativeSeparators(QDir(topLevel.toString()).relativeFilePath(source.toString()));
|
||||
QString id = QString::fromLatin1("%1@@%2").arg(relPath).arg(changeNr);
|
||||
const QString relPath = QDir::toNativeSeparators(QDir(topLevel.toString())
|
||||
.relativeFilePath(source.toString()));
|
||||
const QString id = QString::fromLatin1("%1@@%2").arg(relPath).arg(changeNr);
|
||||
|
||||
QStringList args(QLatin1String("describe"));
|
||||
args.push_back(id);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source.toString());
|
||||
const CommandResult result = runCleartool(topLevel, args, RunFlags::None, codec);
|
||||
const CommandResult result = runCleartool(topLevel, {"describe", id}, RunFlags::None, codec);
|
||||
description = result.cleanedStdOut();
|
||||
if (m_settings.extDiffAvailable)
|
||||
description += diffExternal(id);
|
||||
@@ -1655,9 +1651,9 @@ bool ClearCasePluginPrivate::vcsOpen(const FilePath &workingDir, const QString &
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDir << fileName;
|
||||
|
||||
QFileInfo fi(workingDir.toString(), fileName);
|
||||
FilePath topLevel = currentState().topLevel();
|
||||
QString absPath = fi.absoluteFilePath();
|
||||
const QFileInfo fi(workingDir.toString(), fileName);
|
||||
const FilePath topLevel = currentState().topLevel();
|
||||
const QString absPath = fi.absoluteFilePath();
|
||||
|
||||
if (!m_settings.disableIndexer &&
|
||||
(fi.isWritable() || vcsStatus(absPath).status == FileStatus::Unknown))
|
||||
@@ -1809,9 +1805,9 @@ bool ClearCasePluginPrivate::vcsCheckIn(const FilePath &messageFile, const QStri
|
||||
bool anySucceeded = false;
|
||||
int offset = match.capturedStart();
|
||||
while (match.hasMatch()) {
|
||||
QString file = match.captured(1);
|
||||
QFileInfo fi(m_checkInView.toString(), file);
|
||||
QString absPath = fi.absoluteFilePath();
|
||||
const QString file = match.captured(1);
|
||||
const QFileInfo fi(m_checkInView.toString(), file);
|
||||
const QString absPath = fi.absoluteFilePath();
|
||||
|
||||
if (!m_settings.disableIndexer)
|
||||
setStatus(QDir::fromNativeSeparators(absPath), FileStatus::CheckedIn);
|
||||
@@ -1856,11 +1852,12 @@ bool ClearCasePluginPrivate::ccFileOp(const FilePath &workingDir, const QString
|
||||
if (!fileOpDlg.exec())
|
||||
return false;
|
||||
|
||||
QString comment = commentEdit->toPlainText();
|
||||
const QString comment = commentEdit->toPlainText();
|
||||
if (m_viewData.isUcm && actSelector->changed())
|
||||
vcsSetActivity(workingDir, fileOpDlg.windowTitle(), actSelector->activity());
|
||||
|
||||
QString dirName = QDir::toNativeSeparators(QFileInfo(workingDir.toString(), fileName).absolutePath());
|
||||
const QString dirName = QDir::toNativeSeparators(QFileInfo(workingDir.toString(),
|
||||
fileName).absolutePath());
|
||||
QStringList commentArg;
|
||||
if (comment.isEmpty())
|
||||
commentArg << QLatin1String("-nc");
|
||||
@@ -1909,7 +1906,7 @@ static QString baseName(const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsAdd(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
return ccFileOp(workingDir, Tr::tr("ClearCase Add File %1").arg(baseName(fileName)),
|
||||
QStringList({"mkelem", "-ci"}), fileName);
|
||||
{"mkelem", "-ci"}, fileName);
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsDelete(const FilePath &workingDir, const QString &fileName)
|
||||
@@ -1920,14 +1917,13 @@ bool ClearCasePluginPrivate::vcsDelete(const FilePath &workingDir, const QString
|
||||
return true;
|
||||
|
||||
return ccFileOp(workingDir, Tr::tr("ClearCase Remove File %1").arg(baseName(fileName)),
|
||||
QStringList({"rmname", "-force"}), fileName);
|
||||
{"rmname", "-force"}, fileName);
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsMove(const FilePath &workingDir, const QString &from, const QString &to)
|
||||
{
|
||||
return ccFileOp(workingDir, Tr::tr("ClearCase Rename File %1 -> %2")
|
||||
.arg(baseName(from)).arg(baseName(to)),
|
||||
QStringList("move"), from, to);
|
||||
.arg(baseName(from),baseName(to)), {"move"}, from, to);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -1937,9 +1933,9 @@ bool ClearCasePluginPrivate::managesDirectory(const FilePath &directory, FilePat
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
// If running with tests and fake ClearTool is enabled, then pretend we manage every directory
|
||||
QString topLevelFound = m_fakeClearTool ? directory.toString() : findTopLevel(directory);
|
||||
const QString topLevelFound = m_fakeClearTool ? directory.toString() : findTopLevel(directory);
|
||||
#else
|
||||
QString topLevelFound = findTopLevel(directory);
|
||||
const QString topLevelFound = findTopLevel(directory);
|
||||
#endif
|
||||
|
||||
if (topLevel)
|
||||
@@ -1964,10 +1960,10 @@ QList<QStringPair> ClearCasePluginPrivate::ccGetActivities() const
|
||||
{"lsactivity", "-fmt", "%n\\t%[headline]p\\n"}).cleanedStdOut();
|
||||
const QStringList acts = response.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
|
||||
for (const QString &activity : acts) {
|
||||
QStringList act = activity.split(QLatin1Char('\t'));
|
||||
const QStringList act = activity.split(QLatin1Char('\t'));
|
||||
if (act.size() >= 2)
|
||||
{
|
||||
QString actName = act.at(0);
|
||||
const QString actName = act.at(0);
|
||||
// include only latest deliver/rebase activities. Activities are sorted
|
||||
// by creation time
|
||||
if (actName.startsWith(QLatin1String("rebase.")))
|
||||
@@ -2023,8 +2019,8 @@ bool ClearCasePluginPrivate::newActivity()
|
||||
QStringList args;
|
||||
args << QLatin1String("mkactivity") << QLatin1String("-f");
|
||||
if (!m_settings.autoAssignActivityName) {
|
||||
QString headline = QInputDialog::getText(ICore::dialogParent(), Tr::tr("Activity Headline"),
|
||||
Tr::tr("Enter activity headline"));
|
||||
const QString headline = QInputDialog::getText(ICore::dialogParent(),
|
||||
Tr::tr("Activity Headline"), Tr::tr("Enter activity headline"));
|
||||
if (headline.isEmpty())
|
||||
return false;
|
||||
args << QLatin1String("-headline") << headline;
|
||||
@@ -2049,7 +2045,7 @@ bool ClearCasePluginPrivate::ccCheckUcm(const QString &viewname, const FilePath
|
||||
|
||||
bool ClearCasePluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QString absFile = QFileInfo(QDir(workingDirectory.toString()), fileName).absoluteFilePath();
|
||||
const QString absFile = QFileInfo(QDir(workingDirectory.toString()), fileName).absoluteFilePath();
|
||||
const FileStatus::Status status = getFileStatus(absFile);
|
||||
return status != FileStatus::NotManaged && status != FileStatus::Derived;
|
||||
}
|
||||
@@ -2099,8 +2095,8 @@ void ClearCasePluginPrivate::projectChanged(Project *project)
|
||||
m_intStream.clear();
|
||||
ProgressManager::cancelTasks(ClearCase::Constants::TASK_INDEX);
|
||||
if (project) {
|
||||
FilePath projDir = project->projectDirectory();
|
||||
QString topLevel = findTopLevel(projDir);
|
||||
const FilePath projDir = project->projectDirectory();
|
||||
const QString topLevel = findTopLevel(projDir);
|
||||
m_topLevel = FilePath::fromString(topLevel);
|
||||
if (topLevel.isEmpty())
|
||||
return;
|
||||
@@ -2148,7 +2144,7 @@ QString ClearCasePluginPrivate::getFile(const QString &nativeFile, const QString
|
||||
tempDir.mkdir(QLatin1String("ccdiff"));
|
||||
tempDir.cd(QLatin1String("ccdiff"));
|
||||
int atatpos = nativeFile.indexOf(QLatin1String("@@"));
|
||||
QString file = QDir::fromNativeSeparators(nativeFile.left(atatpos));
|
||||
const QString file = QDir::fromNativeSeparators(nativeFile.left(atatpos));
|
||||
if (prefix.isEmpty()) {
|
||||
tempFile = tempDir.absoluteFilePath(QString::number(QUuid::createUuid().data1, 16));
|
||||
} else {
|
||||
@@ -2180,7 +2176,7 @@ QString ClearCasePluginPrivate::diffExternal(QString file1, QString file2, bool
|
||||
|
||||
// if file2 is empty, we should compare to predecessor
|
||||
if (file2.isEmpty()) {
|
||||
QString predVer = ccGetPredecessor(file1);
|
||||
const QString predVer = ccGetPredecessor(file1);
|
||||
return (predVer.isEmpty() ? QString() : diffExternal(predVer, file1, keep));
|
||||
}
|
||||
|
||||
@@ -2219,9 +2215,8 @@ QString ClearCasePluginPrivate::diffExternal(QString file1, QString file2, bool
|
||||
}
|
||||
if (diffResponse.isEmpty())
|
||||
return QLatin1String("Files are identical");
|
||||
QString header = QString::fromLatin1("diff %1 old/%2 new/%2\n")
|
||||
.arg(m_settings.diffArgs)
|
||||
.arg(QDir::fromNativeSeparators(file2.left(file2.indexOf(QLatin1String("@@")))));
|
||||
const QString header = QString::fromLatin1("diff %1 old/%2 new/%2\n").arg(m_settings.diffArgs,
|
||||
QDir::fromNativeSeparators(file2.left(file2.indexOf(QLatin1String("@@")))));
|
||||
return header + diffResponse;
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,8 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
|
||||
autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool();
|
||||
noComment = settings->value(QLatin1String(noCommentKeyC), false).toBool();
|
||||
keepFileUndoCheckout = settings->value(QLatin1String(keepFileUndoCheckoutKeyC), true).toBool();
|
||||
QString sDiffType = settings->value(QLatin1String(diffTypeKeyC), QLatin1String("Graphical")).toString();
|
||||
const QString sDiffType = settings->value(QLatin1String(diffTypeKeyC),
|
||||
QLatin1String("Graphical")).toString();
|
||||
switch (sDiffType[0].toUpper().toLatin1()) {
|
||||
case 'G': diffType = GraphicalDiff; break;
|
||||
case 'E': diffType = ExternalDiff; break;
|
||||
|
@@ -127,16 +127,16 @@ void ClearCaseSync::updateTotalFilesCount(const QString &view, ClearCaseSettings
|
||||
void ClearCaseSync::updateStatusForNotManagedFiles(const QStringList &files)
|
||||
{
|
||||
for (const QString &file : files) {
|
||||
QString absFile = QFileInfo(file).absoluteFilePath();
|
||||
if (!m_statusMap->contains(absFile))
|
||||
ClearCasePlugin::setStatus(absFile, FileStatus::NotManaged, false);
|
||||
const QString absFile = QFileInfo(file).absoluteFilePath();
|
||||
if (!m_statusMap->contains(absFile))
|
||||
ClearCasePlugin::setStatus(absFile, FileStatus::NotManaged, false);
|
||||
}
|
||||
}
|
||||
|
||||
void ClearCaseSync::syncSnapshotView(QFutureInterface<void> &future, QStringList &files,
|
||||
const ClearCaseSettings &settings)
|
||||
{
|
||||
QString view = ClearCasePlugin::viewData().name;
|
||||
const QString view = ClearCasePlugin::viewData().name;
|
||||
|
||||
int totalFileCount = files.size();
|
||||
const bool hot = (totalFileCount < 10);
|
||||
@@ -184,7 +184,7 @@ void ClearCaseSync::syncSnapshotView(QFutureInterface<void> &future, QStringList
|
||||
|
||||
void ClearCaseSync::processCleartoolLscheckoutLine(const QString &buffer)
|
||||
{
|
||||
QString absFile = buffer.trimmed();
|
||||
const QString absFile = buffer.trimmed();
|
||||
ClearCasePlugin::setStatus(absFile, FileStatus::CheckedOut, true);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ void ClearCaseSync::run(QFutureInterface<void> &future, QStringList &files)
|
||||
if (ClearCasePlugin::viewData().isUcm)
|
||||
ClearCasePlugin::refreshActivities();
|
||||
|
||||
QString view = ClearCasePlugin::viewData().name;
|
||||
const QString view = ClearCasePlugin::viewData().name;
|
||||
if (view.isEmpty())
|
||||
emit updateStreamAndView();
|
||||
|
||||
@@ -294,7 +294,7 @@ void ClearCaseSync::verifyFileCheckedOutDynamicView()
|
||||
{
|
||||
QCOMPARE(m_statusMap->count(), 0);
|
||||
|
||||
QString fileName("/hello.C");
|
||||
const QString fileName("/hello.C");
|
||||
processCleartoolLscheckoutLine(fileName);
|
||||
|
||||
QCOMPARE(m_statusMap->count(), 1);
|
||||
@@ -309,7 +309,7 @@ void ClearCaseSync::verifyFileCheckedInDynamicView()
|
||||
{
|
||||
QCOMPARE(m_statusMap->count(), 0);
|
||||
|
||||
QString fileName("/hello.C");
|
||||
const QString fileName("/hello.C");
|
||||
|
||||
// checked in files are not kept in the index
|
||||
QCOMPARE(m_statusMap->count(), 0);
|
||||
|
@@ -149,9 +149,8 @@ public:
|
||||
|
||||
QStringList arguments() const override
|
||||
{
|
||||
QStringList args = m_settings.diffOptions.value().split(' ', Qt::SkipEmptyParts);
|
||||
args += VcsBaseEditorConfig::arguments();
|
||||
return args;
|
||||
return m_settings.diffOptions.value().split(' ', Qt::SkipEmptyParts)
|
||||
+ VcsBaseEditorConfig::arguments();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -441,7 +441,7 @@ bool BranchModel::refresh(const FilePath &workingDirectory, QString *errorMessag
|
||||
|
||||
void BranchModel::setCurrentBranch()
|
||||
{
|
||||
QString currentBranch = d->client->synchronousCurrentLocalBranch(d->workingDirectory);
|
||||
const QString currentBranch = d->client->synchronousCurrentLocalBranch(d->workingDirectory);
|
||||
if (currentBranch.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -563,7 +563,7 @@ bool BranchModel::isTag(const QModelIndex &idx) const
|
||||
|
||||
void BranchModel::removeBranch(const QModelIndex &idx)
|
||||
{
|
||||
QString branch = fullName(idx);
|
||||
const QString branch = fullName(idx);
|
||||
if (branch.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -579,7 +579,7 @@ void BranchModel::removeBranch(const QModelIndex &idx)
|
||||
|
||||
void BranchModel::removeTag(const QModelIndex &idx)
|
||||
{
|
||||
QString tag = fullName(idx);
|
||||
const QString tag = fullName(idx);
|
||||
if (tag.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -608,7 +608,7 @@ void BranchModel::checkoutBranch(const QModelIndex &idx, const QObject *context,
|
||||
|
||||
bool BranchModel::branchIsMerged(const QModelIndex &idx)
|
||||
{
|
||||
QString branch = fullName(idx);
|
||||
const QString branch = fullName(idx);
|
||||
if (branch.isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -622,9 +622,9 @@ bool BranchModel::branchIsMerged(const QModelIndex &idx)
|
||||
|
||||
const QStringList lines = output.split('\n', Qt::SkipEmptyParts);
|
||||
for (const QString &l : lines) {
|
||||
QString currentBranch = l.mid(2); // remove first letters (those are either
|
||||
// " " or "* " depending on whether it is
|
||||
// the currently checked out branch or not)
|
||||
const QString currentBranch = l.mid(2); // remove first letters (those are either
|
||||
// " " or "* " depending on whether it is
|
||||
// the currently checked out branch or not)
|
||||
if (currentBranch != branch)
|
||||
return true;
|
||||
}
|
||||
@@ -745,7 +745,7 @@ void BranchModel::Private::parseOutputLine(const QString &line, bool force)
|
||||
return;
|
||||
|
||||
// objectname, refname, upstream:short, *objectname, committerdate:raw, *committerdate:raw
|
||||
QStringList lineParts = line.split('\t');
|
||||
const QStringList lineParts = line.split('\t');
|
||||
const QString shaDeref = lineParts.at(3);
|
||||
const QString sha = shaDeref.isEmpty() ? lineParts.at(0) : shaDeref;
|
||||
const QString fullName = lineParts.at(1);
|
||||
@@ -907,9 +907,7 @@ QString BranchModel::toolTip(const QString &sha) const
|
||||
// Show the sha description excluding diff as toolTip
|
||||
QString output;
|
||||
QString errorMessage;
|
||||
QStringList arguments("-n1");
|
||||
arguments << sha;
|
||||
if (!d->client->synchronousLog(d->workingDirectory, arguments, &output, &errorMessage,
|
||||
if (!d->client->synchronousLog(d->workingDirectory, {"-n1", sha}, &output, &errorMessage,
|
||||
RunFlags::SuppressCommandLogging)) {
|
||||
return errorMessage;
|
||||
}
|
||||
|
@@ -448,7 +448,7 @@ bool BranchView::remove()
|
||||
const QModelIndex selected = selectedIndex();
|
||||
QTC_CHECK(selected != m_model->currentBranch());
|
||||
|
||||
QString branchName = m_model->fullName(selected);
|
||||
const QString branchName = m_model->fullName(selected);
|
||||
if (branchName.isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -480,7 +480,7 @@ bool BranchView::rename()
|
||||
const bool isTag = m_model->isTag(selected);
|
||||
QTC_CHECK(m_model->isLocal(selected) || isTag);
|
||||
|
||||
QString oldName = m_model->fullName(selected);
|
||||
const QString oldName = m_model->fullName(selected);
|
||||
QStringList localNames;
|
||||
if (!isTag)
|
||||
localNames = m_model->localBranchNames();
|
||||
|
@@ -782,9 +782,8 @@ static bool parseOutput(const QSharedPointer<GerritParameters> ¶meters,
|
||||
QJsonParseError error;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(adaptedOutput, &error);
|
||||
if (doc.isNull()) {
|
||||
QString errorMessage = Git::Tr::tr("Parse error: \"%1\" -> %2")
|
||||
.arg(QString::fromUtf8(output))
|
||||
.arg(error.errorString());
|
||||
const QString errorMessage = Git::Tr::tr("Parse error: \"%1\" -> %2")
|
||||
.arg(QString::fromUtf8(output), error.errorString());
|
||||
qWarning() << errorMessage;
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
res = false;
|
||||
@@ -919,9 +918,8 @@ void GerritModel::resultRetrieved(const QByteArray &output)
|
||||
// too-deeply nested items.
|
||||
for (; changeFromItem(parent)->depth >= 1; parent = parent->parent()) {}
|
||||
parent->appendRow(newRow);
|
||||
QString parentFilterString = parent->data(FilterRole).toString();
|
||||
parentFilterString += ' ';
|
||||
parentFilterString += newRow.first()->data(FilterRole).toString();
|
||||
const QString parentFilterString = parent->data(FilterRole).toString() + ' '
|
||||
+ newRow.first()->data(FilterRole).toString();
|
||||
parent->setData(QVariant(parentFilterString), FilterRole);
|
||||
} else {
|
||||
appendRow(newRow);
|
||||
|
@@ -86,7 +86,7 @@ void GerritPushDialog::initRemoteBranches()
|
||||
QString output;
|
||||
const QString head = "/HEAD";
|
||||
|
||||
QString remotesPrefix("refs/remotes/");
|
||||
const QString remotesPrefix("refs/remotes/");
|
||||
if (!GitClient::instance()->synchronousForEachRefCmd(
|
||||
m_workingDir, {"--format=%(refname)\t%(committerdate:raw)", remotesPrefix}, &output)) {
|
||||
return;
|
||||
@@ -94,7 +94,7 @@ void GerritPushDialog::initRemoteBranches()
|
||||
|
||||
const QStringList refs = output.split("\n");
|
||||
for (const QString &reference : refs) {
|
||||
QStringList entries = reference.split('\t');
|
||||
const QStringList entries = reference.split('\t');
|
||||
if (entries.count() < 2 || entries.first().endsWith(head))
|
||||
continue;
|
||||
const QString ref = entries.at(0).mid(remotesPrefix.size());
|
||||
@@ -194,16 +194,11 @@ QString GerritPushDialog::selectedCommit() const
|
||||
|
||||
QString GerritPushDialog::calculateChangeRange(const QString &branch)
|
||||
{
|
||||
QString remote = selectedRemoteName();
|
||||
remote += '/';
|
||||
remote += selectedRemoteBranchName();
|
||||
|
||||
const QString remote = selectedRemoteName() + '/' + selectedRemoteBranchName();
|
||||
QString number;
|
||||
QString error;
|
||||
|
||||
GitClient::instance()->synchronousRevListCmd(
|
||||
m_workingDir, { remote + ".." + branch, "--count" }, &number, &error);
|
||||
|
||||
number.chop(1);
|
||||
return number;
|
||||
}
|
||||
@@ -376,7 +371,7 @@ void GerritPushDialog::updateCommits(int index)
|
||||
{
|
||||
const QString branch = m_localBranchComboBox->itemText(index);
|
||||
m_hasLocalCommits = m_commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
|
||||
QString topic = GitClient::instance()->readConfigValue(
|
||||
const QString topic = GitClient::instance()->readConfigValue(
|
||||
m_workingDir, QString("branch.%1.topic").arg(branch));
|
||||
if (!topic.isEmpty())
|
||||
m_topicLineEdit->setText(topic);
|
||||
|
@@ -1194,7 +1194,7 @@ void GitClient::archive(const FilePath &workingDirectory, QString commit)
|
||||
FilePath repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||
if (repoDirectory.isEmpty())
|
||||
repoDirectory = workingDirectory;
|
||||
QString repoName = repoDirectory.fileName();
|
||||
const QString repoName = repoDirectory.fileName();
|
||||
|
||||
QHash<QString, QString> filters;
|
||||
QString selectedFilter;
|
||||
@@ -1222,7 +1222,7 @@ void GitClient::archive(const FilePath &workingDirectory, QString commit)
|
||||
&selectedFilter);
|
||||
if (archiveName.isEmpty())
|
||||
return;
|
||||
QString extension = filters.value(selectedFilter);
|
||||
const QString extension = filters.value(selectedFilter);
|
||||
QFileInfo archive(archiveName.toString());
|
||||
if (extension != "." + archive.completeSuffix()) {
|
||||
archive = QFileInfo(archive.filePath() + extension);
|
||||
@@ -1691,7 +1691,7 @@ bool GitClient::synchronousHeadRefs(const FilePath &workingDirectory, QStringLis
|
||||
QString GitClient::synchronousTopic(const FilePath &workingDirectory) const
|
||||
{
|
||||
// First try to find branch
|
||||
QString branch = synchronousCurrentLocalBranch(workingDirectory);
|
||||
const QString branch = synchronousCurrentLocalBranch(workingDirectory);
|
||||
if (!branch.isEmpty())
|
||||
return branch;
|
||||
|
||||
@@ -2000,10 +2000,10 @@ SubmoduleDataMap GitClient::submoduleList(const FilePath &workingDirectory) cons
|
||||
if (!configLine.startsWith(submoduleLineStart))
|
||||
continue;
|
||||
|
||||
int nameStart = submoduleLineStart.size();
|
||||
int nameEnd = configLine.indexOf('.', nameStart);
|
||||
const int nameStart = submoduleLineStart.size();
|
||||
const int nameEnd = configLine.indexOf('.', nameStart);
|
||||
|
||||
QString submoduleName = configLine.mid(nameStart, nameEnd - nameStart);
|
||||
const QString submoduleName = configLine.mid(nameStart, nameEnd - nameStart);
|
||||
|
||||
SubmoduleData submoduleData;
|
||||
if (result.contains(submoduleName))
|
||||
@@ -2032,7 +2032,7 @@ SubmoduleDataMap GitClient::submoduleList(const FilePath &workingDirectory) cons
|
||||
} else {
|
||||
SubmoduleData &submoduleRef = result[submoduleName];
|
||||
submoduleRef.dir = path;
|
||||
QString ignore = gitmodulesFile.value("ignore").toString();
|
||||
const QString ignore = gitmodulesFile.value("ignore").toString();
|
||||
if (!ignore.isEmpty() && submoduleRef.ignore.isEmpty())
|
||||
submoduleRef.ignore = ignore;
|
||||
}
|
||||
@@ -2130,7 +2130,7 @@ bool GitClient::synchronousApplyPatch(const FilePath &workingDirectory,
|
||||
Environment GitClient::processEnvironment() const
|
||||
{
|
||||
Environment environment = VcsBaseClientImpl::processEnvironment();
|
||||
QString gitPath = settings().path.value();
|
||||
const QString gitPath = settings().path.value();
|
||||
environment.prependOrSetPath(FilePath::fromUserInput(gitPath));
|
||||
if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) {
|
||||
QString homePath;
|
||||
@@ -2594,7 +2594,7 @@ FilePath GitClient::vcsBinary() const
|
||||
|
||||
QTextCodec *GitClient::encoding(const FilePath &workingDirectory, const QString &configVar) const
|
||||
{
|
||||
QString codecName = readConfigValue(workingDirectory, configVar).trimmed();
|
||||
const QString codecName = readConfigValue(workingDirectory, configVar).trimmed();
|
||||
// Set default commit encoding to 'UTF-8', when it's not set,
|
||||
// to solve displaying error of commit log with non-latin characters.
|
||||
if (codecName.isEmpty())
|
||||
@@ -2671,7 +2671,7 @@ bool GitClient::getCommitData(const FilePath &workingDirectory,
|
||||
|
||||
commitData.panelInfo.repository = repoDirectory;
|
||||
|
||||
QString gitDir = findGitDirForRepository(repoDirectory);
|
||||
const QString gitDir = findGitDirForRepository(repoDirectory);
|
||||
if (gitDir.isEmpty()) {
|
||||
*errorMessage = Tr::tr("The repository \"%1\" is not initialized.").arg(repoDirectory.toString());
|
||||
return false;
|
||||
@@ -2818,7 +2818,7 @@ bool GitClient::addAndCommit(const FilePath &repositoryDirectory,
|
||||
|
||||
for (int i = 0; i < model->rowCount(); ++i) {
|
||||
const FileStates state = static_cast<FileStates>(model->extraData(i).toInt());
|
||||
QString file = model->file(i);
|
||||
const QString file = model->file(i);
|
||||
const bool checked = model->checked(i);
|
||||
|
||||
if (checked)
|
||||
@@ -3004,7 +3004,7 @@ void GitClient::revertFiles(const QStringList &files, bool revertStaging)
|
||||
|
||||
void GitClient::fetch(const FilePath &workingDirectory, const QString &remote)
|
||||
{
|
||||
QStringList const arguments = {"fetch", (remote.isEmpty() ? "--all" : remote)};
|
||||
const QStringList arguments{"fetch", (remote.isEmpty() ? "--all" : remote)};
|
||||
const auto commandHandler = [workingDirectory](const CommandResult &result) {
|
||||
if (result.result() == ProcessResult::FinishedWithSuccess)
|
||||
GitPlugin::updateBranches(workingDirectory);
|
||||
@@ -3050,7 +3050,7 @@ void GitClient::synchronousAbortCommand(const FilePath &workingDir, const QStrin
|
||||
if (abortCommand.isEmpty()) {
|
||||
// no abort command - checkout index to clean working copy.
|
||||
synchronousCheckoutFiles(VcsManager::findTopLevelForDirectory(workingDir),
|
||||
QStringList(), QString(), nullptr, false);
|
||||
{}, {}, nullptr, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3064,15 +3064,15 @@ QString GitClient::synchronousTrackingBranch(const FilePath &workingDirectory, c
|
||||
QString remote;
|
||||
QString localBranch = branch.isEmpty() ? synchronousCurrentLocalBranch(workingDirectory) : branch;
|
||||
if (localBranch.isEmpty())
|
||||
return QString();
|
||||
return {};
|
||||
localBranch.prepend("branch.");
|
||||
remote = readConfigValue(workingDirectory, localBranch + ".remote");
|
||||
if (remote.isEmpty())
|
||||
return QString();
|
||||
return {};
|
||||
const QString rBranch = readConfigValue(workingDirectory, localBranch + ".merge")
|
||||
.replace("refs/heads/", QString());
|
||||
if (rBranch.isEmpty())
|
||||
return QString();
|
||||
return {};
|
||||
return remote + '/' + rBranch;
|
||||
}
|
||||
|
||||
@@ -3252,7 +3252,7 @@ void GitClient::push(const FilePath &workingDirectory, const QStringList &pushAr
|
||||
bool GitClient::synchronousMerge(const FilePath &workingDirectory, const QString &branch,
|
||||
bool allowFastForward)
|
||||
{
|
||||
QString command = "merge";
|
||||
const QString command = "merge";
|
||||
QStringList arguments = {command};
|
||||
if (!allowFastForward)
|
||||
arguments << "--no-ff";
|
||||
|
@@ -1634,8 +1634,8 @@ bool GitPluginPrivate::activateCommit()
|
||||
return true;
|
||||
|
||||
auto model = qobject_cast<SubmitFileModel *>(editor->fileModel());
|
||||
CommitType commitType = editor->commitType();
|
||||
QString amendSHA1 = editor->amendSHA1();
|
||||
const CommitType commitType = editor->commitType();
|
||||
const QString amendSHA1 = editor->amendSHA1();
|
||||
if (model->hasCheckedFiles() || !amendSHA1.isEmpty()) {
|
||||
// get message & commit
|
||||
if (!DocumentManager::saveDocument(editorDocument))
|
||||
|
@@ -245,7 +245,7 @@ GitSubmitEditorPanelData GitSubmitEditor::panelData() const
|
||||
|
||||
QString GitSubmitEditor::amendSHA1() const
|
||||
{
|
||||
QString commit = submitEditorWidget()->amendSHA1();
|
||||
const QString commit = submitEditorWidget()->amendSHA1();
|
||||
return commit.isEmpty() ? m_amendSHA1 : commit;
|
||||
}
|
||||
|
||||
|
@@ -125,7 +125,7 @@ void LogChangeWidget::setItemDelegate(QAbstractItemDelegate *delegate)
|
||||
void LogChangeWidget::emitCommitActivated(const QModelIndex &index)
|
||||
{
|
||||
if (index.isValid()) {
|
||||
QString commit = index.sibling(index.row(), Sha1Column).data().toString();
|
||||
const QString commit = index.sibling(index.row(), Sha1Column).data().toString();
|
||||
if (!commit.isEmpty())
|
||||
emit commitActivated(commit);
|
||||
}
|
||||
|
@@ -58,11 +58,9 @@ void MercurialDiffEditorController::runCommand(const QList<QStringList> &args, Q
|
||||
|
||||
QStringList MercurialDiffEditorController::addConfigurationArguments(const QStringList &args) const
|
||||
{
|
||||
QStringList configArgs{ "-g", "-p" };
|
||||
configArgs << "-U" << QString::number(contextLineCount());
|
||||
if (ignoreWhitespace()) {
|
||||
QStringList configArgs{"-g", "-p", "-U", QString::number(contextLineCount())};
|
||||
if (ignoreWhitespace())
|
||||
configArgs << "-w" << "-b" << "-B" << "-Z";
|
||||
}
|
||||
return args + configArgs;
|
||||
}
|
||||
|
||||
@@ -103,16 +101,13 @@ bool MercurialClient::synchronousClone(const FilePath &workingDirectory,
|
||||
|
||||
if (workingDirectory.exists()) {
|
||||
// Let's make first init
|
||||
QStringList arguments(QLatin1String("init"));
|
||||
if (vcsSynchronousExec(workingDirectory, arguments).result()
|
||||
if (vcsSynchronousExec(workingDirectory, QStringList{"init"}).result()
|
||||
!= ProcessResult::FinishedWithSuccess) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Then pull remote repository
|
||||
arguments.clear();
|
||||
arguments << QLatin1String("pull") << dstLocation;
|
||||
if (vcsSynchronousExec(workingDirectory, arguments, flags).result()
|
||||
if (vcsSynchronousExec(workingDirectory, {"pull", dstLocation}, flags).result()
|
||||
!= ProcessResult::FinishedWithSuccess) {
|
||||
return false;
|
||||
}
|
||||
@@ -127,13 +122,10 @@ bool MercurialClient::synchronousClone(const FilePath &workingDirectory,
|
||||
}
|
||||
|
||||
// And last update repository
|
||||
arguments.clear();
|
||||
arguments << QLatin1String("update");
|
||||
return vcsSynchronousExec(workingDirectory, arguments, flags).result()
|
||||
return vcsSynchronousExec(workingDirectory, QStringList{"update"}, flags).result()
|
||||
== ProcessResult::FinishedWithSuccess;
|
||||
} else {
|
||||
QStringList arguments(QLatin1String("clone"));
|
||||
arguments << dstLocation << workingDirectory.parentDir().toString();
|
||||
const QStringList arguments{"clone", dstLocation, workingDirectory.parentDir().toString()};
|
||||
return vcsSynchronousExec(workingDirectory.parentDir(), arguments, flags).result()
|
||||
== ProcessResult::FinishedWithSuccess;
|
||||
}
|
||||
@@ -198,7 +190,7 @@ user: ...
|
||||
msgParseParentsOutputFailed(result.cleanedStdOut())));
|
||||
return {};
|
||||
}
|
||||
QStringList changeSets = lines.front().simplified().split(QLatin1Char(' '));
|
||||
const QStringList changeSets = lines.front().simplified().split(QLatin1Char(' '));
|
||||
if (changeSets.size() < 2) {
|
||||
VcsOutputWindow::appendSilently(msgParentRevisionFailed(workingDirectory, revision,
|
||||
msgParseParentsOutputFailed(result.cleanedStdOut())));
|
||||
@@ -206,8 +198,8 @@ user: ...
|
||||
}
|
||||
// Remove revision numbers
|
||||
const QChar colon = QLatin1Char(':');
|
||||
const QStringList::iterator end = changeSets.end();
|
||||
QStringList::iterator it = changeSets.begin();
|
||||
const auto end = changeSets.cend();
|
||||
auto it = changeSets.cbegin();
|
||||
for (++it; it != end; ++it) {
|
||||
const int colonIndex = it->indexOf(colon);
|
||||
if (colonIndex != -1)
|
||||
|
@@ -365,8 +365,7 @@ void MercurialPluginPrivate::logCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client.log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
||||
QStringList(), true);
|
||||
m_client.log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), {}, true);
|
||||
}
|
||||
|
||||
void MercurialPluginPrivate::revertCurrentFile()
|
||||
|
@@ -89,13 +89,13 @@ QString SrcDestDialog::getRepositoryString() const
|
||||
if (authDialog->exec()== 0)
|
||||
return repoUrl.toString();
|
||||
|
||||
QString user = authDialog->getUserName();
|
||||
const QString user = authDialog->getUserName();
|
||||
if (user.isEmpty())
|
||||
return repoUrl.toString();
|
||||
if (user != repoUrl.userName())
|
||||
repoUrl.setUserName(user);
|
||||
|
||||
QString pass = authDialog->getPassword();
|
||||
const QString pass = authDialog->getPassword();
|
||||
if (!pass.isEmpty() && pass != repoUrl.password())
|
||||
repoUrl.setPassword(pass);
|
||||
}
|
||||
|
@@ -118,22 +118,22 @@ void PerforceChecker::slotDone()
|
||||
static inline QString findTerm(const QString& in, const QLatin1String& term)
|
||||
{
|
||||
QRegularExpression regExp(QString("(\\n|\\r\\n|\\r)%1\\s*(.*)(\\n|\\r\\n|\\r)").arg(term));
|
||||
QTC_ASSERT(regExp.isValid(), return QString());
|
||||
QTC_ASSERT(regExp.isValid(), return {});
|
||||
QRegularExpressionMatch match = regExp.match(in);
|
||||
if (match.hasMatch())
|
||||
return match.captured(2).trimmed();
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
// Parse p4 client output for the top level
|
||||
static inline QString clientRootFromOutput(const QString &in)
|
||||
{
|
||||
QString root = findTerm(in, QLatin1String("Root:"));
|
||||
const QString root = findTerm(in, QLatin1String("Root:"));
|
||||
if (!root.isNull()) {
|
||||
// Normalize slashes and capitalization of Windows drive letters for caching.
|
||||
return QFileInfo(root).absoluteFilePath();
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
// When p4 port and p4 user is set a preconfigured Root: is given, which doesn't relate with
|
||||
@@ -141,9 +141,8 @@ static inline QString clientRootFromOutput(const QString &in)
|
||||
// invalid case.
|
||||
static inline bool clientAndHostAreEqual(const QString &in)
|
||||
{
|
||||
QString client = findTerm(in, QLatin1String("Client:"));
|
||||
QString host = findTerm(in, QLatin1String("Host:"));
|
||||
|
||||
const QString client = findTerm(in, QLatin1String("Client:"));
|
||||
const QString host = findTerm(in, QLatin1String("Host:"));
|
||||
return client == host;
|
||||
}
|
||||
|
||||
|
@@ -589,7 +589,7 @@ void PerforcePluginPrivate::revertCurrentFile()
|
||||
args << QLatin1String("diff") << QLatin1String("-sa") << state.relativeCurrentFile();
|
||||
PerforceResponse result = runP4Cmd(state.currentFileTopLevel(), args,
|
||||
RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
{}, {}, codec);
|
||||
if (result.error)
|
||||
return;
|
||||
// "foo.cpp - file(s) not opened on this client."
|
||||
@@ -692,9 +692,8 @@ void PerforcePluginPrivate::updateCheckout(const FilePath &workingDir, const QSt
|
||||
|
||||
void PerforcePluginPrivate::printOpenedFileList()
|
||||
{
|
||||
const PerforceResponse perforceResponse
|
||||
= runP4Cmd(m_settings.topLevel(), QStringList(QLatin1String("opened")),
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow);
|
||||
const PerforceResponse perforceResponse = runP4Cmd(m_settings.topLevel(), {"opened"},
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow);
|
||||
if (perforceResponse.error || perforceResponse.stdOut.isEmpty())
|
||||
return;
|
||||
// reformat "//depot/file.cpp#1 - description" into "file.cpp # - description"
|
||||
@@ -845,7 +844,7 @@ void PerforcePluginPrivate::annotate(const FilePath &workingDir,
|
||||
args << (fileName + QLatin1Char('@') + changeList);
|
||||
const PerforceResponse result = runP4Cmd(workingDir, args,
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
{}, {}, codec);
|
||||
if (!result.error) {
|
||||
if (lineNumber < 1)
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||
@@ -897,7 +896,7 @@ void PerforcePluginPrivate::filelog(const FilePath &workingDir, const QString &f
|
||||
args.append(fileName);
|
||||
const PerforceResponse result = runP4Cmd(workingDir, args,
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
{}, {}, codec);
|
||||
if (!result.error) {
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
IEditor *editor = showOutputInEditor(tr("p4 filelog %1").arg(id), result.stdOut,
|
||||
@@ -919,7 +918,7 @@ void PerforcePluginPrivate::changelists(const FilePath &workingDir, const QStrin
|
||||
args.append(fileName);
|
||||
const PerforceResponse result = runP4Cmd(workingDir, args,
|
||||
CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
{}, {}, codec);
|
||||
if (!result.error) {
|
||||
const QString source = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
IEditor *editor = showOutputInEditor(tr("p4 changelists %1").arg(id), result.stdOut,
|
||||
@@ -1475,8 +1474,7 @@ void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
|
||||
else
|
||||
args.append(p.files);
|
||||
const unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow|OverrideDiffEnvironment;
|
||||
const PerforceResponse result = runP4Cmd(p.workingDir, args, flags,
|
||||
extraArgs, QByteArray(), codec);
|
||||
const PerforceResponse result = runP4Cmd(p.workingDir, args, flags, extraArgs, {}, codec);
|
||||
if (result.error)
|
||||
return;
|
||||
|
||||
@@ -1509,7 +1507,7 @@ void PerforcePluginPrivate::vcsDescribe(const FilePath &source, const QString &n
|
||||
QStringList args;
|
||||
args << QLatin1String("describe") << QLatin1String("-du") << n;
|
||||
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
{}, {}, codec);
|
||||
if (!result.error)
|
||||
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source.toString(), codec);
|
||||
}
|
||||
@@ -1550,7 +1548,7 @@ bool PerforcePluginPrivate::activateCommit()
|
||||
submitArgs << QLatin1String("submit") << QLatin1String("-i");
|
||||
const PerforceResponse submitResponse = runP4Cmd(m_settings.topLevelSymLinkTarget(), submitArgs,
|
||||
LongTimeOut|RunFullySynchronous|CommandToWindow|StdErrToWindow|ErrorToWindow|ShowBusyCursor,
|
||||
QStringList(), reader.data());
|
||||
{}, reader.data());
|
||||
if (submitResponse.error) {
|
||||
VcsOutputWindow::appendError(tr("p4 submit failed: %1").arg(submitResponse.message));
|
||||
return false;
|
||||
|
@@ -46,7 +46,7 @@ QString SubversionEditorWidget::changeUnderCursor(const QTextCursor &c) const
|
||||
cursor.select(QTextCursor::LineUnderCursor);
|
||||
if (!cursor.hasSelection())
|
||||
return QString();
|
||||
QString change = cursor.selectedText();
|
||||
const QString change = cursor.selectedText();
|
||||
const int pos = c.position() - cursor.selectionStart() + 1;
|
||||
// Annotation output has number, log output has revision numbers,
|
||||
// both at the start of the line.
|
||||
|
@@ -695,16 +695,14 @@ void SubversionPluginPrivate::diffProject()
|
||||
QTC_ASSERT(state.hasProject(), return);
|
||||
const QString relativeProject = state.relativeCurrentProject();
|
||||
m_client->diff(state.currentProjectTopLevel(),
|
||||
relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject),
|
||||
QStringList());
|
||||
relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject), {});
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::diffCurrentFile()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasFile(), return);
|
||||
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
|
||||
QStringList());
|
||||
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), {});
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::startCommitCurrentFile()
|
||||
@@ -1049,8 +1047,8 @@ bool SubversionPluginPrivate::vcsMove(const FilePath &workingDir, const QString
|
||||
bool SubversionPluginPrivate::vcsCheckout(const FilePath &directory, const QByteArray &url)
|
||||
{
|
||||
QUrl tempUrl = QUrl::fromEncoded(url);
|
||||
QString username = tempUrl.userName();
|
||||
QString password = tempUrl.password();
|
||||
const QString username = tempUrl.userName();
|
||||
const QString password = tempUrl.password();
|
||||
QStringList args = QStringList(QLatin1String("checkout"));
|
||||
args << QLatin1String(Constants::NON_INTERACTIVE_OPTION) ;
|
||||
|
||||
@@ -1060,7 +1058,7 @@ bool SubversionPluginPrivate::vcsCheckout(const FilePath &directory, const QByte
|
||||
// authentication will always fail (if the username and password data are not stored locally),
|
||||
// if for example we are logging into a new host for the first time using svn. There seems to
|
||||
// be a bug in subversion, so this might get fixed in the future.
|
||||
tempUrl.setUserInfo(QString());
|
||||
tempUrl.setUserInfo({});
|
||||
args << QLatin1String("--username") << username;
|
||||
if (!password.isEmpty())
|
||||
args << QLatin1String("--password") << password;
|
||||
|
@@ -588,9 +588,9 @@ void VcsBaseClient::statusParser(const QString &text)
|
||||
{
|
||||
QList<VcsBaseClient::StatusItem> lineInfoList;
|
||||
|
||||
QStringList rawStatusList = text.split(QLatin1Char('\n'));
|
||||
const QStringList rawStatusList = text.split(QLatin1Char('\n'));
|
||||
|
||||
for (const QString &string : std::as_const(rawStatusList)) {
|
||||
for (const QString &string : rawStatusList) {
|
||||
const VcsBaseClient::StatusItem lineInfo = parseStatusLine(string);
|
||||
if (!lineInfo.flags.isEmpty() && !lineInfo.file.isEmpty())
|
||||
lineInfoList.append(lineInfo);
|
||||
|
@@ -1510,7 +1510,7 @@ QString VcsBaseEditorWidget::fileNameFromDiffSpecification(const QTextBlock &inB
|
||||
const QString line = block.text();
|
||||
const QRegularExpressionMatch match = d->m_diffFilePattern.match(line);
|
||||
if (match.hasMatch()) {
|
||||
QString cap = match.captured(1);
|
||||
const QString cap = match.captured(1);
|
||||
if (header)
|
||||
header->prepend(line + QLatin1String("\n"));
|
||||
if (fileName.isEmpty() && !cap.isEmpty())
|
||||
|
@@ -125,7 +125,7 @@ QString OutputWindowPlainTextEdit::identifierUnderCursor(const QPoint &widgetPos
|
||||
cursor.select(QTextCursor::BlockUnderCursor);
|
||||
if (!cursor.hasSelection())
|
||||
return QString();
|
||||
QString block = cursor.selectedText();
|
||||
const QString block = cursor.selectedText();
|
||||
// Determine cursor position within line and find blank-delimited word
|
||||
const int cursorPos = cursorDocumentPos - cursor.block().position();
|
||||
const int blockSize = block.size();
|
||||
|
@@ -328,7 +328,7 @@ void VcsCommandPage::delayedInitialize()
|
||||
if (!JsonWizard::boolFromVariant(job.condition, wiz->expander()))
|
||||
continue;
|
||||
|
||||
QString commandString = wiz->expander()->expand(job.job.at(0));
|
||||
const QString commandString = wiz->expander()->expand(job.job.at(0));
|
||||
if (commandString.isEmpty())
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user