forked from qt-creator/qt-creator
Vcs: Use FilePath in IVersionControl API
Adapt first level of users. Change-Id: Ifcd7bff45631ff3b9e26a9e3176daa6cf0cf2e56 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -149,17 +149,17 @@ public:
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
|
||||
bool managesDirectory(const QString &filename, QString *topLevel) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
bool managesDirectory(const Utils::FilePath &filePath, Utils::FilePath *topLevel) const final;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const final;
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
bool vcsAdd(const QString &filename) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &from, const QString &to) final;
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
void vcsDescribe(const QString &source, const QString &id) final { m_client.view(source, id); }
|
||||
bool vcsOpen(const Utils::FilePath &fileName) final;
|
||||
bool vcsAdd(const Utils::FilePath &filePath) final;
|
||||
bool vcsDelete(const Utils::FilePath &filePath) final;
|
||||
bool vcsMove(const Utils::FilePath &from, const Utils::FilePath &to) final;
|
||||
bool vcsCreateRepository(const Utils::FilePath &directory) final;
|
||||
void vcsAnnotate(const Utils::FilePath &file, int line) final;
|
||||
void vcsDescribe(const Utils::FilePath &source, const QString &id) final { m_client.view(source.toString(), id); }
|
||||
|
||||
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
@@ -850,18 +850,18 @@ bool BazaarPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName)
|
||||
return m_client.isVcsDirectory(fileName);
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const
|
||||
bool BazaarPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel) const
|
||||
{
|
||||
QFileInfo dir(directory);
|
||||
QFileInfo dir(directory.toString());
|
||||
const QString topLevelFound = m_client.findTopLevelForFile(dir);
|
||||
if (topLevel)
|
||||
*topLevel = topLevelFound;
|
||||
*topLevel = FilePath::fromString(topLevelFound);
|
||||
return !topLevelFound.isEmpty();
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool BazaarPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return m_client.managesFile(workingDirectory, fileName);
|
||||
return m_client.managesFile(workingDirectory.toString(), fileName);
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::isConfigured() const
|
||||
@@ -892,41 +892,41 @@ bool BazaarPluginPrivate::supportsOperation(Operation operation) const
|
||||
return supported;
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsOpen(const QString &filename)
|
||||
bool BazaarPluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
Q_UNUSED(filename)
|
||||
Q_UNUSED(filePath)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsAdd(const QString &filename)
|
||||
bool BazaarPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(filename);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousAdd(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsDelete(const QString &filename)
|
||||
bool BazaarPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(filename);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousRemove(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsMove(const QString &from, const QString &to)
|
||||
bool BazaarPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo(from);
|
||||
const QFileInfo toInfo(to);
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return m_client.synchronousMove(fromInfo.absolutePath(),
|
||||
fromInfo.absoluteFilePath(),
|
||||
toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsCreateRepository(const QString &directory)
|
||||
bool BazaarPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
{
|
||||
return m_client.synchronousCreateRepository(directory);
|
||||
return m_client.synchronousCreateRepository(directory.toString());
|
||||
}
|
||||
|
||||
void BazaarPluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void BazaarPluginPrivate::vcsAnnotate(const FilePath &file, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = file.toFileInfo();
|
||||
m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
|
@@ -183,28 +183,28 @@ public:
|
||||
QString displayName() const final;
|
||||
Utils::Id id() const final;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const FilePath &filePath) const final;
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
bool managesDirectory(const FilePath &directory, FilePath *topLevel) const final;
|
||||
bool managesFile(const FilePath &workingDirectory, const QString &fileName) const final;
|
||||
|
||||
bool isConfigured() const final;
|
||||
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
OpenSupportMode openSupportMode(const QString &fileName) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
OpenSupportMode openSupportMode(const FilePath &filePath) const final;
|
||||
bool vcsOpen(const FilePath &filePath) final;
|
||||
SettingsFlags settingsFlags() const final;
|
||||
bool vcsAdd(const QString &fileName) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &from, const QString &to) final;
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
bool vcsAdd(const FilePath &filePath) final;
|
||||
bool vcsDelete(const FilePath &filename) final;
|
||||
bool vcsMove(const FilePath &from, const FilePath &to) final;
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
void vcsDescribe(const QString &source, const QString &changeNr) final;
|
||||
void vcsAnnotate(const FilePath &file, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &changeNr) final;
|
||||
|
||||
QString vcsOpenText() const final;
|
||||
QString vcsMakeWritableText() const final;
|
||||
QString vcsTopic(const QString &directory) final;
|
||||
QString vcsTopic(const FilePath &directory) final;
|
||||
|
||||
///
|
||||
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName, bool isUcm);
|
||||
@@ -1605,36 +1605,36 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const QString &workingDir, const
|
||||
}
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
|
||||
void ClearCasePluginPrivate::vcsDescribe(const FilePath &source, const QString &changeNr)
|
||||
{
|
||||
const QFileInfo fi(source);
|
||||
QString topLevel;
|
||||
const bool manages = managesDirectory(fi.isDir() ? source : fi.absolutePath(), &topLevel);
|
||||
const QFileInfo fi = source.toFileInfo();
|
||||
FilePath topLevel;
|
||||
const bool manages = managesDirectory(fi.isDir() ? source : FilePath::fromString(fi.absolutePath()), &topLevel);
|
||||
if (!manages || topLevel.isEmpty())
|
||||
return;
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << source << topLevel << changeNr;
|
||||
QString description;
|
||||
QString relPath = QDir::toNativeSeparators(QDir(topLevel).relativeFilePath(source));
|
||||
QString relPath = QDir::toNativeSeparators(QDir(topLevel.toString()).relativeFilePath(source.toString()));
|
||||
QString id = QString::fromLatin1("%1@@%2").arg(relPath).arg(changeNr);
|
||||
|
||||
QStringList args(QLatin1String("describe"));
|
||||
args.push_back(id);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source);
|
||||
const ClearCaseResponse response = runCleartool(topLevel, args, m_settings.timeOutS, 0, codec);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source.toString());
|
||||
const ClearCaseResponse response = runCleartool(topLevel.toString(), args, m_settings.timeOutS, 0, codec);
|
||||
description = response.stdOut;
|
||||
if (m_settings.extDiffAvailable)
|
||||
description += diffExternal(id);
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, source, QStringList(), changeNr);
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, source.toString(), QStringList(), changeNr);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(description.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
} else {
|
||||
const QString title = QString::fromLatin1("cc describe %1").arg(id);
|
||||
IEditor *newEditor = showOutputInEditor(title, description, diffEditorParameters.id, source, codec);
|
||||
IEditor *newEditor = showOutputInEditor(title, description, diffEditorParameters.id, source.toString(), codec);
|
||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
||||
}
|
||||
}
|
||||
@@ -2028,17 +2028,17 @@ bool ClearCasePluginPrivate::vcsMove(const QString &workingDir, const QString &f
|
||||
///
|
||||
/// Check if the directory is managed under ClearCase control.
|
||||
///
|
||||
bool ClearCasePluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
bool ClearCasePluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel /* = 0 */) const
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
// If running with tests and fake ClearTool is enabled, then pretend we manage every directory
|
||||
QString topLevelFound = m_fakeClearTool ? directory : findTopLevel(directory);
|
||||
QString topLevelFound = m_fakeClearTool ? directory.toString() : findTopLevel(directory.toString());
|
||||
#else
|
||||
QString topLevelFound = findTopLevel(directory);
|
||||
QString topLevelFound = findTopLevel(directory.toString());
|
||||
#endif
|
||||
|
||||
if (topLevel)
|
||||
*topLevel = topLevelFound;
|
||||
*topLevel = FilePath::fromString(topLevelFound);
|
||||
return !topLevelFound.isEmpty();
|
||||
}
|
||||
|
||||
@@ -2147,9 +2147,9 @@ bool ClearCasePluginPrivate::ccCheckUcm(const QString &viewname, const QString &
|
||||
return catcsData.indexOf(QRegularExpression("(^|\\n)ucm\\n")) != -1;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool ClearCasePluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QString absFile = QFileInfo(QDir(workingDirectory), fileName).absoluteFilePath();
|
||||
QString absFile = QFileInfo(QDir(workingDirectory.toString()), fileName).absoluteFilePath();
|
||||
const FileStatus::Status status = getFileStatus(absFile);
|
||||
return status != FileStatus::NotManaged && status != FileStatus::Derived;
|
||||
}
|
||||
@@ -2403,9 +2403,9 @@ Utils::Id ClearCasePluginPrivate::id() const
|
||||
return Constants::VCS_ID_CLEARCASE;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) const
|
||||
bool ClearCasePluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(filePath)
|
||||
return false; // ClearCase has no files/directories littering the sources
|
||||
}
|
||||
|
||||
@@ -2440,13 +2440,13 @@ bool ClearCasePluginPrivate::supportsOperation(Operation operation) const
|
||||
return rc;
|
||||
}
|
||||
|
||||
Core::IVersionControl::OpenSupportMode ClearCasePluginPrivate::openSupportMode(const QString &fileName) const
|
||||
Core::IVersionControl::OpenSupportMode ClearCasePluginPrivate::openSupportMode(const FilePath &filePath) const
|
||||
{
|
||||
if (isDynamic()) {
|
||||
// NB! Has to use managesFile() and not vcsStatus() since the index can only be guaranteed
|
||||
// to be up to date if the file has been explicitly opened, which is not the case when
|
||||
// doing a search and replace as a part of a refactoring.
|
||||
if (managesFile(QFileInfo(fileName).absolutePath(), fileName)) {
|
||||
if (managesFile(FilePath::fromString(filePath.toFileInfo().absolutePath()), filePath.toString())) {
|
||||
// Checkout is the only option for managed files in dynamic views
|
||||
return IVersionControl::OpenMandatory;
|
||||
} else {
|
||||
@@ -2459,9 +2459,9 @@ Core::IVersionControl::OpenSupportMode ClearCasePluginPrivate::openSupportMode(c
|
||||
}
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsOpen(const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsOpen(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
@@ -2473,28 +2473,28 @@ Core::IVersionControl::SettingsFlags ClearCasePluginPrivate::settingsFlags() con
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsAdd(const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsDelete(const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsMove(const QString &from, const QString &to)
|
||||
bool ClearCasePluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo ifrom(from);
|
||||
const QFileInfo ito(to);
|
||||
return vcsMove(ifrom.absolutePath(), ifrom.fileName(), ito.fileName());
|
||||
const QFileInfo ifrom = from.toFileInfo();
|
||||
const QFileInfo ito = from.toFileInfo();
|
||||
return vcsMove(ifrom.absolutePath(), from.fileName(), to.fileName());
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void ClearCasePluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
vcsAnnotateHelper(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
@@ -2510,12 +2510,12 @@ QString ClearCasePluginPrivate::vcsMakeWritableText() const
|
||||
return tr("&Hijack");
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::vcsTopic(const QString &directory)
|
||||
QString ClearCasePluginPrivate::vcsTopic(const FilePath &directory)
|
||||
{
|
||||
return ccGetView(directory).name;
|
||||
return ccGetView(directory.toString()).name;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsCreateRepository(const QString &)
|
||||
bool ClearCasePluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
AddToVcsDialog::AddToVcsDialog(QWidget *parent, const QString &title,
|
||||
const QStringList &files, const QString &vcsDisplayName) :
|
||||
const Utils::FilePaths &files, const QString &vcsDisplayName) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AddToVcsDialog)
|
||||
{
|
||||
@@ -45,8 +45,8 @@ AddToVcsDialog::AddToVcsDialog(QWidget *parent, const QString &title,
|
||||
ui->addFilesLabel->setText(addTo);
|
||||
setWindowTitle(title);
|
||||
|
||||
foreach (const QString &file, files) {
|
||||
QListWidgetItem *item = new QListWidgetItem(QDir::toNativeSeparators(file));
|
||||
for (const Utils::FilePath &file : files) {
|
||||
QListWidgetItem *item = new QListWidgetItem(file.toUserOutput());
|
||||
ui->filesListWidget->addItem(item);
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Core {
|
||||
@@ -38,7 +40,7 @@ class AddToVcsDialog : public QDialog
|
||||
|
||||
public:
|
||||
explicit AddToVcsDialog(QWidget *parent, const QString &title,
|
||||
const QStringList &files, const QString &vcsDisplayName);
|
||||
const Utils::FilePaths &files, const QString &vcsDisplayName);
|
||||
~AddToVcsDialog() override;
|
||||
|
||||
private:
|
||||
|
@@ -308,7 +308,7 @@ int ReadOnlyFilesDialog::exec()
|
||||
}
|
||||
break;
|
||||
case RO_OpenVCS:
|
||||
if (!d->versionControls[buttongroup.filePath]->vcsOpen(buttongroup.filePath.toString())) {
|
||||
if (!d->versionControls[buttongroup.filePath]->vcsOpen(buttongroup.filePath)) {
|
||||
failedToMakeWritable << buttongroup.filePath;
|
||||
continue;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
|
||||
IVersionControl *versionControlForFile =
|
||||
VcsManager::findVersionControlForDirectory(directory.toString());
|
||||
const bool fileManagedByVCS = versionControlForFile
|
||||
&& versionControlForFile->openSupportMode(filePath.toString()) != IVersionControl::NoOpen;
|
||||
&& versionControlForFile->openSupportMode(filePath) != IVersionControl::NoOpen;
|
||||
if (fileManagedByVCS) {
|
||||
const QString vcsOpenTextForFile =
|
||||
Utils::stripAccelerator(versionControlForFile->vcsOpenText());
|
||||
@@ -447,7 +447,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
|
||||
vcsMakeWritableTextForAll.clear();
|
||||
}
|
||||
// Add make writable if it is supported by the reposetory.
|
||||
if (versionControlForFile->openSupportMode(filePath.toString()) == IVersionControl::OpenOptional) {
|
||||
if (versionControlForFile->openSupportMode(filePath) == IVersionControl::OpenOptional) {
|
||||
useMakeWritable = true;
|
||||
createRadioButtonForItem(item, radioButtonGroup, MakeWritable);
|
||||
}
|
||||
|
@@ -2006,7 +2006,7 @@ void EditorManagerPrivate::updateMakeWritableWarning()
|
||||
bool promptVCS = false;
|
||||
const QString directory = document->filePath().toFileInfo().absolutePath();
|
||||
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (versionControl && versionControl->openSupportMode(document->filePath().toString()) != IVersionControl::NoOpen) {
|
||||
if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
|
||||
if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
|
||||
vcsOpenCurrentEditor();
|
||||
ww = false;
|
||||
@@ -2258,10 +2258,10 @@ void EditorManagerPrivate::vcsOpenCurrentEditor()
|
||||
|
||||
const QString directory = document->filePath().toFileInfo().absolutePath();
|
||||
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (!versionControl || versionControl->openSupportMode(document->filePath().toString()) == IVersionControl::NoOpen)
|
||||
if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
|
||||
return;
|
||||
|
||||
if (!versionControl->vcsOpen(document->filePath().toString())) {
|
||||
if (!versionControl->vcsOpen(document->filePath())) {
|
||||
// TODO: wrong dialog parent
|
||||
QMessageBox::warning(ICore::dialogParent(), tr("Cannot Open File"),
|
||||
tr("Cannot open the file for editing with VCS."));
|
||||
|
@@ -205,7 +205,7 @@ bool FileUtils::renameFile(const FilePath &orgFilePath, const FilePath &newFileP
|
||||
|
||||
bool result = false;
|
||||
if (vc && vc->supportsOperation(IVersionControl::MoveOperation))
|
||||
result = vc->vcsMove(orgFilePath.toString(), newFilePath.toString());
|
||||
result = vc->vcsMove(orgFilePath, newFilePath);
|
||||
if (!result) // The moving via vcs failed or the vcs does not support moving, fall back
|
||||
result = Utils::FileUtils::renameFile(orgFilePath, newFilePath);
|
||||
if (result) {
|
||||
|
@@ -68,6 +68,9 @@
|
||||
\fn Core::IVersionControl::TopicCache::refreshTopic(const QString &repository)
|
||||
Returns the current topic for \a repository.
|
||||
*/
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Core {
|
||||
|
||||
QString IVersionControl::vcsOpenText() const
|
||||
@@ -146,7 +149,7 @@ void IVersionControl::setTopicCache(TopicCache *topicCache)
|
||||
m_topicCache = topicCache;
|
||||
}
|
||||
|
||||
QString IVersionControl::vcsTopic(const QString &topLevel)
|
||||
QString IVersionControl::vcsTopic(const FilePath &topLevel)
|
||||
{
|
||||
return m_topicCache ? m_topicCache->topic(topLevel) : QString();
|
||||
}
|
||||
@@ -161,17 +164,16 @@ IVersionControl::~IVersionControl()
|
||||
delete m_topicCache;
|
||||
}
|
||||
|
||||
QStringList IVersionControl::unmanagedFiles(const QStringList &filePaths) const
|
||||
FilePaths IVersionControl::unmanagedFiles(const FilePaths &filePaths) const
|
||||
{
|
||||
return Utils::filtered(filePaths, [this](const QString &f) {
|
||||
const Utils::FilePath fp = Utils::FilePath::fromString(f);
|
||||
return !managesFile(fp.parentDir().toString(), fp.fileName());
|
||||
return Utils::filtered(filePaths, [this](const FilePath &fp) {
|
||||
return !managesFile(fp.parentDir(), fp.fileName());
|
||||
});
|
||||
}
|
||||
|
||||
IVersionControl::OpenSupportMode IVersionControl::openSupportMode(const QString &fileName) const
|
||||
IVersionControl::OpenSupportMode IVersionControl::openSupportMode(const FilePath &filePath) const
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(filePath)
|
||||
return NoOpen;
|
||||
}
|
||||
|
||||
@@ -182,26 +184,26 @@ IVersionControl::TopicCache::~TopicCache() = default;
|
||||
|
||||
If the cache for \a topLevel is valid, it will be used. Otherwise it will be refreshed.
|
||||
*/
|
||||
QString IVersionControl::TopicCache::topic(const QString &topLevel)
|
||||
QString IVersionControl::TopicCache::topic(const FilePath &topLevel)
|
||||
{
|
||||
QTC_ASSERT(!topLevel.isEmpty(), return QString());
|
||||
TopicData &data = m_cache[topLevel];
|
||||
QString file = trackFile(topLevel);
|
||||
const FilePath file = trackFile(topLevel);
|
||||
|
||||
if (file.isEmpty())
|
||||
return QString();
|
||||
const QDateTime lastModified = QFileInfo(file).lastModified();
|
||||
const QDateTime lastModified = file.lastModified();
|
||||
if (lastModified == data.timeStamp)
|
||||
return data.topic;
|
||||
data.timeStamp = lastModified;
|
||||
return data.topic = refreshTopic(topLevel);
|
||||
}
|
||||
|
||||
void IVersionControl::fillLinkContextMenu(QMenu *, const QString &, const QString &)
|
||||
void IVersionControl::fillLinkContextMenu(QMenu *, const FilePath &, const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
bool IVersionControl::handleLink(const QString &workingDirectory, const QString &reference)
|
||||
bool IVersionControl::handleLink(const FilePath &workingDirectory, const QString &reference)
|
||||
{
|
||||
QTC_ASSERT(!reference.isEmpty(), return false);
|
||||
vcsDescribe(workingDirectory, reference);
|
||||
@@ -221,42 +223,40 @@ TestVersionControl::~TestVersionControl()
|
||||
VcsManager::clearVersionControlCache();
|
||||
}
|
||||
|
||||
void TestVersionControl::setManagedDirectories(const QHash<QString, QString> &dirs)
|
||||
void TestVersionControl::setManagedDirectories(const QHash<FilePath, FilePath> &dirs)
|
||||
{
|
||||
m_managedDirs = dirs;
|
||||
m_dirCount = 0;
|
||||
VcsManager::clearVersionControlCache();
|
||||
}
|
||||
|
||||
void TestVersionControl::setManagedFiles(const QSet<QString> &files)
|
||||
void TestVersionControl::setManagedFiles(const QSet<FilePath> &files)
|
||||
{
|
||||
m_managedFiles = files;
|
||||
m_fileCount = 0;
|
||||
VcsManager::clearVersionControlCache();
|
||||
}
|
||||
|
||||
bool TestVersionControl::managesDirectory(const QString &filename, QString *topLevel) const
|
||||
bool TestVersionControl::managesDirectory(const FilePath &filePath, FilePath *topLevel) const
|
||||
{
|
||||
++m_dirCount;
|
||||
|
||||
if (m_managedDirs.contains(filename)) {
|
||||
if (m_managedDirs.contains(filePath)) {
|
||||
if (topLevel)
|
||||
*topLevel = m_managedDirs.value(filename);
|
||||
*topLevel = m_managedDirs.value(filePath);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestVersionControl::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool TestVersionControl::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
++m_fileCount;
|
||||
|
||||
QFileInfo fi(workingDirectory + QLatin1Char('/') + fileName);
|
||||
QString dir = fi.absolutePath();
|
||||
if (!managesDirectory(dir, nullptr))
|
||||
FilePath full = workingDirectory.pathAppended(fileName);
|
||||
if (!managesDirectory(full.parentDir(), nullptr))
|
||||
return false;
|
||||
QString file = fi.absoluteFilePath();
|
||||
return m_managedFiles.contains(file);
|
||||
return m_managedFiles.contains(full.absoluteFilePath());
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "core_global.h"
|
||||
|
||||
#include <utils/id.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QFlags>
|
||||
@@ -71,11 +71,11 @@ public:
|
||||
{
|
||||
public:
|
||||
virtual ~TopicCache();
|
||||
QString topic(const QString &topLevel);
|
||||
QString topic(const Utils::FilePath &topLevel);
|
||||
|
||||
protected:
|
||||
virtual QString trackFile(const QString &repository) = 0;
|
||||
virtual QString refreshTopic(const QString &repository) = 0;
|
||||
virtual Utils::FilePath trackFile(const Utils::FilePath &repository) = 0;
|
||||
virtual QString refreshTopic(const Utils::FilePath &repository) = 0;
|
||||
|
||||
private:
|
||||
class TopicData
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
QString topic;
|
||||
};
|
||||
|
||||
QHash<QString, TopicData> m_cache;
|
||||
QHash<Utils::FilePath, TopicData> m_cache;
|
||||
|
||||
};
|
||||
|
||||
@@ -97,8 +97,8 @@ public:
|
||||
|
||||
/*!
|
||||
* \brief isVcsFileOrDirectory
|
||||
* \param fileName
|
||||
* \return True if filename is a file or directory that is maintained by the
|
||||
* \param filePath
|
||||
* \return True if filePath is a file or directory that is maintained by the
|
||||
* version control system.
|
||||
*
|
||||
* It will return true only for exact matches of the name, not for e.g. files in a
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
*
|
||||
* This method needs to be thread safe!
|
||||
*/
|
||||
virtual bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const = 0;
|
||||
virtual bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const = 0;
|
||||
|
||||
/*!
|
||||
* Returns whether files in this directory should be managed with this
|
||||
@@ -116,22 +116,24 @@ public:
|
||||
* that all files in the returned directory are managed by the same IVersionControl.
|
||||
*/
|
||||
|
||||
virtual bool managesDirectory(const QString &filename, QString *topLevel = nullptr) const = 0;
|
||||
virtual bool managesDirectory(const Utils::FilePath &filePath,
|
||||
Utils::FilePath *topLevel = nullptr) const = 0;
|
||||
|
||||
/*!
|
||||
* Returns whether \a fileName is managed by this version control.
|
||||
* Returns whether \a relativeFilePath is managed by this version control.
|
||||
*
|
||||
* \a workingDirectory is assumed to be part of a valid repository (not necessarily its
|
||||
* top level). \a fileName is expected to be relative to workingDirectory.
|
||||
*/
|
||||
virtual bool managesFile(const QString &workingDirectory, const QString &fileName) const = 0;
|
||||
virtual bool managesFile(const Utils::FilePath &workingDirectory,
|
||||
const QString &fileName) const = 0;
|
||||
|
||||
/*!
|
||||
* Returns the subset of \a filePaths that is not managed by this version control.
|
||||
*
|
||||
* The \a filePaths are expected to be absolute paths.
|
||||
*/
|
||||
virtual QStringList unmanagedFiles(const QStringList &filePaths) const;
|
||||
virtual Utils::FilePaths unmanagedFiles(const Utils::FilePaths &filePaths) const;
|
||||
|
||||
/*!
|
||||
* Returns true is the VCS is configured to run.
|
||||
@@ -145,9 +147,9 @@ public:
|
||||
virtual bool supportsOperation(Operation operation) const = 0;
|
||||
|
||||
/*!
|
||||
* Returns the open support mode for \a fileName.
|
||||
* Returns the open support mode for \a filePath.
|
||||
*/
|
||||
virtual OpenSupportMode openSupportMode(const QString &fileName) const;
|
||||
virtual OpenSupportMode openSupportMode(const Utils::FilePath &filepath) const;
|
||||
|
||||
/*!
|
||||
* Called prior to save, if the file is read only. Should be implemented if
|
||||
@@ -155,7 +157,7 @@ public:
|
||||
*
|
||||
* \note The EditorManager calls this for the editors.
|
||||
*/
|
||||
virtual bool vcsOpen(const QString &fileName) = 0;
|
||||
virtual bool vcsOpen(const Utils::FilePath &filePath) = 0;
|
||||
|
||||
/*!
|
||||
* Returns settings.
|
||||
@@ -171,34 +173,34 @@ public:
|
||||
* \note This function should be called from IProject subclasses after
|
||||
* files are added to the project.
|
||||
*/
|
||||
virtual bool vcsAdd(const QString &filename) = 0;
|
||||
virtual bool vcsAdd(const Utils::FilePath &filePath) = 0;
|
||||
|
||||
/*!
|
||||
* Called after a file has been removed from the project (if the user
|
||||
* wants), e.g. 'p4 delete', 'svn delete'.
|
||||
*/
|
||||
virtual bool vcsDelete(const QString &filename) = 0;
|
||||
virtual bool vcsDelete(const Utils::FilePath &filePath) = 0;
|
||||
|
||||
/*!
|
||||
* Called to rename a file, should do the actual on disk renaming
|
||||
* (e.g. git mv, svn move, p4 move)
|
||||
*/
|
||||
virtual bool vcsMove(const QString &from, const QString &to) = 0;
|
||||
virtual bool vcsMove(const Utils::FilePath &from, const Utils::FilePath &to) = 0;
|
||||
|
||||
/*!
|
||||
* Called to initialize the version control system in a directory.
|
||||
*/
|
||||
virtual bool vcsCreateRepository(const QString &directory) = 0;
|
||||
virtual bool vcsCreateRepository(const Utils::FilePath &directory) = 0;
|
||||
|
||||
/*!
|
||||
* Topic (e.g. name of the current branch)
|
||||
*/
|
||||
virtual QString vcsTopic(const QString &topLevel);
|
||||
virtual QString vcsTopic(const Utils::FilePath &topLevel);
|
||||
|
||||
/*!
|
||||
* Display annotation for a file and scroll to line
|
||||
*/
|
||||
virtual void vcsAnnotate(const QString &file, int line) = 0;
|
||||
virtual void vcsAnnotate(const Utils::FilePath &file, int line) = 0;
|
||||
|
||||
/*!
|
||||
* Display text for Open operation
|
||||
@@ -213,7 +215,7 @@ public:
|
||||
/*!
|
||||
* Display details of reference
|
||||
*/
|
||||
virtual void vcsDescribe(const QString &workingDirectory, const QString &reference) = 0;
|
||||
virtual void vcsDescribe(const Utils::FilePath &workingDirectory, const QString &reference) = 0;
|
||||
|
||||
/*!
|
||||
* Return a list of paths where tools that came with the VCS may be installed.
|
||||
@@ -233,10 +235,10 @@ public:
|
||||
const QStringList &extraArgs);
|
||||
|
||||
virtual void fillLinkContextMenu(QMenu *menu,
|
||||
const QString &workingDirectory,
|
||||
const Utils::FilePath &workingDirectory,
|
||||
const QString &reference);
|
||||
|
||||
virtual bool handleLink(const QString &workingDirectory, const QString &reference);
|
||||
virtual bool handleLink(const Utils::FilePath &workingDirectory, const QString &reference);
|
||||
|
||||
class CORE_EXPORT RepoUrl {
|
||||
public:
|
||||
@@ -281,11 +283,11 @@ public:
|
||||
{ }
|
||||
~TestVersionControl() override;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final
|
||||
{ Q_UNUSED(fileName) return false; }
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const final
|
||||
{ Q_UNUSED(filePath) return false; }
|
||||
|
||||
void setManagedDirectories(const QHash<QString, QString> &dirs);
|
||||
void setManagedFiles(const QSet<QString> &files);
|
||||
void setManagedDirectories(const QHash<Utils::FilePath, Utils::FilePath> &dirs);
|
||||
void setManagedFiles(const QSet<Utils::FilePath> &files);
|
||||
|
||||
int dirCount() const { return m_dirCount; }
|
||||
int fileCount() const { return m_fileCount; }
|
||||
@@ -293,23 +295,23 @@ public:
|
||||
// IVersionControl interface
|
||||
QString displayName() const override { return m_displayName; }
|
||||
Utils::Id id() const override { return m_id; }
|
||||
bool managesDirectory(const QString &filename, QString *topLevel) const override;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const override;
|
||||
bool managesDirectory(const Utils::FilePath &filePath, Utils::FilePath *topLevel) const override;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const override;
|
||||
bool isConfigured() const override { return true; }
|
||||
bool supportsOperation(Operation) const override { return false; }
|
||||
bool vcsOpen(const QString &) override { return false; }
|
||||
bool vcsAdd(const QString &) override { return false; }
|
||||
bool vcsDelete(const QString &) override { return false; }
|
||||
bool vcsMove(const QString &, const QString &) override { return false; }
|
||||
bool vcsCreateRepository(const QString &) override { return false; }
|
||||
void vcsAnnotate(const QString &, int) override {}
|
||||
void vcsDescribe(const QString &, const QString &) override {}
|
||||
bool vcsOpen(const Utils::FilePath &) override { return false; }
|
||||
bool vcsAdd(const Utils::FilePath &) override { return false; }
|
||||
bool vcsDelete(const Utils::FilePath &) override { return false; }
|
||||
bool vcsMove(const Utils::FilePath &, const Utils::FilePath &) override { return false; }
|
||||
bool vcsCreateRepository(const Utils::FilePath &) override { return false; }
|
||||
void vcsAnnotate(const Utils::FilePath &, int) override {}
|
||||
void vcsDescribe(const Utils::FilePath &, const QString &) override {}
|
||||
|
||||
private:
|
||||
Utils::Id m_id;
|
||||
QString m_displayName;
|
||||
QHash<QString, QString> m_managedDirs;
|
||||
QSet<QString> m_managedFiles;
|
||||
QHash<Utils::FilePath, Utils::FilePath> m_managedDirs;
|
||||
QSet<Utils::FilePath> m_managedFiles;
|
||||
mutable int m_dirCount = 0;
|
||||
mutable int m_fileCount = 0;
|
||||
};
|
||||
|
@@ -241,9 +241,9 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
||||
StringVersionControlPairs allThatCanManage;
|
||||
|
||||
foreach (IVersionControl * versionControl, versionControls()) {
|
||||
QString topLevel;
|
||||
if (versionControl->managesDirectory(directory, &topLevel))
|
||||
allThatCanManage.push_back(StringVersionControlPair(topLevel, versionControl));
|
||||
FilePath topLevel;
|
||||
if (versionControl->managesDirectory(FilePath::fromString(directory), &topLevel))
|
||||
allThatCanManage.push_back(StringVersionControlPair(topLevel.toString(), versionControl));
|
||||
}
|
||||
|
||||
// To properly find a nested repository (say, git checkout inside SVN),
|
||||
@@ -386,7 +386,7 @@ FilePaths VcsManager::promptToDelete(IVersionControl *vc, const FilePaths &fileP
|
||||
|
||||
FilePaths failedFiles;
|
||||
for (const FilePath &fp : filePaths) {
|
||||
if (!vc->vcsDelete(fp.toString()))
|
||||
if (!vc->vcsDelete(fp))
|
||||
failedFiles << fp;
|
||||
}
|
||||
return failedFiles;
|
||||
@@ -437,7 +437,7 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
|
||||
if (!vc || !vc->supportsOperation(IVersionControl::AddOperation))
|
||||
return;
|
||||
|
||||
const QStringList unmanagedFiles = vc->unmanagedFiles(fileNames);
|
||||
const FilePaths unmanagedFiles = vc->unmanagedFiles(Utils::transform(fileNames, &FilePath::fromString));
|
||||
if (unmanagedFiles.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -445,9 +445,9 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
|
||||
unmanagedFiles, vc->displayName());
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
QStringList notAddedToVc;
|
||||
foreach (const QString &file, unmanagedFiles) {
|
||||
if (!vc->vcsAdd(QDir(directory).filePath(file)))
|
||||
notAddedToVc << file;
|
||||
for (const FilePath &file : unmanagedFiles) {
|
||||
if (!vc->vcsAdd(FilePath::fromString(QDir(directory).filePath(file.path()))))
|
||||
notAddedToVc << file.toUserOutput();
|
||||
}
|
||||
|
||||
if (!notAddedToVc.isEmpty()) {
|
||||
@@ -495,16 +495,16 @@ namespace Internal {
|
||||
const char ID_VCS_A[] = "A";
|
||||
const char ID_VCS_B[] = "B";
|
||||
|
||||
using FileHash = QHash<QString, QString>;
|
||||
using FileHash = QHash<FilePath, FilePath>;
|
||||
|
||||
static FileHash makeHash(const QStringList &list)
|
||||
{
|
||||
FileHash result;
|
||||
foreach (const QString &i, list) {
|
||||
for (const QString &i : list) {
|
||||
QStringList parts = i.split(QLatin1Char(':'));
|
||||
QTC_ASSERT(parts.count() == 2, continue);
|
||||
result.insert(QString::fromLatin1(TEST_PREFIX) + parts.at(0),
|
||||
QString::fromLatin1(TEST_PREFIX) + parts.at(1));
|
||||
result.insert(FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(0)),
|
||||
FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(1)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -236,18 +236,18 @@ public:
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
bool managesDirectory(const Utils::FilePath &directory, Utils::FilePath *topLevel) const final;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const final;
|
||||
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
OpenSupportMode openSupportMode(const QString &fileName) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
bool vcsAdd(const QString &fileName) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &, const QString &) final { return false; }
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
OpenSupportMode openSupportMode(const Utils::FilePath &filePath) const final;
|
||||
bool vcsOpen(const Utils::FilePath &filePath) final;
|
||||
bool vcsAdd(const Utils::FilePath &filePath) final;
|
||||
bool vcsDelete(const Utils::FilePath &filePath) final;
|
||||
bool vcsMove(const Utils::FilePath &, const Utils::FilePath &) final { return false; }
|
||||
bool vcsCreateRepository(const Utils::FilePath &directory) final;
|
||||
void vcsAnnotate(const Utils::FilePath &filePath, int line) final;
|
||||
|
||||
QString vcsOpenText() const final;
|
||||
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
|
||||
void vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber);
|
||||
void vcsDescribe(const QString &source, const QString &changeNr) final;
|
||||
void vcsDescribe(const Utils::FilePath &source, const QString &changeNr) final;
|
||||
|
||||
protected:
|
||||
void updateActions(ActionState) final;
|
||||
@@ -436,38 +436,38 @@ bool CvsPluginPrivate::supportsOperation(Operation operation) const
|
||||
return rc;
|
||||
}
|
||||
|
||||
Core::IVersionControl::OpenSupportMode CvsPluginPrivate::openSupportMode(const QString &fileName) const
|
||||
Core::IVersionControl::OpenSupportMode CvsPluginPrivate::openSupportMode(const FilePath &filePath) const
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(filePath)
|
||||
return OpenOptional;
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsOpen(const QString &fileName)
|
||||
bool CvsPluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return edit(fi.absolutePath(), QStringList(fi.fileName()));
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsAdd(const QString &fileName)
|
||||
bool CvsPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsDelete(const QString &fileName)
|
||||
bool CvsPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsCreateRepository(const QString &)
|
||||
bool CvsPluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CvsPluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void CvsPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
vcsAnnotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
@@ -740,10 +740,10 @@ CvsPluginPrivate::CvsPluginPrivate()
|
||||
connect(&m_settings, &AspectContainer::applied, this, &IVersionControl::configurationChanged);
|
||||
}
|
||||
|
||||
void CvsPluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
|
||||
void CvsPluginPrivate::vcsDescribe(const FilePath &source, const QString &changeNr)
|
||||
{
|
||||
QString errorMessage;
|
||||
if (!describe(source, changeNr, &errorMessage))
|
||||
if (!describe(source.toString(), changeNr, &errorMessage))
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
};
|
||||
|
||||
@@ -1284,15 +1284,14 @@ void CvsPluginPrivate::updateRepository()
|
||||
|
||||
bool CvsPluginPrivate::describe(const QString &file, const QString &changeNr, QString *errorMessage)
|
||||
{
|
||||
|
||||
QString toplevel;
|
||||
const bool manages = managesDirectory(QFileInfo(file).absolutePath(), &toplevel);
|
||||
FilePath toplevel;
|
||||
const bool manages = managesDirectory(FilePath::fromString(QFileInfo(file).absolutePath()), &toplevel);
|
||||
if (!manages || toplevel.isEmpty()) {
|
||||
*errorMessage = tr("Cannot find repository for \"%1\".")
|
||||
.arg(QDir::toNativeSeparators(file));
|
||||
return false;
|
||||
}
|
||||
return describe(toplevel, QDir(toplevel).relativeFilePath(file), changeNr, errorMessage);
|
||||
return describe(toplevel.toString(), QDir(toplevel.toString()).relativeFilePath(file), changeNr, errorMessage);
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, const
|
||||
@@ -1518,12 +1517,12 @@ bool CvsPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFi
|
||||
|
||||
/* CVS has a "CVS" directory in each directory it manages. The top level
|
||||
* is the first directory under the directory that does not have it. */
|
||||
bool CvsPluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
bool CvsPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel /* = 0 */) const
|
||||
{
|
||||
if (topLevel)
|
||||
topLevel->clear();
|
||||
bool manages = false;
|
||||
const QDir dir(directory);
|
||||
const QDir dir(directory.toString());
|
||||
do {
|
||||
if (!dir.exists() || !checkCVSDirectory(dir))
|
||||
break;
|
||||
@@ -1538,7 +1537,7 @@ bool CvsPluginPrivate::managesDirectory(const QString &directory, QString *topLe
|
||||
!parentDir.isRoot() && parentDir.cdUp();
|
||||
lastDirectory = parentDir) {
|
||||
if (!checkCVSDirectory(parentDir)) {
|
||||
*topLevel = lastDirectory.absolutePath();
|
||||
*topLevel = FilePath::fromString(lastDirectory.absolutePath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1547,12 +1546,12 @@ bool CvsPluginPrivate::managesDirectory(const QString &directory, QString *topLe
|
||||
return manages;
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool CvsPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("status") << fileName;
|
||||
const CvsResponse response =
|
||||
runCvs(workingDirectory, args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||
runCvs(workingDirectory.toString(), args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||
if (response.result != CvsResponse::Ok)
|
||||
return false;
|
||||
return !response.stdOut.contains(QLatin1String("Status: Unknown"));
|
||||
|
@@ -844,14 +844,13 @@ bool GitClient::managesFile(const QString &workingDirectory, const QString &file
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
QStringList GitClient::unmanagedFiles(const QStringList &filePaths) const
|
||||
FilePaths GitClient::unmanagedFiles(const FilePaths &filePaths) const
|
||||
{
|
||||
QMap<QString, QStringList> filesForDir;
|
||||
for (const QString &filePath : filePaths) {
|
||||
const FilePath fp = FilePath::fromString(filePath);
|
||||
for (const FilePath &fp : filePaths) {
|
||||
filesForDir[fp.parentDir().toString()] << fp.fileName();
|
||||
}
|
||||
QStringList res;
|
||||
FilePaths res;
|
||||
for (auto it = filesForDir.begin(), end = filesForDir.end(); it != end; ++it) {
|
||||
QStringList args({"ls-files", "-z"});
|
||||
const QDir wd(it.key());
|
||||
@@ -863,9 +862,10 @@ QStringList GitClient::unmanagedFiles(const QStringList &filePaths) const
|
||||
const QStringList managedFilePaths
|
||||
= transform(proc.stdOut().split('\0', Qt::SkipEmptyParts),
|
||||
[&wd](const QString &fp) { return wd.absoluteFilePath(fp); });
|
||||
res += filtered(it.value(), [&managedFilePaths, &wd](const QString &fp) {
|
||||
const QStringList filtered = Utils::filtered(it.value(), [&managedFilePaths, &wd](const QString &fp) {
|
||||
return !managedFilePaths.contains(wd.absoluteFilePath(fp));
|
||||
});
|
||||
res += transform(filtered, &FilePath::fromString);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@@ -153,7 +153,7 @@ public:
|
||||
QString findRepositoryForDirectory(const QString &directory) const;
|
||||
QString findGitDirForRepository(const QString &repositoryDir) const;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
QStringList unmanagedFiles(const QStringList &filePaths) const;
|
||||
Utils::FilePaths unmanagedFiles(const Utils::FilePaths &filePaths) const;
|
||||
|
||||
void diffFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
void diffFiles(const QString &workingDirectory,
|
||||
|
@@ -59,6 +59,8 @@
|
||||
#include <aggregation/aggregate.h>
|
||||
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/infobar.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/pathchooser.h>
|
||||
@@ -112,15 +114,15 @@ public:
|
||||
{ }
|
||||
|
||||
protected:
|
||||
QString trackFile(const QString &repository) override
|
||||
FilePath trackFile(const FilePath &repository) override
|
||||
{
|
||||
const QString gitDir = m_client->findGitDirForRepository(repository);
|
||||
return gitDir.isEmpty() ? QString() : (gitDir + "/HEAD");
|
||||
const QString gitDir = m_client->findGitDirForRepository(repository.toString());
|
||||
return gitDir.isEmpty() ? FilePath() : FilePath::fromString(gitDir + "/HEAD");
|
||||
}
|
||||
|
||||
QString refreshTopic(const QString &repository) override
|
||||
QString refreshTopic(const FilePath &repository) override
|
||||
{
|
||||
return m_client->synchronousTopic(repository);
|
||||
return m_client->synchronousTopic(repository.toString());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -234,23 +236,23 @@ public:
|
||||
QString displayName() const final;
|
||||
Utils::Id id() const final;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const FilePath &filePath) const final;
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
QStringList unmanagedFiles(const QStringList &filePaths) const final;
|
||||
bool managesDirectory(const FilePath &directory, FilePath *topLevel) const final;
|
||||
bool managesFile(const FilePath &workingDirectory, const QString &fileName) const final;
|
||||
FilePaths unmanagedFiles(const FilePaths &filePaths) const final;
|
||||
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
bool vcsAdd(const QString &fileName) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &from, const QString &to) final;
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
bool vcsOpen(const FilePath &fileName) final;
|
||||
bool vcsAdd(const FilePath &fileName) final;
|
||||
bool vcsDelete(const FilePath &filename) final;
|
||||
bool vcsMove(const FilePath &from, const FilePath &to) final;
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
void vcsDescribe(const QString &source, const QString &id) final { m_gitClient.show(source, id); };
|
||||
QString vcsTopic(const QString &directory) final;
|
||||
void vcsAnnotate(const FilePath &file, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_gitClient.show(source.toString(), id); };
|
||||
QString vcsTopic(const FilePath &directory) final;
|
||||
|
||||
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
@@ -258,7 +260,7 @@ public:
|
||||
const QStringList &extraArgs) final;
|
||||
|
||||
void fillLinkContextMenu(QMenu *menu,
|
||||
const QString &workingDirectory,
|
||||
const FilePath &workingDirectory,
|
||||
const QString &reference) final
|
||||
{
|
||||
menu->addAction(tr("&Copy \"%1\"").arg(reference),
|
||||
@@ -266,15 +268,15 @@ public:
|
||||
QAction *action = menu->addAction(tr("&Describe Change %1").arg(reference),
|
||||
[=] { vcsDescribe(workingDirectory, reference); });
|
||||
menu->setDefaultAction(action);
|
||||
GitClient::addChangeActions(menu, workingDirectory, reference);
|
||||
GitClient::addChangeActions(menu, workingDirectory.toString(), reference);
|
||||
}
|
||||
|
||||
bool handleLink(const QString &workingDirectory, const QString &reference) final
|
||||
bool handleLink(const FilePath &workingDirectory, const QString &reference) final
|
||||
{
|
||||
if (reference.contains(".."))
|
||||
GitClient::instance()->log(workingDirectory, {}, false, {reference});
|
||||
GitClient::instance()->log(workingDirectory.toString(), {}, false, {reference});
|
||||
else
|
||||
GitClient::instance()->show(workingDirectory, reference);
|
||||
GitClient::instance()->show(workingDirectory.toString(), reference);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1836,13 +1838,13 @@ Utils::Id GitPluginPrivate::id() const
|
||||
return Utils::Id(VcsBase::Constants::VCS_ID_GIT);
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) const
|
||||
bool GitPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
||||
{
|
||||
if (fileName.fileName().compare(".git", Utils::HostOsInfo::fileNameCaseSensitivity()))
|
||||
if (filePath.fileName().compare(".git", Utils::HostOsInfo::fileNameCaseSensitivity()))
|
||||
return false;
|
||||
if (fileName.isDir())
|
||||
if (filePath.isDir())
|
||||
return true;
|
||||
QFile file(fileName.toString());
|
||||
QFile file(filePath.toString());
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
return false;
|
||||
return file.read(8) == "gitdir: ";
|
||||
@@ -1871,39 +1873,39 @@ bool GitPluginPrivate::supportsOperation(Operation operation) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsOpen(const QString & /*fileName*/)
|
||||
bool GitPluginPrivate::vcsOpen(const FilePath & /*filePath*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsAdd(const QString &fileName)
|
||||
bool GitPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_gitClient.synchronousAdd(fi.absolutePath(), {fi.fileName()}, {"--intent-to-add"});
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsDelete(const QString &fileName)
|
||||
bool GitPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_gitClient.synchronousDelete(fi.absolutePath(), true, {fi.fileName()});
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsMove(const QString &from, const QString &to)
|
||||
bool GitPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo(from);
|
||||
const QFileInfo toInfo(to);
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return m_gitClient.synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsCreateRepository(const QString &directory)
|
||||
bool GitPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
{
|
||||
return m_gitClient.synchronousInit(directory);
|
||||
return m_gitClient.synchronousInit(directory.toString());
|
||||
}
|
||||
|
||||
QString GitPluginPrivate::vcsTopic(const QString &directory)
|
||||
QString GitPluginPrivate::vcsTopic(const FilePath &directory)
|
||||
{
|
||||
QString topic = Core::IVersionControl::vcsTopic(directory);
|
||||
const QString commandInProgress = m_gitClient.commandInProgressDescription(directory);
|
||||
const QString commandInProgress = m_gitClient.commandInProgressDescription(directory.toString());
|
||||
if (!commandInProgress.isEmpty())
|
||||
topic += " (" + commandInProgress + ')';
|
||||
return topic;
|
||||
@@ -1937,27 +1939,27 @@ QStringList GitPluginPrivate::additionalToolsPath() const
|
||||
return res;
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const
|
||||
bool GitPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel) const
|
||||
{
|
||||
const QString topLevelFound = m_gitClient.findRepositoryForDirectory(directory);
|
||||
const QString topLevelFound = m_gitClient.findRepositoryForDirectory(directory.toString());
|
||||
if (topLevel)
|
||||
*topLevel = topLevelFound;
|
||||
*topLevel = FilePath::fromString(topLevelFound);
|
||||
return !topLevelFound.isEmpty();
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool GitPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return m_gitClient.managesFile(workingDirectory, fileName);
|
||||
return m_gitClient.managesFile(workingDirectory.toString(), fileName);
|
||||
}
|
||||
|
||||
QStringList GitPluginPrivate::unmanagedFiles(const QStringList &filePaths) const
|
||||
FilePaths GitPluginPrivate::unmanagedFiles(const FilePaths &filePaths) const
|
||||
{
|
||||
return m_gitClient.unmanagedFiles(filePaths);
|
||||
}
|
||||
|
||||
void GitPluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void GitPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
m_gitClient.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
|
@@ -80,14 +80,14 @@ public:
|
||||
MercurialTopicCache(MercurialClient *client) : m_client(client) {}
|
||||
|
||||
protected:
|
||||
QString trackFile(const QString &repository) override
|
||||
FilePath trackFile(const FilePath &repository) override
|
||||
{
|
||||
return repository + QLatin1String("/.hg/branch");
|
||||
return repository.pathAppended(".hg/branch");
|
||||
}
|
||||
|
||||
QString refreshTopic(const QString &repository) override
|
||||
QString refreshTopic(const FilePath &repository) override
|
||||
{
|
||||
return m_client->branchQuerySync(repository);
|
||||
return m_client->branchQuerySync(repository.toString());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -132,19 +132,19 @@ public:
|
||||
// IVersionControl
|
||||
QString displayName() const final;
|
||||
Utils::Id id() const final;
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const FilePath &filePath) const final;
|
||||
|
||||
bool managesDirectory(const QString &filename, QString *topLevel = nullptr) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
bool managesDirectory(const FilePath &filePath, FilePath *topLevel = nullptr) const final;
|
||||
bool managesFile(const FilePath &workingDirectory, const QString &fileName) const final;
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
bool vcsAdd(const QString &filename) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &from, const QString &to) final;
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
void vcsDescribe(const QString &source, const QString &id) final { m_client.view(source, id); }
|
||||
bool vcsOpen(const FilePath &filePath) final;
|
||||
bool vcsAdd(const FilePath &filePath) final;
|
||||
bool vcsDelete(const FilePath &filePath) final;
|
||||
bool vcsMove(const FilePath &from, const FilePath &to) final;
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
void vcsAnnotate(const FilePath &filePath, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_client.view(source.toString(), id); }
|
||||
|
||||
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
@@ -661,7 +661,7 @@ void MercurialPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusI
|
||||
arg(QDir::toNativeSeparators(m_submitRepository));
|
||||
commitEditor->document()->setPreferredDisplayName(msg);
|
||||
|
||||
const QString branch = vcsTopic(m_submitRepository);
|
||||
const QString branch = vcsTopic(FilePath::fromString(m_submitRepository));
|
||||
commitEditor->setFields(QFileInfo(m_submitRepository), branch,
|
||||
m_settings.userName.value(),
|
||||
m_settings.userEmail.value(), status);
|
||||
@@ -747,23 +747,23 @@ Utils::Id MercurialPluginPrivate::id() const
|
||||
return {VcsBase::Constants::VCS_ID_MERCURIAL};
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) const
|
||||
bool MercurialPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
||||
{
|
||||
return m_client.isVcsDirectory(fileName);
|
||||
return m_client.isVcsDirectory(filePath);
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::managesDirectory(const QString &directory, QString *topLevel) const
|
||||
bool MercurialPluginPrivate::managesDirectory(const FilePath &filePath, FilePath *topLevel) const
|
||||
{
|
||||
QFileInfo dir(directory);
|
||||
QFileInfo dir = filePath.toFileInfo();
|
||||
const QString topLevelFound = m_client.findTopLevelForFile(dir);
|
||||
if (topLevel)
|
||||
*topLevel = topLevelFound;
|
||||
*topLevel = FilePath::fromString(topLevelFound);
|
||||
return !topLevelFound.isEmpty();
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool MercurialPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return m_client.managesFile(workingDirectory, fileName);
|
||||
return m_client.managesFile(workingDirectory.toString(), fileName);
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::isConfigured() const
|
||||
@@ -793,41 +793,41 @@ bool MercurialPluginPrivate::supportsOperation(Operation operation) const
|
||||
return supported;
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsOpen(const QString &filename)
|
||||
bool MercurialPluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
Q_UNUSED(filename)
|
||||
Q_UNUSED(filePath)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsAdd(const QString &filename)
|
||||
bool MercurialPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(filename);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousAdd(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsDelete(const QString &filename)
|
||||
bool MercurialPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(filename);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousRemove(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsMove(const QString &from, const QString &to)
|
||||
bool MercurialPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo(from);
|
||||
const QFileInfo toInfo(to);
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return m_client.synchronousMove(fromInfo.absolutePath(),
|
||||
fromInfo.absoluteFilePath(),
|
||||
toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsCreateRepository(const QString &directory)
|
||||
bool MercurialPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
{
|
||||
return m_client.synchronousCreateRepository(directory);
|
||||
return m_client.synchronousCreateRepository(directory.toString());
|
||||
}
|
||||
|
||||
void MercurialPluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void MercurialPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
@@ -847,12 +847,12 @@ Core::ShellCommand *MercurialPluginPrivate::createInitialCheckoutCommand(const Q
|
||||
bool MercurialPluginPrivate::sccManaged(const QString &filename)
|
||||
{
|
||||
const QFileInfo fi(filename);
|
||||
QString topLevel;
|
||||
const bool managed = managesDirectory(fi.absolutePath(), &topLevel);
|
||||
FilePath topLevel;
|
||||
const bool managed = managesDirectory(FilePath::fromString(fi.absolutePath()), &topLevel);
|
||||
if (!managed || topLevel.isEmpty())
|
||||
return false;
|
||||
const QDir topLevelDir(topLevel);
|
||||
return m_client.manifestSync(topLevel, topLevelDir.relativeFilePath(filename));
|
||||
const QDir topLevelDir(topLevel.toString());
|
||||
return m_client.manifestSync(topLevel.toString(), topLevelDir.relativeFilePath(filename));
|
||||
}
|
||||
|
||||
void MercurialPluginPrivate::changed(const QVariant &v)
|
||||
|
@@ -212,20 +212,20 @@ public:
|
||||
Id id() const final { return VcsBase::Constants::VCS_ID_PERFORCE; }
|
||||
|
||||
bool isVcsFileOrDirectory(const FilePath &fileName) const final;
|
||||
bool managesDirectory(const QString &directory, QString *topLevel = nullptr) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
bool managesDirectory(const Utils::FilePath &directory, Utils::FilePath *topLevel = nullptr) const final;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const final;
|
||||
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
OpenSupportMode openSupportMode(const QString &fileName) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
OpenSupportMode openSupportMode(const Utils::FilePath &filePath) const final;
|
||||
bool vcsOpen(const Utils::FilePath &filePath) final;
|
||||
SettingsFlags settingsFlags() const final;
|
||||
bool vcsAdd(const QString &fileName) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &from, const QString &to) final;
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
void vcsDescribe(const QString &source, const QString &n) final;
|
||||
bool vcsAdd(const Utils::FilePath &filePath) final;
|
||||
bool vcsDelete(const Utils::FilePath &filePath) final;
|
||||
bool vcsMove(const Utils::FilePath &from, const Utils::FilePath &to) final;
|
||||
bool vcsCreateRepository(const Utils::FilePath &directory) final;
|
||||
void vcsAnnotate(const Utils::FilePath &filePath, int line) final;
|
||||
void vcsDescribe(const Utils::FilePath &source, const QString &n) final;
|
||||
QString vcsOpenText() const final;
|
||||
QString vcsMakeWritableText() const final;
|
||||
|
||||
@@ -831,7 +831,7 @@ void PerforcePluginPrivate::describeChange()
|
||||
{
|
||||
ChangeNumberDialog dia;
|
||||
if (dia.exec() == QDialog::Accepted && dia.number() > 0)
|
||||
vcsDescribe(QString(), QString::number(dia.number()));
|
||||
vcsDescribe(FilePath(), QString::number(dia.number()));
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::annotateCurrentFile()
|
||||
@@ -978,23 +978,23 @@ void PerforcePluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
m_revertUnchangedAction->setParameter(projectName);
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
bool PerforcePluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel /* = 0 */) const
|
||||
{
|
||||
const bool rc = const_cast<PerforcePluginPrivate *>(this)->managesDirectoryFstat(directory);
|
||||
const bool rc = const_cast<PerforcePluginPrivate *>(this)->managesDirectoryFstat(directory.toString());
|
||||
if (topLevel) {
|
||||
if (rc)
|
||||
*topLevel = m_settings.topLevelSymLinkTarget();
|
||||
*topLevel = FilePath::fromString(m_settings.topLevelSymLinkTarget());
|
||||
else
|
||||
topLevel->clear();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool PerforcePluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("fstat") << QLatin1String("-m1") << fileName;
|
||||
const PerforceResponse result = runP4Cmd(workingDirectory, args, RunFullySynchronous);
|
||||
const PerforceResponse result = runP4Cmd(workingDirectory.toString(), args, RunFullySynchronous);
|
||||
return result.stdOut.contains(QLatin1String("depotFile"));
|
||||
}
|
||||
|
||||
@@ -1126,9 +1126,9 @@ PerforcePluginPrivate::createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::isVcsFileOrDirectory(const FilePath &fileName) const
|
||||
bool PerforcePluginPrivate::isVcsFileOrDirectory(const FilePath &FilePath) const
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(FilePath)
|
||||
return false; // Perforce does not seem to litter its files into the source tree.
|
||||
}
|
||||
|
||||
@@ -1158,15 +1158,15 @@ bool PerforcePluginPrivate::supportsOperation(Operation operation) const
|
||||
return false;
|
||||
}
|
||||
|
||||
IVersionControl::OpenSupportMode PerforcePluginPrivate::openSupportMode(const QString &fileName) const
|
||||
IVersionControl::OpenSupportMode PerforcePluginPrivate::openSupportMode(const FilePath &filePath) const
|
||||
{
|
||||
Q_UNUSED(fileName)
|
||||
Q_UNUSED(filePath)
|
||||
return OpenOptional;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsOpen(const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsOpen(fi.absolutePath(), fi.fileName(), true);
|
||||
}
|
||||
|
||||
@@ -1178,33 +1178,33 @@ IVersionControl::SettingsFlags PerforcePluginPrivate::settingsFlags() const
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsAdd(const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsDelete(const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsMove(const QString &from, const QString &to)
|
||||
bool PerforcePluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo(from);
|
||||
const QFileInfo toInfo(to);
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsCreateRepository(const QString &)
|
||||
bool PerforcePluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void PerforcePluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
@@ -1537,16 +1537,16 @@ void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
|
||||
diffEditorWidget->setEditorConfig(pw);
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::vcsDescribe(const QString & source, const QString &n)
|
||||
void PerforcePluginPrivate::vcsDescribe(const FilePath &source, const QString &n)
|
||||
{
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(nullptr)
|
||||
: VcsBaseEditor::getCodec(source);
|
||||
: VcsBaseEditor::getCodec(source.toString());
|
||||
QStringList args;
|
||||
args << QLatin1String("describe") << QLatin1String("-du") << n;
|
||||
const PerforceResponse result = runP4Cmd(m_settings.topLevel(), args, CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
QStringList(), QByteArray(), codec);
|
||||
if (!result.error)
|
||||
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source, codec);
|
||||
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, diffEditorParameters.id, source.toString(), codec);
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::commitFromEditor()
|
||||
|
@@ -3868,7 +3868,7 @@ void ProjectExplorerPluginPrivate::deleteFile()
|
||||
FileChangeBlocker changeGuard(currentNode->filePath());
|
||||
if (IVersionControl *vc =
|
||||
VcsManager::findVersionControlForDirectory(filePath.absolutePath().toString())) {
|
||||
vc->vcsDelete(filePath.toString());
|
||||
vc->vcsDelete(filePath);
|
||||
}
|
||||
if (filePath.exists()) {
|
||||
if (!filePath.removeFile())
|
||||
|
@@ -757,7 +757,7 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
|
||||
const FilePath targetFile = targetFilePath(sourceFile);
|
||||
if (sourceFile.copyFile(targetFile)) {
|
||||
filesToAdd << targetFile;
|
||||
if (addToVcs && !vcs->vcsAdd(targetFile.toString()))
|
||||
if (addToVcs && !vcs->vcsAdd(targetFile))
|
||||
failedVcsOp << targetFile;
|
||||
} else {
|
||||
failedCopyOrMove << sourceFile;
|
||||
@@ -780,7 +780,7 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
|
||||
const VcsInfo sourceVcs = vcsInfoForFile(sourceFile.toString());
|
||||
if (sourceVcs.vcs && targetVcs.vcs && sourceVcs == targetVcs
|
||||
&& sourceVcs.vcs->supportsOperation(Core::IVersionControl::MoveOperation)) {
|
||||
if (sourceVcs.vcs->vcsMove(sourceFile.toString(), targetFile.toString())) {
|
||||
if (sourceVcs.vcs->vcsMove(sourceFile, targetFile)) {
|
||||
filesToAdd << targetFile;
|
||||
filesToRemove << sourceFile;
|
||||
} else {
|
||||
@@ -797,12 +797,12 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
|
||||
Core::FileChangeBlocker changeGuard(sourceFile);
|
||||
if (sourceVcs.vcs && sourceVcs.vcs->supportsOperation(
|
||||
Core::IVersionControl::DeleteOperation)
|
||||
&& !sourceVcs.vcs->vcsDelete(sourceFile.toString())) {
|
||||
&& !sourceVcs.vcs->vcsDelete(sourceFile)) {
|
||||
failedVcsOp << sourceFile;
|
||||
}
|
||||
if (sourceFile.exists() && !sourceFile.removeFile())
|
||||
failedDelete << sourceFile;
|
||||
if (vcsAddPossible && !targetVcs.vcs->vcsAdd(targetFile.toString()))
|
||||
if (vcsAddPossible && !targetVcs.vcs->vcsAdd(targetFile))
|
||||
failedVcsOp << targetFile;
|
||||
}
|
||||
const RemovedFilesFromProject result
|
||||
|
@@ -1003,7 +1003,7 @@ QString ContainerNode::displayName() const
|
||||
const QFileInfo fi = m_project->projectFilePath().toFileInfo();
|
||||
const QString dir = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
|
||||
if (Core::IVersionControl *vc = Core::VcsManager::findVersionControlForDirectory(dir)) {
|
||||
QString vcsTopic = vc->vcsTopic(dir);
|
||||
QString vcsTopic = vc->vcsTopic(FilePath::fromString(dir));
|
||||
if (!vcsTopic.isEmpty())
|
||||
name += " [" + vcsTopic + ']';
|
||||
}
|
||||
|
@@ -418,7 +418,7 @@ bool ProjectWizardPage::runVersionControl(const QList<GeneratedFile> &files, QSt
|
||||
// Create repository?
|
||||
if (!m_repositoryExists) {
|
||||
QTC_ASSERT(versionControl->supportsOperation(IVersionControl::CreateRepositoryOperation), return false);
|
||||
if (!versionControl->vcsCreateRepository(m_commonDirectory)) {
|
||||
if (!versionControl->vcsCreateRepository(FilePath::fromString(m_commonDirectory))) {
|
||||
*errorMessage = tr("A version control system repository could not be created in \"%1\".").arg(m_commonDirectory);
|
||||
return false;
|
||||
}
|
||||
@@ -426,7 +426,7 @@ bool ProjectWizardPage::runVersionControl(const QList<GeneratedFile> &files, QSt
|
||||
// Add files if supported.
|
||||
if (versionControl->supportsOperation(IVersionControl::AddOperation)) {
|
||||
foreach (const GeneratedFile &generatedFile, files) {
|
||||
if (!versionControl->vcsAdd(generatedFile.path())) {
|
||||
if (!versionControl->vcsAdd(generatedFile.filePath())) {
|
||||
*errorMessage = tr("Failed to add \"%1\" to the version control system.").arg(generatedFile.path());
|
||||
return false;
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
@@ -56,7 +57,7 @@ void VcsAnnotateTaskHandler::handle(const Task &task)
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
QTC_ASSERT(vc, return);
|
||||
QTC_ASSERT(vc->supportsOperation(IVersionControl::AnnotateOperation), return);
|
||||
vc->vcsAnnotate(fi.absoluteFilePath(), task.movedLine);
|
||||
vc->vcsAnnotate(FilePath::fromString(fi.absoluteFilePath()), task.movedLine);
|
||||
}
|
||||
|
||||
QAction *VcsAnnotateTaskHandler::createAction(QObject *parent) const
|
||||
|
@@ -353,7 +353,7 @@ bool QbsBuildSystem::ensureWriteableQbsFile(const QString &file)
|
||||
// Try via vcs manager
|
||||
IVersionControl *versionControl =
|
||||
VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
if (!versionControl || !versionControl->vcsOpen(file)) {
|
||||
if (!versionControl || !versionControl->vcsOpen(FilePath::fromString(file))) {
|
||||
bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser);
|
||||
if (!makeWritable) {
|
||||
QMessageBox::warning(ICore::dialogParent(),
|
||||
|
@@ -746,7 +746,7 @@ bool QmakePriFile::ensureWriteableProFile(const QString &file)
|
||||
if (!fi.isWritable()) {
|
||||
// Try via vcs manager
|
||||
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
if (!versionControl || !versionControl->vcsOpen(file)) {
|
||||
if (!versionControl || !versionControl->vcsOpen(FilePath::fromString(file))) {
|
||||
bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser);
|
||||
if (!makeWritable) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
|
@@ -52,6 +52,8 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
Q_LOGGING_CATEGORY(documentManagerLog, "qtc.qtquickdesigner.documentmanager", QtWarningMsg)
|
||||
@@ -315,7 +317,7 @@ void DocumentManager::addFileToVersionControl(const QString &directoryPath, cons
|
||||
Core::VcsManager::msgPromptToAddToVcs(QStringList(newFilePath),
|
||||
versionControl),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (button == QMessageBox::Yes && !versionControl->vcsAdd(newFilePath)) {
|
||||
if (button == QMessageBox::Yes && !versionControl->vcsAdd(FilePath::fromString(newFilePath))) {
|
||||
Core::AsynchronousMessageBox::warning(Core::VcsManager::msgAddToVcsFailedTitle(),
|
||||
Core::VcsManager::msgToAddToVcsFailed(QStringList(newFilePath), versionControl));
|
||||
}
|
||||
|
@@ -224,7 +224,7 @@ public:
|
||||
Core::VcsManager::msgAddToVcsTitle(),
|
||||
Core::VcsManager::msgPromptToAddToVcs(QStringList(newFileName), versionControl),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (button == QMessageBox::Yes && !versionControl->vcsAdd(newFileName)) {
|
||||
if (button == QMessageBox::Yes && !versionControl->vcsAdd(FilePath::fromString(newFileName))) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(),
|
||||
Core::VcsManager::msgAddToVcsFailedTitle(),
|
||||
Core::VcsManager::msgToAddToVcsFailed(QStringList(newFileName),
|
||||
|
@@ -187,9 +187,9 @@ public:
|
||||
{ }
|
||||
|
||||
protected:
|
||||
QString trackFile(const QString &repository) override;
|
||||
FilePath trackFile(const FilePath &repository) override;
|
||||
|
||||
QString refreshTopic(const QString &repository) override;
|
||||
QString refreshTopic(const FilePath &repository) override;
|
||||
|
||||
private:
|
||||
SubversionPluginPrivate *m_plugin;
|
||||
@@ -206,21 +206,21 @@ public:
|
||||
// IVersionControl
|
||||
QString displayName() const final;
|
||||
Utils::Id id() const final;
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const FilePath &filePath) const final;
|
||||
|
||||
bool managesDirectory(const QString &directory, QString *topLevel) const final;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const final;
|
||||
bool managesDirectory(const FilePath &directory, FilePath *topLevel) const final;
|
||||
bool managesFile(const FilePath &workingDirectory, const QString &fileName) const final;
|
||||
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
bool vcsOpen(const QString &fileName) final;
|
||||
bool vcsAdd(const QString &fileName) final;
|
||||
bool vcsDelete(const QString &filename) final;
|
||||
bool vcsMove(const QString &from, const QString &to) final;
|
||||
bool vcsCreateRepository(const QString &directory) final;
|
||||
bool vcsOpen(const FilePath &filePath) final;
|
||||
bool vcsAdd(const FilePath &filePath) final;
|
||||
bool vcsDelete(const FilePath &filePath) final;
|
||||
bool vcsMove(const FilePath &from, const FilePath &to) final;
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
|
||||
void vcsAnnotate(const QString &file, int line) final;
|
||||
void vcsDescribe(const QString &source, const QString &changeNr) final;
|
||||
void vcsAnnotate(const FilePath &file, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &changeNr) final;
|
||||
|
||||
Core::ShellCommand *createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
@@ -967,13 +967,13 @@ void SubversionPluginPrivate::projectStatus()
|
||||
svnStatus(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::vcsDescribe(const QString &source, const QString &changeNr)
|
||||
void SubversionPluginPrivate::vcsDescribe(const FilePath &source, const QString &changeNr)
|
||||
{
|
||||
// To describe a complete change, find the top level and then do
|
||||
//svn diff -r 472958:472959 <top level>
|
||||
const QFileInfo fi(source);
|
||||
QString topLevel;
|
||||
const bool manages = managesDirectory(fi.isDir() ? source : fi.absolutePath(), &topLevel);
|
||||
const QFileInfo fi = source.toFileInfo();
|
||||
FilePath topLevel;
|
||||
const bool manages = managesDirectory(fi.isDir() ? source : FilePath::fromString(fi.absolutePath()), &topLevel);
|
||||
if (!manages || topLevel.isEmpty())
|
||||
return;
|
||||
if (Subversion::Constants::debug)
|
||||
@@ -987,7 +987,7 @@ void SubversionPluginPrivate::vcsDescribe(const QString &source, const QString &
|
||||
|
||||
const QString title = QString::fromLatin1("svn describe %1#%2").arg(fi.fileName(), changeNr);
|
||||
|
||||
m_client->describe(topLevel, number, title);
|
||||
m_client->describe(topLevel.toString(), number, title);
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::slotDescribe()
|
||||
@@ -1004,7 +1004,7 @@ void SubversionPluginPrivate::slotDescribe()
|
||||
return;
|
||||
|
||||
const int revision = inputDialog.intValue();
|
||||
vcsDescribe(state.topLevel(), QString::number(revision));
|
||||
vcsDescribe(FilePath::fromString(state.topLevel()), QString::number(revision));
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::commitFromEditor()
|
||||
@@ -1155,9 +1155,9 @@ bool SubversionPluginPrivate::vcsCheckout(const QString &directory, const QByteA
|
||||
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) const
|
||||
bool SubversionPluginPrivate::managesDirectory(const FilePath &directory, FilePath *topLevel /* = 0 */) const
|
||||
{
|
||||
const QDir dir(directory);
|
||||
const QDir dir(directory.toString());
|
||||
if (topLevel)
|
||||
topLevel->clear();
|
||||
|
||||
@@ -1168,7 +1168,7 @@ bool SubversionPluginPrivate::managesDirectory(const QString &directory, QString
|
||||
while (!parentDir.isRoot()) {
|
||||
if (checkSVNSubDir(parentDir)) {
|
||||
if (topLevel)
|
||||
*topLevel = parentDir.absolutePath();
|
||||
*topLevel = FilePath::fromString(parentDir.absolutePath());
|
||||
return true;
|
||||
}
|
||||
if (!parentDir.cdUp())
|
||||
@@ -1178,14 +1178,14 @@ bool SubversionPluginPrivate::managesDirectory(const QString &directory, QString
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool SubversionPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("status");
|
||||
args << SubversionClient::addAuthenticationOptions(m_settings)
|
||||
<< QDir::toNativeSeparators(SubversionClient::escapeFile(fileName));
|
||||
SubversionResponse response
|
||||
= runSvn(workingDirectory, args, m_settings.timeout.value(), 0);
|
||||
= runSvn(workingDirectory.toString(), args, m_settings.timeout.value(), 0);
|
||||
return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?');
|
||||
}
|
||||
|
||||
@@ -1214,9 +1214,9 @@ Utils::Id SubversionPluginPrivate::id() const
|
||||
return Utils::Id(VcsBase::Constants::VCS_ID_SUBVERSION);
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) const
|
||||
bool SubversionPluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
||||
{
|
||||
return isVcsDirectory(fileName);
|
||||
return isVcsDirectory(filePath);
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::isConfigured() const
|
||||
@@ -1246,39 +1246,39 @@ bool SubversionPluginPrivate::supportsOperation(Operation operation) const
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsOpen(const QString & /* fileName */)
|
||||
bool SubversionPluginPrivate::vcsOpen(const FilePath & /* filePath */)
|
||||
{
|
||||
// Open for edit: N/A
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsAdd(const QString &fileName)
|
||||
bool SubversionPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsDelete(const QString &fileName)
|
||||
bool SubversionPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsMove(const QString &from, const QString &to)
|
||||
bool SubversionPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo(from);
|
||||
const QFileInfo toInfo(to);
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsCreateRepository(const QString &)
|
||||
bool SubversionPluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::vcsAnnotate(const QString &file, int line)
|
||||
void SubversionPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
vcsAnnotateHelper(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
@@ -1298,14 +1298,14 @@ Core::ShellCommand *SubversionPluginPrivate::createInitialCheckoutCommand(const
|
||||
return command;
|
||||
}
|
||||
|
||||
QString SubversionTopicCache::trackFile(const QString &repository)
|
||||
FilePath SubversionTopicCache::trackFile(const FilePath &repository)
|
||||
{
|
||||
return m_plugin->monitorFile(repository);
|
||||
return FilePath::fromString(m_plugin->monitorFile(repository.toString()));
|
||||
}
|
||||
|
||||
QString SubversionTopicCache::refreshTopic(const QString &repository)
|
||||
QString SubversionTopicCache::refreshTopic(const FilePath &repository)
|
||||
{
|
||||
return m_plugin->synchronousTopic(repository);
|
||||
return m_plugin->synchronousTopic(repository.toString());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -52,7 +52,7 @@ namespace VcsBase {
|
||||
VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
|
||||
// Force copy, see QTCREATORBUG-13218
|
||||
const EditorWidgetCreator editorWidgetCreator,
|
||||
std::function<void(const QString &, const QString &)> describeFunc)
|
||||
std::function<void (const Utils::FilePath &, const QString &)> describeFunc)
|
||||
{
|
||||
setId(parameters->id);
|
||||
setDisplayName(QCoreApplication::translate("VCS", parameters->displayName));
|
||||
|
@@ -40,7 +40,7 @@ class VCSBASE_EXPORT VcsEditorFactory : public TextEditor::TextEditorFactory
|
||||
public:
|
||||
VcsEditorFactory(const VcsBaseEditorParameters *parameters,
|
||||
const EditorWidgetCreator editorWidgetCreator,
|
||||
std::function<void(const QString &, const QString &)> describeFunc);
|
||||
std::function<void(const Utils::FilePath &, const QString &)> describeFunc);
|
||||
};
|
||||
|
||||
} // namespace VcsBase
|
||||
|
@@ -329,7 +329,8 @@ QString ChangeTextCursorHandler::currentContents() const
|
||||
|
||||
void ChangeTextCursorHandler::slotDescribe()
|
||||
{
|
||||
emit editorWidget()->describeRequested(editorWidget()->source(), m_currentChange);
|
||||
emit editorWidget()->describeRequested(FilePath::fromString(editorWidget()->source()),
|
||||
m_currentChange);
|
||||
}
|
||||
|
||||
void ChangeTextCursorHandler::slotCopyRevision()
|
||||
|
@@ -157,7 +157,7 @@ protected:
|
||||
int lineNumberDigits() const override;
|
||||
|
||||
public:
|
||||
typedef std::function<void(const QString &, const QString &)> DescribeFunc;
|
||||
typedef std::function<void(const Utils::FilePath &, const QString &)> DescribeFunc;
|
||||
|
||||
void finalizeInitialization() override;
|
||||
// FIXME: Consolidate these into finalizeInitialization
|
||||
@@ -219,7 +219,7 @@ signals:
|
||||
// These signals also exist in the opaque editable (IEditor) that is
|
||||
// handled by the editor manager for convenience. They are emitted
|
||||
// for LogOutput/AnnotateOutput content types.
|
||||
void describeRequested(const QString &source, const QString &change);
|
||||
void describeRequested(const Utils::FilePath &source, const QString &change);
|
||||
void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
|
||||
const QString &change, int lineNumber);
|
||||
void diffChunkApplied(const VcsBase::DiffChunk &dc);
|
||||
|
@@ -241,7 +241,7 @@ QString StateListener::windowTitleVcsTopic(const QString &filePath)
|
||||
QString topLevelPath;
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(
|
||||
searchPath, &topLevelPath);
|
||||
return (vc && !topLevelPath.isEmpty()) ? vc->vcsTopic(topLevelPath) : QString();
|
||||
return (vc && !topLevelPath.isEmpty()) ? vc->vcsTopic(FilePath::fromString(topLevelPath)) : QString();
|
||||
}
|
||||
|
||||
static inline QString displayNameOfEditor(const QString &fileName)
|
||||
@@ -657,7 +657,7 @@ void VcsBasePluginPrivate::createRepository()
|
||||
return;
|
||||
} while (true);
|
||||
// Create
|
||||
const bool rc = vcsCreateRepository(directory);
|
||||
const bool rc = vcsCreateRepository(FilePath::fromString(directory));
|
||||
const QString nativeDir = QDir::toNativeSeparators(directory);
|
||||
if (rc) {
|
||||
QMessageBox::information(mw, tr("Repository Created"),
|
||||
|
@@ -34,6 +34,8 @@
|
||||
#include <QTextCursor>
|
||||
#include <QUrl>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsOutputLineParser::VcsOutputLineParser() :
|
||||
@@ -73,7 +75,7 @@ bool VcsOutputLineParser::handleVcsLink(const QString &workingDirectory, const Q
|
||||
return true;
|
||||
}
|
||||
if (IVersionControl *vcs = VcsManager::findVersionControlForDirectory(workingDirectory))
|
||||
return vcs->handleLink(workingDirectory, href);
|
||||
return vcs->handleLink(FilePath::fromString(workingDirectory), href);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,7 +91,7 @@ void VcsOutputLineParser::fillLinkContextMenu(
|
||||
return;
|
||||
}
|
||||
if (Core::IVersionControl *vcs = Core::VcsManager::findVersionControlForDirectory(workingDirectory))
|
||||
vcs->fillLinkContextMenu(menu, workingDirectory, href);
|
||||
vcs->fillLinkContextMenu(menu, FilePath::fromString(workingDirectory), href);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -52,6 +52,7 @@
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
namespace Internal {
|
||||
@@ -122,7 +123,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
QString topLevel;
|
||||
if (Project *project = ProjectTree::currentProject())
|
||||
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory().toString(), &topLevel);
|
||||
return vc ? vc->vcsTopic(topLevel) : QString();
|
||||
return vc ? vc->vcsTopic(FilePath::fromString(topLevel)) : QString();
|
||||
});
|
||||
|
||||
expander->registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
|
||||
|
Reference in New Issue
Block a user