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