1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include "subversioncontrol.h"
34 #include "subversionplugin.h"
36 #include <QtCore/QFileInfo>
38 using namespace Subversion;
39 using namespace Subversion::Internal;
41 SubversionControl::SubversionControl(SubversionPlugin *plugin) :
47 QString SubversionControl::displayName() const
49 return QLatin1String("subversion");
52 bool SubversionControl::supportsOperation(Operation operation) const
59 case AnnotateOperation:
60 case CheckoutOperation:
61 case GetRepositoryRootOperation:
64 case CreateRepositoryOperation:
65 case SnapshotOperations:
72 bool SubversionControl::vcsOpen(const QString & /* fileName */)
78 bool SubversionControl::vcsAdd(const QString &fileName)
80 const QFileInfo fi(fileName);
81 return m_plugin->vcsAdd(fi.absolutePath(), fi.fileName());
84 bool SubversionControl::vcsDelete(const QString &fileName)
86 const QFileInfo fi(fileName);
87 return m_plugin->vcsDelete(fi.absolutePath(), fi.fileName());
90 bool SubversionControl::vcsMove(const QString &from, const QString &to)
92 const QFileInfo fromInfo(from);
93 const QFileInfo toInfo(to);
94 return m_plugin->vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
97 bool SubversionControl::vcsCheckout(const QString &directory, const QByteArray &url)
99 return m_plugin->vcsCheckout(directory, url);
102 QString SubversionControl::vcsGetRepositoryURL(const QString &directory)
104 return m_plugin->vcsGetRepositoryURL(directory);
107 bool SubversionControl::vcsCreateRepository(const QString &)
112 QString SubversionControl::vcsCreateSnapshot(const QString &)
117 QStringList SubversionControl::vcsSnapshots(const QString &)
119 return QStringList();
122 bool SubversionControl::vcsRestoreSnapshot(const QString &, const QString &)
127 bool SubversionControl::vcsRemoveSnapshot(const QString &, const QString &)
132 bool SubversionControl::managesDirectory(const QString &directory, QString *topLevel) const
134 return m_plugin->managesDirectory(directory, topLevel);
137 bool SubversionControl::vcsAnnotate(const QString &file, int line)
139 const QFileInfo fi(file);
140 m_plugin->vcsAnnotate(fi.absolutePath(), fi.fileName(), QString(), line);
144 void SubversionControl::emitRepositoryChanged(const QString &s)
146 emit repositoryChanged(s);
149 void SubversionControl::emitFilesChanged(const QStringList &l)
151 emit filesChanged(l);