1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "subversioncontrol.h"
35 #include "subversionplugin.h"
37 #include <QtCore/QFileInfo>
39 using namespace Subversion;
40 using namespace Subversion::Internal;
42 SubversionControl::SubversionControl(SubversionPlugin *plugin) :
48 QString SubversionControl::displayName() const
50 return QLatin1String("subversion");
53 bool SubversionControl::supportsOperation(Operation operation) const
60 case AnnotateOperation:
61 case CheckoutOperation:
62 case GetRepositoryRootOperation:
65 case CreateRepositoryOperation:
66 case SnapshotOperations:
73 bool SubversionControl::vcsOpen(const QString & /* fileName */)
79 bool SubversionControl::vcsAdd(const QString &fileName)
81 const QFileInfo fi(fileName);
82 return m_plugin->vcsAdd(fi.absolutePath(), fi.fileName());
85 bool SubversionControl::vcsDelete(const QString &fileName)
87 const QFileInfo fi(fileName);
88 return m_plugin->vcsDelete(fi.absolutePath(), fi.fileName());
91 bool SubversionControl::vcsMove(const QString &from, const QString &to)
93 const QFileInfo fromInfo(from);
94 const QFileInfo toInfo(to);
95 return m_plugin->vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
98 bool SubversionControl::vcsCheckout(const QString &directory, const QByteArray &url)
100 return m_plugin->vcsCheckout(directory, url);
103 QString SubversionControl::vcsGetRepositoryURL(const QString &directory)
105 return m_plugin->vcsGetRepositoryURL(directory);
108 bool SubversionControl::vcsCreateRepository(const QString &)
113 QString SubversionControl::vcsCreateSnapshot(const QString &)
118 QStringList SubversionControl::vcsSnapshots(const QString &)
120 return QStringList();
123 bool SubversionControl::vcsRestoreSnapshot(const QString &, const QString &)
128 bool SubversionControl::vcsRemoveSnapshot(const QString &, const QString &)
133 bool SubversionControl::managesDirectory(const QString &directory, QString *topLevel) const
135 return m_plugin->managesDirectory(directory, topLevel);
138 bool SubversionControl::vcsAnnotate(const QString &file, int line)
140 const QFileInfo fi(file);
141 m_plugin->vcsAnnotate(fi.absolutePath(), fi.fileName(), QString(), line);
145 void SubversionControl::emitRepositoryChanged(const QString &s)
147 emit repositoryChanged(s);
150 void SubversionControl::emitFilesChanged(const QStringList &l)
152 emit filesChanged(l);