2009-07-15 12:28:40 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2009-07-15 12:28:40 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "cvscontrol.h"
|
|
|
|
|
#include "cvsplugin.h"
|
2011-04-15 16:02:44 +02:00
|
|
|
#include "cvssettings.h"
|
2009-07-15 12:28:40 +02:00
|
|
|
|
2009-12-09 12:41:10 +01:00
|
|
|
#include <QtCore/QFileInfo>
|
|
|
|
|
|
2009-07-15 12:28:40 +02:00
|
|
|
using namespace CVS;
|
|
|
|
|
using namespace CVS::Internal;
|
|
|
|
|
|
|
|
|
|
CVSControl::CVSControl(CVSPlugin *plugin) :
|
|
|
|
|
m_plugin(plugin)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString CVSControl::displayName() const
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
|
|
|
|
return QLatin1String("cvs");
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-15 16:02:44 +02:00
|
|
|
bool CVSControl::isConfigured() const
|
|
|
|
|
{
|
|
|
|
|
const QString binary = m_plugin->settings().cvsCommand;
|
|
|
|
|
if (binary.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
QFileInfo fi(binary);
|
|
|
|
|
return fi.exists() && fi.isFile() && fi.isExecutable();
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-15 12:28:40 +02:00
|
|
|
bool CVSControl::supportsOperation(Operation operation) const
|
|
|
|
|
{
|
2011-04-15 16:02:44 +02:00
|
|
|
bool rc = isConfigured();
|
2009-07-15 12:28:40 +02:00
|
|
|
switch (operation) {
|
|
|
|
|
case AddOperation:
|
|
|
|
|
case DeleteOperation:
|
2010-03-19 17:22:18 +01:00
|
|
|
case AnnotateOperation:
|
2010-08-06 16:12:24 +02:00
|
|
|
case OpenOperation:
|
2009-07-15 12:28:40 +02:00
|
|
|
break;
|
2010-05-11 14:13:38 +02:00
|
|
|
case MoveOperation:
|
2010-01-12 16:45:21 +01:00
|
|
|
case CreateRepositoryOperation:
|
2010-01-15 12:24:06 +01:00
|
|
|
case SnapshotOperations:
|
2010-09-29 12:16:35 +02:00
|
|
|
case CheckoutOperation:
|
|
|
|
|
case GetRepositoryRootOperation:
|
2009-07-15 12:28:40 +02:00
|
|
|
rc = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-06 16:12:24 +02:00
|
|
|
bool CVSControl::vcsOpen(const QString &fileName)
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
2010-08-06 16:12:24 +02:00
|
|
|
const QFileInfo fi(fileName);
|
|
|
|
|
return m_plugin->edit(fi.absolutePath(), QStringList(fi.fileName()));
|
2009-07-15 12:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CVSControl::vcsAdd(const QString &fileName)
|
|
|
|
|
{
|
2009-12-09 12:41:10 +01:00
|
|
|
const QFileInfo fi(fileName);
|
|
|
|
|
return m_plugin->vcsAdd(fi.absolutePath(), fi.fileName());
|
2009-07-15 12:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CVSControl::vcsDelete(const QString &fileName)
|
|
|
|
|
{
|
2009-12-09 12:41:10 +01:00
|
|
|
const QFileInfo fi(fileName);
|
|
|
|
|
return m_plugin->vcsDelete(fi.absolutePath(), fi.fileName());
|
2009-07-15 12:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
2010-05-11 14:13:38 +02:00
|
|
|
bool CVSControl::vcsMove(const QString &from, const QString &to)
|
|
|
|
|
{
|
2010-05-12 16:26:47 +02:00
|
|
|
Q_UNUSED(from);
|
|
|
|
|
Q_UNUSED(to);
|
2010-05-11 14:13:38 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-12 16:45:21 +01:00
|
|
|
bool CVSControl::vcsCreateRepository(const QString &)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-29 12:16:35 +02:00
|
|
|
QString CVSControl::vcsGetRepositoryURL(const QString &)
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-29 12:16:37 +02:00
|
|
|
bool CVSControl::vcsCheckout(const QString &, const QByteArray &)
|
2010-09-29 12:16:35 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-15 12:24:06 +01:00
|
|
|
QString CVSControl::vcsCreateSnapshot(const QString &)
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList CVSControl::vcsSnapshots(const QString &)
|
|
|
|
|
{
|
|
|
|
|
return QStringList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CVSControl::vcsRestoreSnapshot(const QString &, const QString &)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CVSControl::vcsRemoveSnapshot(const QString &, const QString &)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-19 17:22:18 +01:00
|
|
|
bool CVSControl::vcsAnnotate(const QString &file, int line)
|
|
|
|
|
{
|
|
|
|
|
m_plugin->vcsAnnotate(file, QString(), line);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-20 16:24:39 +02:00
|
|
|
bool CVSControl::managesDirectory(const QString &directory, QString *topLevel) const
|
2009-07-15 12:28:40 +02:00
|
|
|
{
|
2010-05-20 16:24:39 +02:00
|
|
|
return m_plugin->managesDirectory(directory, topLevel);
|
2009-07-15 12:28:40 +02:00
|
|
|
}
|
2009-11-11 14:32:54 +01:00
|
|
|
|
|
|
|
|
void CVSControl::emitRepositoryChanged(const QString &s)
|
|
|
|
|
{
|
|
|
|
|
emit repositoryChanged(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CVSControl::emitFilesChanged(const QStringList &l)
|
|
|
|
|
{
|
|
|
|
|
emit filesChanged(l);
|
|
|
|
|
}
|