summaryrefslogtreecommitdiff
path: root/src/plugins/bazaar
diff options
context:
space:
mode:
authorcerf <delorme.hugues@gmail.com>2011-02-28 13:40:06 +0100
committerTobias Hunger <tobias.hunger@nokia.com>2011-02-28 16:08:38 +0100
commitf9bb4c59dc75c32e4162d02141eaf1602fbda4c8 (patch)
tree0d92ab58088bec3dc01f1a2cbd6b63e4c48c10b7 /src/plugins/bazaar
parent6c1dd96f121568773814190cf260ed01f5a88c88 (diff)
downloadqt-creator-f9bb4c59dc75c32e4162d02141eaf1602fbda4c8.tar.gz
Added new Bazaar plugin
Merge-request: 229 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/bazaar')
-rw-r--r--src/plugins/bazaar/Bazaar.pluginspec.in22
-rw-r--r--src/plugins/bazaar/annotationhighlighter.cpp52
-rw-r--r--src/plugins/bazaar/annotationhighlighter.h56
-rw-r--r--src/plugins/bazaar/bazaar.pro42
-rw-r--r--src/plugins/bazaar/bazaar.qrc5
-rw-r--r--src/plugins/bazaar/bazaar_dependencies.pri5
-rw-r--r--src/plugins/bazaar/bazaarclient.cpp401
-rw-r--r--src/plugins/bazaar/bazaarclient.h110
-rw-r--r--src/plugins/bazaar/bazaarcommitpanel.ui114
-rw-r--r--src/plugins/bazaar/bazaarcommitwidget.cpp165
-rw-r--r--src/plugins/bazaar/bazaarcommitwidget.h71
-rw-r--r--src/plugins/bazaar/bazaarcontrol.cpp166
-rw-r--r--src/plugins/bazaar/bazaarcontrol.h85
-rw-r--r--src/plugins/bazaar/bazaareditor.cpp119
-rw-r--r--src/plugins/bazaar/bazaareditor.h66
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp678
-rw-r--r--src/plugins/bazaar/bazaarplugin.h172
-rw-r--r--src/plugins/bazaar/bazaarsettings.cpp52
-rw-r--r--src/plugins/bazaar/bazaarsettings.h52
-rw-r--r--src/plugins/bazaar/branchinfo.cpp46
-rw-r--r--src/plugins/bazaar/branchinfo.h53
-rw-r--r--src/plugins/bazaar/cloneoptionspanel.cpp95
-rw-r--r--src/plugins/bazaar/cloneoptionspanel.h69
-rw-r--r--src/plugins/bazaar/cloneoptionspanel.ui137
-rw-r--r--src/plugins/bazaar/clonewizard.cpp108
-rw-r--r--src/plugins/bazaar/clonewizard.h66
-rw-r--r--src/plugins/bazaar/clonewizardpage.cpp70
-rw-r--r--src/plugins/bazaar/clonewizardpage.h58
-rw-r--r--src/plugins/bazaar/commiteditor.cpp80
-rw-r--r--src/plugins/bazaar/commiteditor.h70
-rw-r--r--src/plugins/bazaar/constants.h111
-rw-r--r--src/plugins/bazaar/images/bazaar.pngbin0 -> 10551 bytes
-rw-r--r--src/plugins/bazaar/optionspage.cpp139
-rw-r--r--src/plugins/bazaar/optionspage.h90
-rw-r--r--src/plugins/bazaar/optionspage.ui158
-rw-r--r--src/plugins/bazaar/pullorpushdialog.cpp122
-rw-r--r--src/plugins/bazaar/pullorpushdialog.h81
-rw-r--r--src/plugins/bazaar/pullorpushdialog.ui274
-rw-r--r--src/plugins/bazaar/revertdialog.ui99
39 files changed, 4359 insertions, 0 deletions
diff --git a/src/plugins/bazaar/Bazaar.pluginspec.in b/src/plugins/bazaar/Bazaar.pluginspec.in
new file mode 100644
index 0000000000..4141be4748
--- /dev/null
+++ b/src/plugins/bazaar/Bazaar.pluginspec.in
@@ -0,0 +1,22 @@
+<plugin name=\"Bazaar\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
+ <vendor>Hugues Delorme</vendor>
+ <copyright>(C) 2010-2011 Hugues Delorme</copyright>
+ <license>
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
+
+GNU Lesser General Public License Usage
+
+Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. 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.
+ </license>
+ <category>Version Control</category>
+ <description>Bazaar integration.</description>
+ <url>http://qt.nokia.com</url>
+ <dependencyList>
+ <dependency name=\"TextEditor\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"ProjectExplorer\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"Core\" version=\"$$QTCREATOR_VERSION\"/>
+ <dependency name=\"VCSBase\" version=\"$$QTCREATOR_VERSION\"/>
+ </dependencyList>
+</plugin>
diff --git a/src/plugins/bazaar/annotationhighlighter.cpp b/src/plugins/bazaar/annotationhighlighter.cpp
new file mode 100644
index 0000000000..111daff29e
--- /dev/null
+++ b/src/plugins/bazaar/annotationhighlighter.cpp
@@ -0,0 +1,52 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "annotationhighlighter.h"
+#include "constants.h"
+
+using namespace Bazaar::Internal;
+using namespace Bazaar;
+
+BazaarAnnotationHighlighter::BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ QTextDocument *document)
+ : VCSBase::BaseAnnotationHighlighter(changeNumbers, document),
+ m_changeset(QLatin1String(Constants::CHANGESETID12))
+{
+}
+
+QString BazaarAnnotationHighlighter::changeNumber(const QString &block) const
+{
+ if (m_changeset.indexIn(block) != -1)
+ return m_changeset.cap(1);
+ return QString();
+}
diff --git a/src/plugins/bazaar/annotationhighlighter.h b/src/plugins/bazaar/annotationhighlighter.h
new file mode 100644
index 0000000000..0030a2d43f
--- /dev/null
+++ b/src/plugins/bazaar/annotationhighlighter.h
@@ -0,0 +1,56 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef ANNOTATIONHIGHLIGHTER_H
+#define ANNOTATIONHIGHLIGHTER_H
+
+#include <vcsbase/baseannotationhighlighter.h>
+#include <QtCore/QRegExp>
+
+namespace Bazaar {
+namespace Internal {
+
+class BazaarAnnotationHighlighter : public VCSBase::BaseAnnotationHighlighter
+{
+public:
+ explicit BazaarAnnotationHighlighter(const ChangeNumbers &changeNumbers,
+ QTextDocument *document = 0);
+
+private:
+ virtual QString changeNumber(const QString &block) const;
+ QRegExp m_changeset;
+};
+
+} //namespace Internal
+}// namespace Bazaar
+#endif // ANNOTATIONHIGHLIGHTER_H
diff --git a/src/plugins/bazaar/bazaar.pro b/src/plugins/bazaar/bazaar.pro
new file mode 100644
index 0000000000..895f50473d
--- /dev/null
+++ b/src/plugins/bazaar/bazaar.pro
@@ -0,0 +1,42 @@
+TARGET = Bazaar
+TEMPLATE = lib
+include(../../qtcreatorplugin.pri)
+include(bazaar_dependencies.pri)
+SOURCES += \
+ bazaarclient.cpp \
+ bazaarcontrol.cpp \
+ bazaarplugin.cpp \
+ optionspage.cpp \
+ bazaarsettings.cpp \
+ commiteditor.cpp \
+ bazaarcommitwidget.cpp \
+ bazaareditor.cpp \
+ annotationhighlighter.cpp \
+ pullorpushdialog.cpp \
+ branchinfo.cpp \
+ clonewizardpage.cpp \
+ clonewizard.cpp \
+ cloneoptionspanel.cpp
+HEADERS += \
+ bazaarclient.h \
+ constants.h \
+ bazaarcontrol.h \
+ bazaarplugin.h \
+ optionspage.h \
+ bazaarsettings.h \
+ commiteditor.h \
+ bazaarcommitwidget.h \
+ bazaareditor.h \
+ annotationhighlighter.h \
+ pullorpushdialog.h \
+ branchinfo.h \
+ clonewizard.h \
+ clonewizardpage.h \
+ cloneoptionspanel.h
+FORMS += \
+ optionspage.ui \
+ revertdialog.ui \
+ bazaarcommitpanel.ui \
+ pullorpushdialog.ui \
+ cloneoptionspanel.ui
+RESOURCES += bazaar.qrc
diff --git a/src/plugins/bazaar/bazaar.qrc b/src/plugins/bazaar/bazaar.qrc
new file mode 100644
index 0000000000..a10bfb3194
--- /dev/null
+++ b/src/plugins/bazaar/bazaar.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/bazaar" >
+ <file>images/bazaar.png</file>
+ </qresource>
+</RCC>
diff --git a/src/plugins/bazaar/bazaar_dependencies.pri b/src/plugins/bazaar/bazaar_dependencies.pri
new file mode 100644
index 0000000000..9e7c28e9e1
--- /dev/null
+++ b/src/plugins/bazaar/bazaar_dependencies.pri
@@ -0,0 +1,5 @@
+include(../../plugins/projectexplorer/projectexplorer.pri)
+include(../../plugins/texteditor/texteditor.pri)
+include(../../plugins/coreplugin/coreplugin.pri)
+include(../../plugins/vcsbase/vcsbase.pri)
+include(../../libs/utils/utils.pri)
diff --git a/src/plugins/bazaar/bazaarclient.cpp b/src/plugins/bazaar/bazaarclient.cpp
new file mode 100644
index 0000000000..30b0119e60
--- /dev/null
+++ b/src/plugins/bazaar/bazaarclient.cpp
@@ -0,0 +1,401 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "bazaarclient.h"
+#include "constants.h"
+
+#include <vcsbase/vcsbaseplugin.h>
+#include <QDir>
+#include <QFileInfo>
+#include <QTextStream>
+
+#include <QtDebug>
+
+namespace {
+
+void addBoolArgument(const QVariant &optionValue,
+ const QString &optionName,
+ QStringList *arguments)
+{
+ if (arguments == 0)
+ return;
+ Q_ASSERT(optionValue.canConvert(QVariant::Bool));
+ if (optionValue.toBool())
+ arguments->append(optionName);
+}
+
+void addRevisionArgument(const QVariant &optionValue, QStringList *arguments)
+{
+ if (arguments == 0)
+ return;
+ Q_ASSERT(optionValue.canConvert(QVariant::String));
+ const QString revision = optionValue.toString();
+ if (!revision.isEmpty())
+ (*arguments) << QLatin1String("-r") << revision;
+}
+
+} // Anonymous namespace
+
+namespace Bazaar {
+namespace Internal {
+
+BazaarClient::BazaarClient(const VCSBase::VCSBaseClientSettings &settings) :
+ VCSBase::VCSBaseClient(settings)
+{
+}
+
+BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) const
+{
+ QFile branchConfFile(repositoryRoot + QDir::separator() +
+ QLatin1String(Constants::BAZAARREPO) +
+ QLatin1String("/branch/branch.conf"));
+ if (!branchConfFile.open(QIODevice::ReadOnly))
+ return BranchInfo(QString(), false);
+
+ QTextStream ts(&branchConfFile);
+ QString branchLocation;
+ QString isBranchBound;
+ const QRegExp branchLocationRx("bound_location\\s*=\\s*(.+)$");
+ const QRegExp isBranchBoundRx("bound\\s*=\\s*(.+)$");
+ while (!ts.atEnd() && (branchLocation.isEmpty() || isBranchBound.isEmpty())) {
+ const QString line = ts.readLine();
+ if (branchLocationRx.indexIn(line) != -1)
+ branchLocation = branchLocationRx.cap(1);
+ else if (isBranchBoundRx.indexIn(line) != -1)
+ isBranchBound = isBranchBoundRx.cap(1);
+ }
+ if (isBranchBound.simplified().toLower() == QLatin1String("true"))
+ return BranchInfo(branchLocation, true);
+ return BranchInfo(repositoryRoot, false);
+}
+
+QString BazaarClient::findTopLevelForFile(const QFileInfo &file) const
+{
+ const QString repositoryCheckFile =
+ QLatin1String(Constants::BAZAARREPO) + QLatin1String("/branch-format");
+ return file.isDir() ?
+ VCSBase::VCSBasePlugin::findRepositoryForDirectory(file.absoluteFilePath(),
+ repositoryCheckFile) :
+ VCSBase::VCSBasePlugin::findRepositoryForDirectory(file.absolutePath(),
+ repositoryCheckFile);
+}
+
+QString BazaarClient::vcsEditorKind(VCSCommand cmd) const
+{
+ switch(cmd) {
+ case AnnotateCommand : return QLatin1String(Constants::ANNOTATELOG);
+ case DiffCommand : return QLatin1String(Constants::DIFFLOG);
+ case LogCommand : return QLatin1String(Constants::FILELOG);
+ default : return QLatin1String("");
+ }
+ return QLatin1String("");
+}
+
+QStringList BazaarClient::cloneArguments(const QString &srcLocation,
+ const QString &dstLocation,
+ const ExtraCommandOptions &extraOptions) const
+{
+ QStringList args;
+ // Fetch extra options
+ foreach (int iOption, extraOptions.keys()) {
+ const QVariant iOptValue = extraOptions[iOption];
+ switch (iOption) {
+ case UseExistingDirCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--use-existing-dir"), &args);
+ break;
+ case StackedCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--stacked"), &args);
+ break;
+ case StandAloneCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--standalone"), &args);
+ break;
+ case BindCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--bind"), &args);
+ break;
+ case SwitchCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--switch"), &args);
+ break;
+ case HardLinkCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--hardlink"), &args);
+ break;
+ case NoTreeCloneOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--no-tree"), &args);
+ break;
+ case RevisionCloneOptionId :
+ ::addRevisionArgument(iOptValue, &args);
+ break;
+ default :
+ Q_ASSERT(false); // Invalid option !
+ }
+ } // end foreach ()
+ // Add arguments for common options
+ args << srcLocation;
+ if (!dstLocation.isEmpty())
+ args << dstLocation;
+ return args;
+}
+
+QStringList BazaarClient::pullArguments(const QString &srcLocation,
+ const ExtraCommandOptions &extraOptions) const
+{
+ // Fetch extra options
+ QStringList args(commonPullOrPushArguments(extraOptions));
+ foreach (int iOption, extraOptions.keys()) {
+ const QVariant iOptValue = extraOptions[iOption];
+ switch (iOption) {
+ case RememberPullOrPushOptionId : break;
+ case OverwritePullOrPushOptionId : break;
+ case RevisionPullOrPushOptionId : break;
+ case LocalPullOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--local"), &args);
+ break;
+ default :
+ Q_ASSERT(false); // Invalid option !
+ }
+ } // end foreach ()
+ // Add arguments for common options
+ if (!srcLocation.isEmpty())
+ args << srcLocation;
+ return args;
+}
+
+QStringList BazaarClient::pushArguments(const QString &dstLocation,
+ const ExtraCommandOptions &extraOptions) const
+{
+ // Fetch extra options
+ QStringList args(commonPullOrPushArguments(extraOptions));
+ foreach (int iOption, extraOptions.keys()) {
+ const QVariant iOptValue = extraOptions[iOption];
+ switch (iOption) {
+ case RememberPullOrPushOptionId : break;
+ case OverwritePullOrPushOptionId : break;
+ case RevisionPullOrPushOptionId : break;
+ case UseExistingDirPushOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--use-existing-dir"), &args);
+ break;
+ case CreatePrefixPushOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--create-prefix"), &args);
+ break;
+ default :
+ Q_ASSERT(false); // Invalid option !
+ }
+ } // end foreach ()
+ // Add arguments for common options
+ if (!dstLocation.isEmpty())
+ args << dstLocation;
+ return args;
+}
+
+QStringList BazaarClient::commitArguments(const QStringList &files,
+ const QString &commitMessageFile,
+ const ExtraCommandOptions &extraOptions) const
+{
+ QStringList args;
+ // Fetch extra options
+ foreach (int iOption, extraOptions.keys()) {
+ const QVariant iOptValue = extraOptions[iOption];
+ switch (iOption) {
+ case AuthorCommitOptionId :
+ {
+ Q_ASSERT(iOptValue.canConvert(QVariant::String));
+ const QString committerInfo = iOptValue.toString();
+ if (!committerInfo.isEmpty())
+ args << QString("--author=%1").arg(committerInfo);
+ break;
+ }
+ case FixesCommitOptionId :
+ {
+ Q_ASSERT(iOptValue.canConvert(QVariant::StringList));
+ foreach (const QString& iFix, iOptValue.toStringList()) {
+ if (!iFix.isEmpty())
+ args << QLatin1String("--fixes") << iFix;
+ }
+ break;
+ }
+ case LocalCommitOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--local"), &args);
+ break;
+ default :
+ Q_ASSERT(false); // Invalid option !
+ }
+ } // end foreach ()
+ // Add arguments for common options
+ args << QLatin1String("-F") << commitMessageFile;
+ args << files;
+ return args;
+}
+
+QStringList BazaarClient::importArguments(const QStringList &files) const
+{
+ QStringList args;
+ if (!files.isEmpty())
+ args.append(files);
+ return args;
+}
+
+QStringList BazaarClient::updateArguments(const QString &revision) const
+{
+ QStringList args;
+ if (!revision.isEmpty())
+ args << QLatin1String("-r") << revision;
+ return args;
+}
+
+QStringList BazaarClient::revertArguments(const QString &file,
+ const QString &revision) const
+{
+ QStringList args;
+ if (!revision.isEmpty())
+ args << QLatin1String("-r") << revision;
+ if (!file.isEmpty())
+ args << file;
+ return args;
+}
+
+QStringList BazaarClient::revertAllArguments(const QString &revision) const
+{
+ QStringList args;
+ if (!revision.isEmpty())
+ args << QLatin1String("-r") << revision;
+ return args;
+}
+
+QStringList BazaarClient::annotateArguments(const QString &file,
+ const QString &revision,
+ int lineNumber) const
+{
+ Q_UNUSED(lineNumber);
+ QStringList args(QLatin1String("--long"));
+ if (!revision.isEmpty())
+ args << QLatin1String("-r") << revision;
+ return args << file;
+}
+
+QStringList BazaarClient::diffArguments(const QStringList &files) const
+{
+ QStringList args;
+ if (!files.isEmpty())
+ args.append(files);
+ return args;
+}
+
+QStringList BazaarClient::logArguments(const QStringList &files) const
+{
+ return diffArguments(files);
+}
+
+QStringList BazaarClient::statusArguments(const QString &file) const
+{
+ QStringList args;
+ args.append(QLatin1String("--short"));
+ if (!file.isEmpty())
+ args.append(file);
+ return args;
+}
+
+QStringList BazaarClient::viewArguments(const QString &revision) const
+{
+ QStringList args(QLatin1String("log"));
+ args << QLatin1String("-p") << QLatin1String("--gnu-changelog")
+ << QLatin1String("-r") << revision;
+ return args;
+}
+
+QPair<QString, QString> BazaarClient::parseStatusLine(const QString &line) const
+{
+ QPair<QString, QString> status;
+ if (!line.isEmpty()) {
+ const QChar flagVersion = line[0];
+ if (flagVersion == QLatin1Char('+'))
+ status.first = QLatin1String("Versioned");
+ else if (flagVersion == QLatin1Char('-'))
+ status.first = QLatin1String("Unversioned");
+ else if (flagVersion == QLatin1Char('R'))
+ status.first = QLatin1String("Renamed");
+ else if (flagVersion == QLatin1Char('?'))
+ status.first = QLatin1String("Unknown");
+ else if (flagVersion == QLatin1Char('X'))
+ status.first = QLatin1String("Nonexistent");
+ else if (flagVersion == QLatin1Char('C'))
+ status.first = QLatin1String("Conflict");
+ else if (flagVersion == QLatin1Char('P'))
+ status.first = QLatin1String("PendingMerge");
+
+ const int lineLength = line.length();
+ if (lineLength >= 2) {
+ const QChar flagContents = line[1];
+ if (flagContents == QLatin1Char('N'))
+ status.first = QLatin1String("Created");
+ else if (flagContents == QLatin1Char('D'))
+ status.first = QLatin1String("Deleted");
+ else if (flagContents == QLatin1Char('K'))
+ status.first = QLatin1String("KindChanged");
+ else if (flagContents == QLatin1Char('M'))
+ status.first = QLatin1String("Modified");
+ }
+ if (lineLength >= 3) {
+ const QChar flagExec = line[2];
+ if (flagExec == QLatin1Char('*'))
+ status.first = QLatin1String("ExecuteBitChanged");
+ }
+ // The status string should be similar to "xxx file_with_changes"
+ // so just should take the file name part and store it
+ status.second = line.mid(4);
+ }
+ return status;
+}
+
+QStringList BazaarClient::commonPullOrPushArguments(const ExtraCommandOptions &extraOptions) const
+{
+ QStringList args;
+ foreach (int iOption, extraOptions.keys()) {
+ const QVariant iOptValue = extraOptions[iOption];
+ switch (iOption) {
+ case RememberPullOrPushOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--remember"), &args);
+ break;
+ case OverwritePullOrPushOptionId :
+ ::addBoolArgument(iOptValue, QLatin1String("--overwrite"), &args);
+ break;
+ case RevisionPullOrPushOptionId :
+ ::addRevisionArgument(iOptValue, &args);
+ break;
+ default :
+ break; // Unknown option, do nothing
+ }
+ } // end foreach ()
+ return args;
+}
+
+} //namespace Internal
+} // namespace Bazaar
diff --git a/src/plugins/bazaar/bazaarclient.h b/src/plugins/bazaar/bazaarclient.h
new file mode 100644
index 0000000000..93133f98fb
--- /dev/null
+++ b/src/plugins/bazaar/bazaarclient.h
@@ -0,0 +1,110 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAARCLIENT_H
+#define BAZAARCLIENT_H
+
+#include "branchinfo.h"
+#include <vcsbase/vcsbaseclient.h>
+
+namespace Bazaar {
+namespace Internal {
+
+class BazaarClient : public VCSBase::VCSBaseClient
+{
+public:
+ enum ExtraOptionId
+ {
+ // Clone
+ UseExistingDirCloneOptionId,
+ StackedCloneOptionId,
+ StandAloneCloneOptionId,
+ BindCloneOptionId,
+ SwitchCloneOptionId,
+ HardLinkCloneOptionId,
+ NoTreeCloneOptionId,
+ RevisionCloneOptionId,
+ // Commit
+ AuthorCommitOptionId,
+ FixesCommitOptionId,
+ LocalCommitOptionId,
+ // Pull or push (common options)
+ RememberPullOrPushOptionId,
+ OverwritePullOrPushOptionId,
+ RevisionPullOrPushOptionId,
+ // Pull only
+ LocalPullOptionId,
+ // Push only
+ UseExistingDirPushOptionId,
+ CreatePrefixPushOptionId
+ };
+
+ BazaarClient(const VCSBase::VCSBaseClientSettings &settings);
+
+ BranchInfo synchronousBranchQuery(const QString &repositoryRoot) const;
+ virtual QString findTopLevelForFile(const QFileInfo &file) const;
+
+protected:
+ virtual QString vcsEditorKind(VCSCommand cmd) const;
+
+ virtual QStringList cloneArguments(const QString &srcLocation,
+ const QString &dstLocation,
+ const ExtraCommandOptions &extraOptions) const;
+ virtual QStringList pullArguments(const QString &srcLocation,
+ const ExtraCommandOptions &extraOptions) const;
+ virtual QStringList pushArguments(const QString &dstLocation,
+ const ExtraCommandOptions &extraOptions) const;
+ virtual QStringList commitArguments(const QStringList &files,
+ const QString &commitMessageFile,
+ const ExtraCommandOptions &extraOptions) const;
+ virtual QStringList importArguments(const QStringList &files) const;
+ virtual QStringList updateArguments(const QString &revision) const;
+ virtual QStringList revertArguments(const QString &file, const QString &revision) const;
+ virtual QStringList revertAllArguments(const QString &revision) const;
+ virtual QStringList annotateArguments(const QString &file,
+ const QString &revision, int lineNumber) const;
+ virtual QStringList diffArguments(const QStringList &files) const;
+ virtual QStringList logArguments(const QStringList &files) const;
+ virtual QStringList statusArguments(const QString &file) const;
+ virtual QStringList viewArguments(const QString &revision) const;
+
+ virtual QPair<QString, QString> parseStatusLine(const QString &line) const;
+private:
+ QStringList commonPullOrPushArguments(const ExtraCommandOptions &extraOptions) const;
+ friend class CloneWizard;
+};
+
+} //namespace Internal
+} // namespace Bazaar
+
+#endif // BAZAARCLIENT_H
diff --git a/src/plugins/bazaar/bazaarcommitpanel.ui b/src/plugins/bazaar/bazaarcommitpanel.ui
new file mode 100644
index 0000000000..dc07abe9e9
--- /dev/null
+++ b/src/plugins/bazaar/bazaarcommitpanel.ui
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Bazaar::Internal::BazaarCommitPanel</class>
+ <widget class="QWidget" name="Bazaar::Internal::BazaarCommitPanel">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>374</width>
+ <height>229</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="infoGroup">
+ <property name="title">
+ <string>General Information</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <item row="1" column="0">
+ <widget class="QLabel" name="branchLabel">
+ <property name="text">
+ <string>Branch:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="branchLineEdit">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="isLocalCheckBox">
+ <property name="toolTip">
+ <string>Perform a local commit in a bound branch.
+Local commits are not pushed to the master branch until a normal commit is performed</string>
+ </property>
+ <property name="text">
+ <string>Local commit</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="editGroup">
+ <property name="title">
+ <string>Commit Information</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="authorLabel">
+ <property name="text">
+ <string>Author:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="authorLineEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="emailLabel">
+ <property name="text">
+ <string>Email:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="emailLineEdit"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="fixedBugsLabel">
+ <property name="text">
+ <string>Fixed bugs:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="fixedBugsLineEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>161</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/bazaar/bazaarcommitwidget.cpp b/src/plugins/bazaar/bazaarcommitwidget.cpp
new file mode 100644
index 0000000000..b6890b50f8
--- /dev/null
+++ b/src/plugins/bazaar/bazaarcommitwidget.cpp
@@ -0,0 +1,165 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "bazaarcommitwidget.h"
+#include "branchinfo.h"
+
+#include <texteditor/texteditorsettings.h>
+#include <texteditor/fontsettings.h>
+#include <texteditor/texteditorconstants.h>
+
+#include <QtGui/QSyntaxHighlighter>
+#include <QtGui/QTextEdit>
+
+#include <QtCore/QDebug>
+#include <QtCore/QRegExp>
+
+//see the git submit widget for details of the syntax Highlighter
+
+//TODO Check to see when the Highlighter has been moved to a base class and use that instead
+
+namespace Bazaar {
+namespace Internal {
+
+// Retrieve the comment char format from the text editor.
+static QTextCharFormat commentFormat()
+{
+ const TextEditor::FontSettings settings = TextEditor::TextEditorSettings::instance()->fontSettings();
+ return settings.toTextCharFormat(QLatin1String(TextEditor::Constants::C_COMMENT));
+}
+
+// Highlighter for Bazaar submit messages. Make the first line bold, indicates
+// comments as such (retrieving the format from the text editor) and marks up
+// keywords (words in front of a colon as in 'Task: <bla>').
+class BazaarSubmitHighlighter : QSyntaxHighlighter
+{
+public:
+ explicit BazaarSubmitHighlighter(QTextEdit *parent);
+ virtual void highlightBlock(const QString &text);
+
+private:
+ enum State { Header, Comment, Other };
+ const QTextCharFormat m_commentFormat;
+ const QRegExp m_keywordPattern;
+ const QChar m_hashChar;
+};
+
+BazaarSubmitHighlighter::BazaarSubmitHighlighter(QTextEdit * parent) :
+ QSyntaxHighlighter(parent),
+ m_commentFormat(commentFormat()),
+ m_keywordPattern(QLatin1String("^\\w+:")),
+ m_hashChar(QLatin1Char('#'))
+{
+ Q_ASSERT(m_keywordPattern.isValid());
+}
+
+void BazaarSubmitHighlighter::highlightBlock(const QString &text)
+{
+ // figure out current state
+ State state = Other;
+ const QTextBlock block = currentBlock();
+ if (block.position() == 0) {
+ state = Header;
+ } else {
+ if (text.startsWith(m_hashChar))
+ state = Comment;
+ }
+ // Apply format.
+ switch (state) {
+ case Header: {
+ QTextCharFormat charFormat = format(0);
+ charFormat.setFontWeight(QFont::Bold);
+ setFormat(0, text.size(), charFormat);
+ }
+ break;
+ case Comment:
+ setFormat(0, text.size(), m_commentFormat);
+ break;
+ case Other:
+ // Format key words ("Task:") italic
+ if (m_keywordPattern.indexIn(text, 0, QRegExp::CaretAtZero) == 0) {
+ QTextCharFormat charFormat = format(0);
+ charFormat.setFontItalic(true);
+ setFormat(0, m_keywordPattern.matchedLength(), charFormat);
+ }
+ break;
+ }
+}
+
+
+BazaarCommitWidget::BazaarCommitWidget(QWidget *parent) :
+ Utils::SubmitEditorWidget(parent),
+ m_bazaarCommitPanel(new QWidget)
+{
+ m_bazaarCommitPanelUi.setupUi(m_bazaarCommitPanel);
+ insertTopWidget(m_bazaarCommitPanel);
+ new BazaarSubmitHighlighter(descriptionEdit());
+}
+
+void BazaarCommitWidget::setFields(const BranchInfo &branch,
+ const QString &userName, const QString &email)
+{
+ m_bazaarCommitPanelUi.branchLineEdit->setText(branch.branchLocation);
+ m_bazaarCommitPanelUi.isLocalCheckBox->setVisible(branch.isBoundToBranch);
+ m_bazaarCommitPanelUi.authorLineEdit->setText(userName);
+ m_bazaarCommitPanelUi.emailLineEdit->setText(email);
+}
+
+QString BazaarCommitWidget::committer() const
+{
+ const QString author = m_bazaarCommitPanelUi.authorLineEdit->text();
+ const QString email = m_bazaarCommitPanelUi.emailLineEdit->text();
+ if (author.isEmpty())
+ return QString();
+
+ QString user = author;
+ if (!email.isEmpty()) {
+ user += QLatin1String(" <");
+ user += email;
+ user += QLatin1Char('>');
+ }
+ return user;
+}
+
+QStringList BazaarCommitWidget::fixedBugs() const
+{
+ return m_bazaarCommitPanelUi.fixedBugsLineEdit->text().split(QRegExp("\\s+"));
+}
+
+bool BazaarCommitWidget::isLocalOptionEnabled() const
+{
+ return m_bazaarCommitPanelUi.isLocalCheckBox->isChecked();
+}
+
+} // namespace Internal
+} // namespace Bazaar
diff --git a/src/plugins/bazaar/bazaarcommitwidget.h b/src/plugins/bazaar/bazaarcommitwidget.h
new file mode 100644
index 0000000000..bda0a6df0a
--- /dev/null
+++ b/src/plugins/bazaar/bazaarcommitwidget.h
@@ -0,0 +1,71 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAARCOMMITWIDGET_H
+#define BAZAARCOMMITWIDGET_H
+
+#include "ui_bazaarcommitpanel.h"
+
+#include <utils/submiteditorwidget.h>
+
+namespace Bazaar {
+namespace Internal {
+
+class BranchInfo;
+
+/*submit editor widget based on git SubmitEditor
+ Some extra fields have been added to the standard SubmitEditorWidget,
+ to help to conform to the commit style that is used by both git and Bazaar*/
+
+class BazaarCommitWidget : public Utils::SubmitEditorWidget
+{
+
+public:
+ explicit BazaarCommitWidget(QWidget *parent = 0);
+
+ void setFields(const BranchInfo &branch,
+ const QString &userName, const QString &email);
+
+ QString committer() const;
+ QStringList fixedBugs() const;
+ bool isLocalOptionEnabled() const;
+
+private:
+ QWidget *m_bazaarCommitPanel;
+ Ui::BazaarCommitPanel m_bazaarCommitPanelUi;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // BAZAARCOMMITWIDGET_H
diff --git a/src/plugins/bazaar/bazaarcontrol.cpp b/src/plugins/bazaar/bazaarcontrol.cpp
new file mode 100644
index 0000000000..01741813b6
--- /dev/null
+++ b/src/plugins/bazaar/bazaarcontrol.cpp
@@ -0,0 +1,166 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "bazaarcontrol.h"
+#include "bazaarclient.h"
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QVariant>
+#include <QtCore/QStringList>
+#include <QtCore/QDir>
+
+using namespace Bazaar::Internal;
+
+BazaarControl::BazaarControl(BazaarClient *client)
+ : m_bazaarClient(client)
+{
+}
+
+QString BazaarControl::displayName() const
+{
+ return tr("Bazaar");
+}
+
+bool BazaarControl::managesDirectory(const QString &directory, QString *topLevel) const
+{
+ QFileInfo dir(directory);
+ const QString topLevelFound = m_bazaarClient->findTopLevelForFile(dir);
+ if (topLevel)
+ *topLevel = topLevelFound;
+ return !topLevelFound.isEmpty();
+}
+
+bool BazaarControl::supportsOperation(Operation operation) const
+{
+ bool supported = true;
+ switch (operation) {
+ case Core::IVersionControl::AddOperation:
+ case Core::IVersionControl::DeleteOperation:
+ case Core::IVersionControl::MoveOperation:
+ case Core::IVersionControl::CreateRepositoryOperation:
+ case Core::IVersionControl::AnnotateOperation:
+ case Core::IVersionControl::GetRepositoryRootOperation:
+ break;
+ case Core::IVersionControl::CheckoutOperation:
+ case Core::IVersionControl::OpenOperation:
+ case Core::IVersionControl::SnapshotOperations:
+ supported = false;
+ break;
+ }
+ return supported;
+}
+
+bool BazaarControl::vcsOpen(const QString &filename)
+{
+ Q_UNUSED(filename)
+ return true;
+}
+
+bool BazaarControl::vcsAdd(const QString &filename)
+{
+ const QFileInfo fi(filename);
+ return m_bazaarClient->synchronousAdd(fi.absolutePath(), fi.fileName());
+}
+
+bool BazaarControl::vcsDelete(const QString &filename)
+{
+ const QFileInfo fi(filename);
+ return m_bazaarClient->synchronousRemove(fi.absolutePath(), fi.fileName());
+}
+
+bool BazaarControl::vcsMove(const QString &from, const QString &to)
+{
+ const QFileInfo fromInfo(from);
+ const QFileInfo toInfo(to);
+ return m_bazaarClient->synchronousMove(fromInfo.absolutePath(),
+ fromInfo.absoluteFilePath(),
+ toInfo.absoluteFilePath());
+}
+
+bool BazaarControl::vcsCreateRepository(const QString &directory)
+{
+ return m_bazaarClient->synchronousCreateRepository(directory);
+}
+
+QString BazaarControl::vcsCreateSnapshot(const QString &)
+{
+ return QString();
+}
+
+QStringList BazaarControl::vcsSnapshots(const QString &)
+{
+ return QStringList();
+}
+
+bool BazaarControl::vcsRestoreSnapshot(const QString &, const QString &)
+{
+ return false;
+}
+
+bool BazaarControl::vcsRemoveSnapshot(const QString &, const QString &)
+{
+ return false;
+}
+
+bool BazaarControl::vcsAnnotate(const QString &file, int line)
+{
+ const QFileInfo fi(file);
+ m_bazaarClient->annotate(fi.absolutePath(), fi.fileName(), QString(), line);
+ return true;
+}
+
+bool BazaarControl::vcsCheckout(const QString &/*directory*/, const QByteArray &/*url*/)
+{
+ return false;
+}
+
+QString BazaarControl::vcsGetRepositoryURL(const QString &directory)
+{
+ const QString repositoryRoot = m_bazaarClient->findTopLevelForFile(directory);
+ const BranchInfo branchInfo = m_bazaarClient->synchronousBranchQuery(repositoryRoot);
+ return branchInfo.isBoundToBranch ? branchInfo.branchLocation : QString();
+}
+
+void BazaarControl::changed(const QVariant &v)
+{
+ switch (v.type()) {
+ case QVariant::String:
+ emit repositoryChanged(v.toString());
+ break;
+ case QVariant::StringList:
+ emit filesChanged(v.toStringList());
+ break;
+ default:
+ break;
+ }
+}
diff --git a/src/plugins/bazaar/bazaarcontrol.h b/src/plugins/bazaar/bazaarcontrol.h
new file mode 100644
index 0000000000..f131a6f7ba
--- /dev/null
+++ b/src/plugins/bazaar/bazaarcontrol.h
@@ -0,0 +1,85 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAARCONTROL_H
+#define BAZAARCONTROL_H
+
+#include <coreplugin/iversioncontrol.h>
+
+QT_BEGIN_NAMESPACE
+class QVariant;
+QT_END_NAMESPACE
+
+namespace Bazaar {
+namespace Internal {
+
+class BazaarClient;
+
+//Implements just the basics of the Version Control Interface
+//BazaarClient handles all the work
+class BazaarControl: public Core::IVersionControl
+{
+ Q_OBJECT
+public:
+ explicit BazaarControl(BazaarClient *bazaarClient);
+
+ QString displayName() const;
+ bool managesDirectory(const QString &filename, QString *topLevel = 0) const;
+ bool supportsOperation(Operation operation) const;
+ bool vcsOpen(const QString &fileName);
+ bool vcsAdd(const QString &filename);
+ bool vcsDelete(const QString &filename);
+ bool vcsMove(const QString &from, const QString &to);
+ bool vcsCreateRepository(const QString &directory);
+ bool vcsCheckout(const QString &directory, const QByteArray &url);
+ QString vcsGetRepositoryURL(const QString &directory);
+ QString vcsCreateSnapshot(const QString &topLevel);
+ QStringList vcsSnapshots(const QString &topLevel);
+ bool vcsRestoreSnapshot(const QString &topLevel, const QString &name);
+ bool vcsRemoveSnapshot(const QString &topLevel, const QString &name);
+ virtual bool vcsAnnotate(const QString &file, int line);
+
+public slots:
+ // To be connected to the VCSTask's success signal to emit the repository/
+ // files changed signals according to the variant's type:
+ // String -> repository, StringList -> files
+ void changed(const QVariant&);
+
+private:
+ BazaarClient *m_bazaarClient;
+};
+
+} //namespace Internal
+} //namespace Bazaar
+
+#endif // BAZAARCONTROL_H
diff --git a/src/plugins/bazaar/bazaareditor.cpp b/src/plugins/bazaar/bazaareditor.cpp
new file mode 100644
index 0000000000..f36edcaa08
--- /dev/null
+++ b/src/plugins/bazaar/bazaareditor.cpp
@@ -0,0 +1,119 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "bazaareditor.h"
+#include "annotationhighlighter.h"
+#include "constants.h"
+#include "bazaarplugin.h"
+#include "bazaarclient.h"
+
+#include <coreplugin/editormanager/editormanager.h>
+#include <vcsbase/diffhighlighter.h>
+
+#include <QtCore/QString>
+#include <QtGui/QTextCursor>
+#include <QtGui/QTextBlock>
+#include <QtCore/QDir>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDebug>
+
+using namespace Bazaar::Internal;
+using namespace Bazaar;
+
+BazaarEditor::BazaarEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent)
+ : VCSBase::VCSBaseEditorWidget(type, parent),
+ m_exactIdentifier12(QLatin1String(Constants::CHANGEIDEXACT12)),
+ m_exactIdentifier40(QLatin1String(Constants::CHANGEIDEXACT40)),
+ m_changesetIdentifier12(QLatin1String(Constants::CHANGESETID12)),
+ m_changesetIdentifier40(QLatin1String(Constants::CHANGESETID40)),
+ m_diffIdentifier(QLatin1String(Constants::DIFFIDENTIFIER))
+{
+ setAnnotateRevisionTextFormat(tr("Annotate %1"));
+ setAnnotatePreviousRevisionTextFormat(tr("Annotate parent revision %1"));
+}
+
+QSet<QString> BazaarEditor::annotationChanges() const
+{
+ QSet<QString> changes;
+ const QString data = toPlainText();
+ if (data.isEmpty())
+ return changes;
+
+ int position = 0;
+ while ((position = m_changesetIdentifier12.indexIn(data, position)) != -1) {
+ changes.insert(m_changesetIdentifier12.cap(1));
+ position += m_changesetIdentifier12.matchedLength();
+ }
+
+ return changes;
+}
+
+QString BazaarEditor::changeUnderCursor(const QTextCursor &cursorIn) const
+{
+ QTextCursor cursor = cursorIn;
+ cursor.select(QTextCursor::WordUnderCursor);
+ if (cursor.hasSelection()) {
+ const QString change = cursor.selectedText();
+ if (m_exactIdentifier12.exactMatch(change))
+ return change;
+ if (m_exactIdentifier40.exactMatch(change))
+ return change;
+ }
+ return QString();
+}
+
+VCSBase::DiffHighlighter *BazaarEditor::createDiffHighlighter() const
+{
+ return new VCSBase::DiffHighlighter(m_diffIdentifier);
+}
+
+VCSBase::BaseAnnotationHighlighter *BazaarEditor::createAnnotationHighlighter(const QSet<QString> &changes) const
+{
+ return new BazaarAnnotationHighlighter(changes);
+}
+
+QString BazaarEditor::fileNameFromDiffSpecification(const QTextBlock &diffFileSpec) const
+{
+ const QString filechangeId(QLatin1String("+++ b/"));
+ QTextBlock::iterator iterator;
+ for (iterator = diffFileSpec.begin(); !(iterator.atEnd()); iterator++) {
+ QTextFragment fragment = iterator.fragment();
+ if(fragment.isValid()) {
+ if (fragment.text().startsWith(filechangeId)) {
+ const QString filename = fragment.text().remove(0, filechangeId.size());
+ return findDiffFile(filename, BazaarPlugin::instance()->versionControl());
+ }
+ }
+ }
+ return QString();
+}
diff --git a/src/plugins/bazaar/bazaareditor.h b/src/plugins/bazaar/bazaareditor.h
new file mode 100644
index 0000000000..720a4524f8
--- /dev/null
+++ b/src/plugins/bazaar/bazaareditor.h
@@ -0,0 +1,66 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAAREDITOR_H
+#define BAZAAREDITOR_H
+
+#include <vcsbase/vcsbaseeditor.h>
+
+#include <QtCore/QRegExp>
+
+namespace Bazaar {
+namespace Internal {
+
+class BazaarEditor : public VCSBase::VCSBaseEditorWidget
+{
+ Q_OBJECT
+public:
+ explicit BazaarEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent);
+
+private:
+ virtual QSet<QString> annotationChanges() const;
+ virtual QString changeUnderCursor(const QTextCursor &cursor) const;
+ virtual VCSBase::DiffHighlighter *createDiffHighlighter() const;
+ virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const;
+ virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileSpec) const;
+
+ const QRegExp m_exactIdentifier12;
+ const QRegExp m_exactIdentifier40;
+ const QRegExp m_changesetIdentifier12;
+ const QRegExp m_changesetIdentifier40;
+ const QRegExp m_diffIdentifier;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+#endif // BAZAAREDITOR_H
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
new file mode 100644
index 0000000000..ff3d044e59
--- /dev/null
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -0,0 +1,678 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "bazaarplugin.h"
+#include "constants.h"
+#include "bazaarclient.h"
+#include "bazaarcontrol.h"
+#include "optionspage.h"
+#include "bazaarcommitwidget.h"
+#include "bazaareditor.h"
+#include "pullorpushdialog.h"
+#include "commiteditor.h"
+#include "clonewizard.h"
+
+#include "ui_revertdialog.h"
+
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/command.h>
+#include <coreplugin/uniqueidmanager.h>
+#include <coreplugin/vcsmanager.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/filemanager.h>
+#include <coreplugin/editormanager/editormanager.h>
+
+#include <locator/commandlocator.h>
+
+#include <utils/parameteraction.h>
+#include <utils/qtcassert.h>
+
+#include <vcsbase/basevcseditorfactory.h>
+#include <vcsbase/basevcssubmiteditorfactory.h>
+#include <vcsbase/vcsbasesubmiteditor.h>
+#include <vcsbase/vcsbaseeditor.h>
+#include <vcsbase/vcsbaseoutputwindow.h>
+
+#include <QtCore/QtPlugin>
+#include <QtGui/QAction>
+#include <QtGui/QMenu>
+#include <QtGui/QMainWindow>
+#include <QtCore/QtDebug>
+#include <QtCore/QtGlobal>
+#include <QtCore/QDir>
+#include <QtGui/QDialog>
+#include <QtGui/QFileDialog>
+#include <QtCore/QTemporaryFile>
+
+
+using namespace Bazaar::Internal;
+using namespace Bazaar;
+
+static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
+ {
+ VCSBase::RegularCommandOutput, //type
+ Constants::COMMANDLOG_ID, // id
+ Constants::COMMANDLOG_DISPLAY_NAME, // display name
+ Constants::COMMANDLOG, // context
+ Constants::COMMANDAPP, // mime type
+ Constants::COMMANDEXT}, //extension
+
+ { VCSBase::LogOutput,
+ Constants::FILELOG_ID,
+ Constants::FILELOG_DISPLAY_NAME,
+ Constants::FILELOG,
+ Constants::LOGAPP,
+ Constants::LOGEXT},
+
+ { VCSBase::AnnotateOutput,
+ Constants::ANNOTATELOG_ID,
+ Constants::ANNOTATELOG_DISPLAY_NAME,
+ Constants::ANNOTATELOG,
+ Constants::ANNOTATEAPP,
+ Constants::ANNOTATEEXT},
+
+ { VCSBase::DiffOutput,
+ Constants::DIFFLOG_ID,
+ Constants::DIFFLOG_DISPLAY_NAME,
+ Constants::DIFFLOG,
+ Constants::DIFFAPP,
+ Constants::DIFFEXT}
+};
+
+static const VCSBase::VCSBaseSubmitEditorParameters submitEditorParameters = {
+ Constants::COMMITMIMETYPE,
+ Constants::COMMIT_ID,
+ Constants::COMMIT_DISPLAY_NAME,
+ Constants::COMMIT_ID
+};
+
+
+BazaarPlugin *BazaarPlugin::m_instance = 0;
+
+BazaarPlugin::BazaarPlugin() :
+ VCSBase::VCSBasePlugin(QLatin1String(Constants::COMMIT_ID)),
+ m_optionsPage(0),
+ m_client(0),
+ m_core(0),
+ m_commandLocator(0),
+ m_changeLog(0),
+ m_addAction(0),
+ m_deleteAction(0),
+ m_menuAction(0)
+{
+ m_instance = this;
+}
+
+BazaarPlugin::~BazaarPlugin()
+{
+ if (m_client) {
+ delete m_client;
+ m_client = 0;
+ }
+
+ deleteCommitLog();
+
+ m_instance = 0;
+}
+
+bool BazaarPlugin::initialize(const QStringList &/*arguments*/, QString */*error_message*/)
+{
+ typedef VCSBase::VCSEditorFactory<BazaarEditor> BazaarEditorFactory;
+
+ m_client = new BazaarClient(m_bazaarSettings);
+ VCSBase::VCSBasePlugin::initialize(new BazaarControl(m_client));
+
+ m_core = Core::ICore::instance();
+ m_actionManager = m_core->actionManager();
+
+ m_optionsPage = new OptionsPage();
+ addAutoReleasedObject(m_optionsPage);
+ m_bazaarSettings.readSettings(m_core->settings(), Constants::BAZAAR);
+
+ connect(m_optionsPage, SIGNAL(settingsChanged()), m_client, SLOT(settingsChanged()));
+ connect(m_client, SIGNAL(changed(QVariant)), versionControl(), SLOT(changed(QVariant)));
+
+ static const char *describeSlot = SLOT(view(QString,QString));
+ const int editorCount = sizeof(editorParameters) / sizeof(VCSBase::VCSBaseEditorParameters);
+ for (int i = 0; i < editorCount; i++)
+ addAutoReleasedObject(new BazaarEditorFactory(editorParameters + i, m_client, describeSlot));
+
+ addAutoReleasedObject(new VCSBase::VCSSubmitEditorFactory<CommitEditor>(&submitEditorParameters));
+
+ addAutoReleasedObject(new CloneWizard);
+
+ const QString prefix = QLatin1String("bzr");
+ m_commandLocator = new Locator::CommandLocator(QLatin1String("Bazaar"), prefix, prefix);
+ addAutoReleasedObject(m_commandLocator);
+
+ createMenu();
+
+ createSubmitEditorActions();
+
+ return true;
+}
+
+BazaarPlugin *BazaarPlugin::instance()
+{
+ return m_instance;
+}
+
+BazaarClient *BazaarPlugin::client() const
+{
+ return m_client;
+}
+
+const BazaarSettings &BazaarPlugin::settings() const
+{
+ return m_bazaarSettings;
+}
+
+void BazaarPlugin::setSettings(const BazaarSettings &settings)
+{
+ if (settings != m_bazaarSettings) {
+ m_bazaarSettings = settings;
+ }
+}
+
+void BazaarPlugin::createMenu()
+{
+ Core::Context context(Core::Constants::C_GLOBAL);
+
+ // Create menu item for Bazaar
+ m_bazaarContainer = m_actionManager->createMenu(Core::Id("Bazaar.BazaarMenu"));
+ QMenu *menu = m_bazaarContainer->menu();
+ menu->setTitle(tr("Bazaar"));
+
+ createFileActions(context);
+ createSeparator(context, Core::Id("FileDirSeperator"));
+ createDirectoryActions(context);
+ createSeparator(context, Core::Id("DirRepoSeperator"));
+ createRepositoryActions(context);
+ createSeparator(context, Core::Id("Repository Management"));
+
+ // Request the Tools menu and add the Bazaar menu to it
+ Core::ActionContainer *toolsMenu = m_actionManager->actionContainer(Core::Id(Core::Constants::M_TOOLS));
+ toolsMenu->addMenu(m_bazaarContainer);
+ m_menuAction = m_bazaarContainer->menu()->menuAction();
+}
+
+void BazaarPlugin::createFileActions(const Core::Context &context)
+{
+ Core::Command *command;
+
+ m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_annotateFile, Core::Id(Constants::ANNOTATE), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ connect(m_annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_diffFile, Core::Id(Constants::DIFF), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ command->setDefaultKeySequence(QKeySequence(tr("Alt+B,Alt+D")));
+ connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ m_logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_logFile, Core::Id(Constants::LOG), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ command->setDefaultKeySequence(QKeySequence(tr("Alt+B,Alt+L")));
+ connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_statusFile, Core::Id(Constants::STATUS), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ command->setDefaultKeySequence(QKeySequence(tr("Alt+B,Alt+S")));
+ connect(m_statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ createSeparator(context, Core::Id("FileDirSeperator1"));
+
+ m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
+ command = m_actionManager->registerAction(m_revertFile, Core::Id(Constants::REVERT), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ connect(m_revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+}
+
+void BazaarPlugin::addCurrentFile()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasFile(), return)
+ m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
+}
+
+void BazaarPlugin::annotateCurrentFile()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasFile(), return)
+ m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
+}
+
+void BazaarPlugin::diffCurrentFile()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasFile(), return)
+ m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
+}
+
+void BazaarPlugin::logCurrentFile()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasFile(), return)
+ m_client->log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
+}
+
+void BazaarPlugin::revertCurrentFile()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasFile(), return);
+
+ QDialog dialog;
+ Ui::RevertDialog revertUi;
+ revertUi.setupUi(&dialog);
+ if (dialog.exec() != QDialog::Accepted)
+ return;
+ m_client->revertFile(state.currentFileTopLevel(),
+ state.relativeCurrentFile(),
+ revertUi.revisionLineEdit->text());
+}
+
+void BazaarPlugin::statusCurrentFile()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasFile(), return)
+ m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
+}
+
+void BazaarPlugin::createDirectoryActions(const Core::Context &context)
+{
+ QAction *action;
+ Core::Command *command;
+
+ action = new QAction(tr("Diff"), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::DIFFMULTI), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(diffRepository()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ action = new QAction(tr("Log"), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::LOGMULTI), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(logRepository()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ action = new QAction(tr("Revert..."), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::REVERTMULTI), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(revertAll()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ action = new QAction(tr("Status"), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::STATUSMULTI), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(statusMulti()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+}
+
+
+void BazaarPlugin::diffRepository()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return)
+ m_client->diff(state.topLevel());
+}
+
+void BazaarPlugin::logRepository()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return)
+ m_client->log(state.topLevel());
+}
+
+void BazaarPlugin::revertAll()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+
+ QDialog dialog;
+ Ui::RevertDialog revertUi;
+ revertUi.setupUi(&dialog);
+ if (dialog.exec() != QDialog::Accepted)
+ return;
+ m_client->revertAll(state.topLevel(), revertUi.revisionLineEdit->text());
+}
+
+void BazaarPlugin::statusMulti()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+ m_client->status(state.topLevel());
+}
+
+void BazaarPlugin::createRepositoryActions(const Core::Context &context)
+{
+ QAction *action = 0;
+ Core::Command *command = 0;
+
+ action = new QAction(tr("Pull..."), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::PULL), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(pull()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ action = new QAction(tr("Push..."), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::PUSH), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(push()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ action = new QAction(tr("Update..."), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::UPDATE), context);
+ connect(action, SIGNAL(triggered()), this, SLOT(update()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ action = new QAction(tr("Commit..."), this);
+ m_repositoryActionList.append(action);
+ command = m_actionManager->registerAction(action, Core::Id(Constants::COMMIT), context);
+ command->setDefaultKeySequence(QKeySequence(tr("Alt+B,Alt+C")));
+ connect(action, SIGNAL(triggered()), this, SLOT(commit()));
+ m_bazaarContainer->addAction(command);
+ m_commandLocator->appendCommand(command);
+
+ QAction* createRepositoryAction = new QAction(tr("Create Repository..."), this);
+ command = m_actionManager->registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context);
+ connect(createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
+ m_bazaarContainer->addAction(command);
+}
+
+void BazaarPlugin::pull()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+
+ PullOrPushDialog dialog(PullOrPushDialog::PullMode);
+ if (dialog.exec() != QDialog::Accepted)
+ return;
+ BazaarClient::ExtraCommandOptions extraOptions;
+ extraOptions[BazaarClient::RememberPullOrPushOptionId] = dialog.isRememberOptionEnabled();
+ extraOptions[BazaarClient::OverwritePullOrPushOptionId] = dialog.isOverwriteOptionEnabled();
+ extraOptions[BazaarClient::RevisionPullOrPushOptionId] = dialog.revision();
+ extraOptions[BazaarClient::LocalPullOptionId] = dialog.isLocalOptionEnabled();
+ m_client->synchronousPull(state.topLevel(), dialog.branchLocation(), extraOptions);
+}
+
+void BazaarPlugin::push()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+
+ PullOrPushDialog dialog(PullOrPushDialog::PushMode);
+ if (dialog.exec() != QDialog::Accepted)
+ return;
+ BazaarClient::ExtraCommandOptions extraOptions;
+ extraOptions[BazaarClient::RememberPullOrPushOptionId] = dialog.isRememberOptionEnabled();
+ extraOptions[BazaarClient::OverwritePullOrPushOptionId] = dialog.isOverwriteOptionEnabled();
+ extraOptions[BazaarClient::RevisionPullOrPushOptionId] = dialog.revision();
+ extraOptions[BazaarClient::UseExistingDirPushOptionId] = dialog.isUseExistingDirectoryOptionEnabled();
+ extraOptions[BazaarClient::CreatePrefixPushOptionId] = dialog.isCreatePrefixOptionEnabled();
+ m_client->synchronousPush(state.topLevel(), dialog.branchLocation(), extraOptions);
+}
+
+void BazaarPlugin::update()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+
+ QDialog dialog;
+ Ui::RevertDialog revertUi;
+ revertUi.setupUi(&dialog);
+ dialog.setWindowTitle(tr("Update"));
+ if (dialog.exec() != QDialog::Accepted)
+ return;
+ m_client->update(state.topLevel(), revertUi.revisionLineEdit->text());
+}
+
+void BazaarPlugin::createSubmitEditorActions()
+{
+ Core::Context context(Constants::COMMIT_ID);
+ Core::Command *command;
+
+ m_editorCommit = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this);
+ command = m_actionManager->registerAction(m_editorCommit, Core::Id(Constants::COMMIT), context);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ connect(m_editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
+
+ m_editorDiff = new QAction(VCSBase::VCSBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this);
+ command = m_actionManager->registerAction(m_editorDiff, Core::Id(Constants::DIFFEDITOR), context);
+
+ m_editorUndo = new QAction(tr("&Undo"), this);
+ command = m_actionManager->registerAction(m_editorUndo, Core::Id(Core::Constants::UNDO), context);
+
+ m_editorRedo = new QAction(tr("&Redo"), this);
+ command = m_actionManager->registerAction(m_editorRedo, Core::Id(Core::Constants::REDO), context);
+}
+
+void BazaarPlugin::commit()
+{
+ if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
+ return;
+
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return);
+
+ m_submitRepository = state.topLevel();
+
+ connect(m_client, SIGNAL(parsedStatus(QList<QPair<QString,QString> >)),
+ this, SLOT(showCommitWidget(QList<QPair<QString,QString> >)));
+ m_client->statusWithSignal(m_submitRepository);
+}
+
+void BazaarPlugin::showCommitWidget(const QList<QPair<QString, QString> > &status)
+{
+ VCSBase::VCSBaseOutputWindow *outputWindow = VCSBase::VCSBaseOutputWindow::instance();
+ //Once we receive our data release the connection so it can be reused elsewhere
+ disconnect(m_client, SIGNAL(parsedStatus(QList<QPair<QString,QString> >)),
+ this, SLOT(showCommitWidget(QList<QPair<QString,QString> >)));
+
+ if (status.isEmpty()) {
+ outputWindow->appendError(tr("There are no changes to commit."));
+ return;
+ }
+
+ deleteCommitLog();
+
+ // Open commit log
+ QString m_changeLogPattern = QDir::tempPath();
+ if (!m_changeLogPattern.endsWith(QLatin1Char('/')))
+ m_changeLogPattern += QLatin1Char('/');
+ m_changeLogPattern += QLatin1String("qtcreator-bzr-XXXXXX.msg");
+ m_changeLog = new QTemporaryFile(m_changeLogPattern, this);
+ if (!m_changeLog->open()) {
+ outputWindow->appendError(tr("Unable to generate a temporary file for the commit editor."));
+ return;
+ }
+
+ Core::IEditor *editor = m_core->editorManager()->openEditor(m_changeLog->fileName(),
+ QLatin1String(Constants::COMMIT_ID),
+ Core::EditorManager::ModeSwitch);
+ if (!editor) {
+ outputWindow->appendError(tr("Unable to create an editor for the commit."));
+ return;
+ }
+
+ CommitEditor *commitEditor = qobject_cast<CommitEditor *>(editor);
+
+ if (!commitEditor) {
+ outputWindow->appendError(tr("Unable to create a commit editor."));
+ return;
+ }
+
+ const QString msg = tr("Commit changes for \"%1\".").
+ arg(QDir::toNativeSeparators(m_submitRepository));
+ commitEditor->setDisplayName(msg);
+
+ const BranchInfo branch = m_client->synchronousBranchQuery(m_submitRepository);
+ commitEditor->setFields(branch, m_bazaarSettings.userName(),
+ m_bazaarSettings.email(), status);
+
+ commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff);
+ connect(commitEditor, SIGNAL(diffSelectedFiles(QStringList)),
+ this, SLOT(diffFromEditorSelected(QStringList)));
+ commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
+}
+
+void BazaarPlugin::diffFromEditorSelected(const QStringList &files)
+{
+ m_client->diff(m_submitRepository, files);
+}
+
+void BazaarPlugin::commitFromEditor()
+{
+ if (!m_changeLog)
+ return;
+
+ //use the same functionality than if the user closes the file without completing the commit
+ m_core->editorManager()->closeEditors(m_core->editorManager()->editorsForFileName(m_changeLog->fileName()));
+}
+
+bool BazaarPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor)
+{
+ if (!m_changeLog)
+ return true;
+ Core::IFile *editorFile = submitEditor->file();
+ const CommitEditor *commitEditor = qobject_cast<const CommitEditor *>(submitEditor);
+ if (!editorFile || !commitEditor)
+ return true;
+
+ bool dummyPrompt = m_bazaarSettings.prompt();
+ const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult response =
+ commitEditor->promptSubmit(tr("Close Commit Editor"), tr("Do you want to commit the changes?"),
+ tr("Message check failed. Do you want to proceed?"),
+ &dummyPrompt, m_bazaarSettings.prompt());
+
+ switch (response) {
+ case VCSBase::VCSBaseSubmitEditor::SubmitCanceled:
+ return false;
+ case VCSBase::VCSBaseSubmitEditor::SubmitDiscarded:
+ deleteCommitLog();
+ return true;
+ default:
+ break;
+ }
+
+ const QStringList files = commitEditor->checkedFiles();
+ if (!files.empty()) {
+ //save the commit message
+ m_core->fileManager()->blockFileChange(editorFile);
+ editorFile->save();
+ m_core->fileManager()->unblockFileChange(editorFile);
+
+ const BazaarCommitWidget* commitWidget = commitEditor->commitWidget();
+ BazaarClient::ExtraCommandOptions extraOptions;
+ extraOptions[BazaarClient::AuthorCommitOptionId] = commitWidget->committer();
+ extraOptions[BazaarClient::FixesCommitOptionId] = commitWidget->fixedBugs();
+ extraOptions[BazaarClient::LocalCommitOptionId] = commitWidget->isLocalOptionEnabled();
+ m_client->commit(m_submitRepository, files, editorFile->fileName(), extraOptions);
+ }
+ return true;
+}
+
+void BazaarPlugin::deleteCommitLog()
+{
+ if (m_changeLog) {
+ delete m_changeLog;
+ m_changeLog = 0;
+ }
+}
+
+void BazaarPlugin::createSeparator(const Core::Context &context, const Core::Id &id)
+{
+ QAction *action = new QAction(this);
+ action->setSeparator(true);
+ m_bazaarContainer->addAction(m_actionManager->registerAction(action, id, context));
+}
+
+void BazaarPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
+{
+ if (!enableMenuAction(as, m_menuAction)) {
+ m_commandLocator->setEnabled(false);
+ return;
+ }
+ const QString filename = currentState().currentFileName();
+ const bool repoEnabled = currentState().hasTopLevel();
+ m_commandLocator->setEnabled(repoEnabled);
+
+ m_annotateFile->setParameter(filename);
+ m_diffFile->setParameter(filename);
+ m_logFile->setParameter(filename);
+ m_addAction->setParameter(filename);
+ m_deleteAction->setParameter(filename);
+ m_revertFile->setParameter(filename);
+ m_statusFile->setParameter(filename);
+
+ foreach (QAction *repoAction, m_repositoryActionList)
+ repoAction->setEnabled(repoEnabled);
+}
+
+Q_EXPORT_PLUGIN(BazaarPlugin)
diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h
new file mode 100644
index 0000000000..79a97a1dc6
--- /dev/null
+++ b/src/plugins/bazaar/bazaarplugin.h
@@ -0,0 +1,172 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAARPLUGIN_H
+#define BAZAARPLUGIN_H
+
+#include "bazaarsettings.h"
+
+#include <vcsbase/vcsbaseclientsettings.h>
+#include <vcsbase/vcsbaseplugin.h>
+#include <coreplugin/icontext.h>
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QHash>
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QTemporaryFile;
+QT_END_NAMESPACE
+
+namespace Core {
+class ActionManager;
+class ActionContainer;
+class ICore;
+class Id;
+class IVersionControl;
+class IEditorFactory;
+class IEditor;
+} // namespace Core
+
+namespace Utils {
+class ParameterAction;
+} //namespace Utils
+
+namespace VCSBase {
+class VCSBaseSubmitEditor;
+}
+
+namespace Locator {
+ class CommandLocator;
+}
+
+namespace Bazaar {
+namespace Internal {
+
+class OptionsPage;
+class BazaarClient;
+class BazaarControl;
+class BazaarEditor;
+
+class BazaarPlugin : public VCSBase::VCSBasePlugin
+{
+ Q_OBJECT
+
+public:
+ BazaarPlugin();
+ virtual ~BazaarPlugin();
+ bool initialize(const QStringList &arguments, QString *error_message);
+
+ static BazaarPlugin *instance();
+ BazaarClient *client() const;
+
+ const BazaarSettings &settings() const;
+ void setSettings(const BazaarSettings &settings);
+
+private slots:
+ // File menu action slots
+ void addCurrentFile();
+ void annotateCurrentFile();
+ void diffCurrentFile();
+ void logCurrentFile();
+ void revertCurrentFile();
+ void statusCurrentFile();
+
+ // Directory menu action slots
+ void diffRepository();
+ void logRepository();
+ void revertAll();
+ void statusMulti();
+
+ // Repository menu action slots
+ void pull();
+ void push();
+ void update();
+ void commit();
+ void showCommitWidget(const QList<QPair<QString, QString> > &status);
+ void commitFromEditor();
+ void diffFromEditorSelected(const QStringList &files);
+
+protected:
+ virtual void updateActions(VCSBase::VCSBasePlugin::ActionState);
+ virtual bool submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor);
+
+private:
+ // Methods
+ void createMenu();
+ void createSubmitEditorActions();
+ void createSeparator(const Core::Context &context, const Core::Id &id);
+ void createFileActions(const Core::Context &context);
+ void createDirectoryActions(const Core::Context &context);
+ void createRepositoryActions(const Core::Context &context);
+ void deleteCommitLog();
+
+ // Variables
+ static BazaarPlugin *m_instance;
+ BazaarSettings m_bazaarSettings;
+ OptionsPage *m_optionsPage;
+ BazaarClient *m_client;
+
+ Core::ICore *m_core;
+ Locator::CommandLocator *m_commandLocator;
+ Core::ActionManager *m_actionManager;
+ Core::ActionContainer *m_bazaarContainer;
+
+ QList<QAction *> m_repositoryActionList;
+ QTemporaryFile *m_changeLog;
+
+ // Menu Items (file actions)
+ Utils::ParameterAction *m_addAction;
+ Utils::ParameterAction *m_deleteAction;
+ Utils::ParameterAction *m_annotateFile;
+ Utils::ParameterAction *m_diffFile;
+ Utils::ParameterAction *m_logFile;
+ Utils::ParameterAction *m_renameFile;
+ Utils::ParameterAction *m_revertFile;
+ Utils::ParameterAction *m_statusFile;
+
+ // Submit editor actions
+ QAction *m_editorCommit;
+ QAction *m_editorDiff;
+ QAction *m_editorUndo;
+ QAction *m_editorRedo;
+ QAction *m_menuAction;
+
+ QString m_submitRepository;
+};
+
+} //namespace Internal
+} //namespace Bazaar
+
+#endif // BAZAARPLUGIN_H
diff --git a/src/plugins/bazaar/bazaarsettings.cpp b/src/plugins/bazaar/bazaarsettings.cpp
new file mode 100644
index 0000000000..e105f4b3fb
--- /dev/null
+++ b/src/plugins/bazaar/bazaarsettings.cpp
@@ -0,0 +1,52 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "bazaarsettings.h"
+#include "constants.h"
+
+namespace Bazaar {
+namespace Internal {
+
+BazaarSettings::BazaarSettings()
+{
+ setBinary(QLatin1String(Constants::BAZAARDEFAULT));
+}
+
+BazaarSettings& BazaarSettings::operator=(const BazaarSettings& other)
+{
+ VCSBase::VCSBaseClientSettings::operator=(other);
+ return *this;
+}
+
+} // namespace Internal
+} // namespace Bazaar
diff --git a/src/plugins/bazaar/bazaarsettings.h b/src/plugins/bazaar/bazaarsettings.h
new file mode 100644
index 0000000000..a683b34465
--- /dev/null
+++ b/src/plugins/bazaar/bazaarsettings.h
@@ -0,0 +1,52 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAARSETTINGS_H
+#define BAZAARSETTINGS_H
+
+#include <vcsbase/vcsbaseclientsettings.h>
+
+namespace Bazaar {
+namespace Internal {
+
+class BazaarSettings : public VCSBase::VCSBaseClientSettings
+{
+public:
+ BazaarSettings();
+ BazaarSettings& operator=(const BazaarSettings& other);
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // BAZAARSETTINGS_H
diff --git a/src/plugins/bazaar/branchinfo.cpp b/src/plugins/bazaar/branchinfo.cpp
new file mode 100644
index 0000000000..654f43fd29
--- /dev/null
+++ b/src/plugins/bazaar/branchinfo.cpp
@@ -0,0 +1,46 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "branchinfo.h"
+
+namespace Bazaar {
+namespace Internal {
+
+BranchInfo::BranchInfo(const QString &branchLoc, bool isBound) :
+ branchLocation(branchLoc),
+ isBoundToBranch(isBound)
+{
+}
+
+} //namespace Internal
+} // namespace Bazaar
diff --git a/src/plugins/bazaar/branchinfo.h b/src/plugins/bazaar/branchinfo.h
new file mode 100644
index 0000000000..093ea5e435
--- /dev/null
+++ b/src/plugins/bazaar/branchinfo.h
@@ -0,0 +1,53 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BRANCHINFO_H
+#define BRANCHINFO_H
+
+#include <QString>
+
+namespace Bazaar {
+namespace Internal {
+
+class BranchInfo
+{
+public:
+ BranchInfo(const QString &branchLoc, bool isBound);
+ const QString branchLocation;
+ const bool isBoundToBranch;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // BRANCHINFO_H
diff --git a/src/plugins/bazaar/cloneoptionspanel.cpp b/src/plugins/bazaar/cloneoptionspanel.cpp
new file mode 100644
index 0000000000..01bf3fb413
--- /dev/null
+++ b/src/plugins/bazaar/cloneoptionspanel.cpp
@@ -0,0 +1,95 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "cloneoptionspanel.h"
+#include "ui_cloneoptionspanel.h"
+
+#include <QtDebug>
+
+namespace Bazaar {
+namespace Internal {
+
+CloneOptionsPanel::CloneOptionsPanel(QWidget *parent) :
+ QWidget(parent),
+ m_ui(new Ui::CloneOptionsPanel)
+{
+ m_ui->setupUi(this);
+}
+
+CloneOptionsPanel::~CloneOptionsPanel()
+{
+ delete m_ui;
+}
+
+bool CloneOptionsPanel::isUseExistingDirectoryOptionEnabled() const
+{
+ return m_ui->useExistingDirCheckBox->isChecked();
+}
+
+bool CloneOptionsPanel::isStackedOptionEnabled() const
+{
+ return m_ui->stackedCheckBox->isChecked();
+}
+
+bool CloneOptionsPanel::isStandAloneOptionEnabled() const
+{
+ return m_ui->standAloneCheckBox->isChecked();
+}
+
+bool CloneOptionsPanel::isBindOptionEnabled() const
+{
+ return m_ui->bindCheckBox->isChecked();
+}
+
+bool CloneOptionsPanel::isSwitchOptionEnabled() const
+{
+ return m_ui->switchCheckBox->isChecked();
+}
+
+bool CloneOptionsPanel::isHardLinkOptionEnabled() const
+{
+ return m_ui->hardlinkCheckBox->isChecked();
+}
+
+bool CloneOptionsPanel::isNoTreeOptionEnabled() const
+{
+ return m_ui->noTreeCheckBox->isChecked();
+}
+
+QString CloneOptionsPanel::revision() const
+{
+ return m_ui->revisionLineEdit->text().simplified();
+}
+
+} // namespace Internal
+} // namespace Bazaar
diff --git a/src/plugins/bazaar/cloneoptionspanel.h b/src/plugins/bazaar/cloneoptionspanel.h
new file mode 100644
index 0000000000..ab4f290478
--- /dev/null
+++ b/src/plugins/bazaar/cloneoptionspanel.h
@@ -0,0 +1,69 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef CLONEOPTIONSPANEL_H
+#define CLONEOPTIONSPANEL_H
+
+#include <QWidget>
+
+namespace Bazaar {
+namespace Internal {
+
+namespace Ui {
+ class CloneOptionsPanel;
+}
+
+class CloneOptionsPanel : public QWidget
+{
+ Q_OBJECT
+
+public:
+ CloneOptionsPanel(QWidget *parent = 0);
+ ~CloneOptionsPanel();
+
+ bool isUseExistingDirectoryOptionEnabled() const;
+ bool isStackedOptionEnabled() const;
+ bool isStandAloneOptionEnabled() const;
+ bool isBindOptionEnabled() const;
+ bool isSwitchOptionEnabled() const;
+ bool isHardLinkOptionEnabled() const;
+ bool isNoTreeOptionEnabled() const;
+ QString revision() const;
+private:
+ Ui::CloneOptionsPanel *m_ui;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // CLONEOPTIONSPANEL_H
diff --git a/src/plugins/bazaar/cloneoptionspanel.ui b/src/plugins/bazaar/cloneoptionspanel.ui
new file mode 100644
index 0000000000..9c73fca20a
--- /dev/null
+++ b/src/plugins/bazaar/cloneoptionspanel.ui
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Bazaar::Internal::CloneOptionsPanel</class>
+ <widget class="QWidget" name="Bazaar::Internal::CloneOptionsPanel">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>264</width>
+ <height>251</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="optionsGroupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QCheckBox" name="useExistingDirCheckBox">
+ <property name="toolTip">
+ <string>By default branch will fail if the target directory exists, but does not already have a control directory.
+This flag will allow branch to proceed</string>
+ </property>
+ <property name="text">
+ <string>Use exisiting directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QCheckBox" name="stackedCheckBox">
+ <property name="toolTip">
+ <string>Create a stacked branch referring to the source branch.
+The new branch will depend on the availability of the source branch for all operations</string>
+ </property>
+ <property name="text">
+ <string>Stacked</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QCheckBox" name="standAloneCheckBox">
+ <property name="toolTip">
+ <string>Do not use a shared repository, even if available</string>
+ </property>
+ <property name="text">
+ <string>Standalone</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QCheckBox" name="bindCheckBox">
+ <property name="text">
+ <string>Bind new branch to source location</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QCheckBox" name="switchCheckBox">
+ <property name="toolTip">
+ <string>Switch the checkout in the current directory to the new branch</string>
+ </property>
+ <property name="text">
+ <string>Switch checkout</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2">
+ <widget class="QCheckBox" name="hardlinkCheckBox">
+ <property name="toolTip">
+ <string>Hard-link working tree files where possible</string>
+ </property>
+ <property name="text">
+ <string>Hardlink</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2">
+ <widget class="QCheckBox" name="noTreeCheckBox">
+ <property name="toolTip">
+ <string>Create a branch without a working-tree</string>
+ </property>
+ <property name="text">
+ <string>No working-tree</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Revision:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLineEdit" name="revisionLineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>4</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/bazaar/clonewizard.cpp b/src/plugins/bazaar/clonewizard.cpp
new file mode 100644
index 0000000000..cad6223615
--- /dev/null
+++ b/src/plugins/bazaar/clonewizard.cpp
@@ -0,0 +1,108 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "clonewizard.h"
+#include "clonewizardpage.h"
+#include "cloneoptionspanel.h"
+#include "bazaarplugin.h"
+#include "bazaarclient.h"
+#include "bazaarsettings.h"
+
+#include <vcsbase/checkoutjobs.h>
+#include <vcsbase/vcsbaseconstants.h>
+
+#include <QtCore/QDebug>
+
+using namespace Bazaar::Internal;
+
+CloneWizard::CloneWizard(QObject *parent)
+ : VCSBase::BaseCheckoutWizard(parent),
+ m_icon(QIcon(QLatin1String(":/bazaar/images/bazaar.png")))
+{
+ setId(QLatin1String(VCSBase::Constants::VCS_ID_BAZAAR));
+}
+
+QIcon CloneWizard::icon() const
+{
+ return m_icon;
+}
+
+QString CloneWizard::description() const
+{
+ return tr("Clones a Bazaar branch and tries to load the contained project.");
+}
+
+QString CloneWizard::displayName() const
+{
+ return tr("Bazaar Clone (or branch)");
+}
+
+QList<QWizardPage*> CloneWizard::createParameterPages(const QString &path)
+{
+ QList<QWizardPage*> wizardPageList;
+ CloneWizardPage *page = new CloneWizardPage;
+ page->setPath(path);
+ wizardPageList.append(page);
+ return wizardPageList;
+}
+
+QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizard::createJob(const QList<QWizardPage *> &parameterPages,
+ QString *checkoutPath)
+{
+ const CloneWizardPage *page = qobject_cast<const CloneWizardPage *>(parameterPages.front());
+
+ if (!page)
+ return QSharedPointer<VCSBase::AbstractCheckoutJob>();
+
+ const BazaarSettings &settings = BazaarPlugin::instance()->settings();
+ QStringList args = settings.standardArguments();
+ *checkoutPath = page->path() + QLatin1Char('/') + page->directory();
+
+ const CloneOptionsPanel *panel = page->cloneOptionsPanel();
+ BazaarClient::ExtraCommandOptions extraOptions;
+ extraOptions[BazaarClient::UseExistingDirCloneOptionId] = panel->isUseExistingDirectoryOptionEnabled();
+ extraOptions[BazaarClient::StackedCloneOptionId] = panel->isStackedOptionEnabled();
+ extraOptions[BazaarClient::StandAloneCloneOptionId] = panel->isStandAloneOptionEnabled();
+ extraOptions[BazaarClient::BindCloneOptionId] = panel->isBindOptionEnabled();
+ extraOptions[BazaarClient::SwitchCloneOptionId] = panel->isSwitchOptionEnabled();
+ extraOptions[BazaarClient::HardLinkCloneOptionId] = panel->isHardLinkOptionEnabled();
+ extraOptions[BazaarClient::NoTreeCloneOptionId] = panel->isNoTreeOptionEnabled();
+ extraOptions[BazaarClient::RevisionCloneOptionId] = panel->revision();
+ const BazaarClient *client = BazaarPlugin::instance()->client();
+ args << client->vcsCommandString(BazaarClient::CloneCommand)
+ << client->cloneArguments(page->repository(), page->directory(), extraOptions);
+
+ VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
+ job->addStep(settings.binary(), args, page->path());
+ return QSharedPointer<VCSBase::AbstractCheckoutJob>(job);
+}
diff --git a/src/plugins/bazaar/clonewizard.h b/src/plugins/bazaar/clonewizard.h
new file mode 100644
index 0000000000..e4a7cd4f2c
--- /dev/null
+++ b/src/plugins/bazaar/clonewizard.h
@@ -0,0 +1,66 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef CLONEWIZARD_H
+#define CLONEWIZARD_H
+
+#include <vcsbase/basecheckoutwizard.h>
+
+#include <QtGui/QIcon>
+
+namespace Bazaar {
+namespace Internal {
+
+class CloneWizard : public VCSBase::BaseCheckoutWizard
+{
+ Q_OBJECT
+public:
+ CloneWizard(QObject *parent = 0);
+
+ QIcon icon() const;
+ QString description() const;
+ QString displayName() const;
+
+protected:
+ QList<QWizardPage *> createParameterPages(const QString &path);
+ QSharedPointer<VCSBase::AbstractCheckoutJob> createJob(const QList<QWizardPage *> &parameterPages,
+ QString *checkoutPath);
+
+private:
+ const QIcon m_icon;
+};
+
+} //namespace Internal
+} //namespace Bazaar
+
+#endif // CLONEWIZARD_H
diff --git a/src/plugins/bazaar/clonewizardpage.cpp b/src/plugins/bazaar/clonewizardpage.cpp
new file mode 100644
index 0000000000..e828bc340a
--- /dev/null
+++ b/src/plugins/bazaar/clonewizardpage.cpp
@@ -0,0 +1,70 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "clonewizardpage.h"
+#include "cloneoptionspanel.h"
+
+using namespace Bazaar::Internal;
+
+CloneWizardPage::CloneWizardPage(QWidget *parent)
+ : VCSBase::BaseCheckoutWizardPage(parent),
+ m_optionsPanel(new CloneOptionsPanel)
+{
+ setTitle(tr("Location"));
+ setSubTitle(tr("Specify repository URL, clone directory and path."));
+ setRepositoryLabel(tr("Clone URL:"));
+ setBranchSelectorVisible(false);
+ addLocalControl(m_optionsPanel);
+}
+
+const CloneOptionsPanel *CloneWizardPage::cloneOptionsPanel() const
+{
+ return m_optionsPanel;
+}
+
+QString CloneWizardPage::directoryFromRepository(const QString &repository) const
+{
+ // Bazaar repositories are generally of the form
+ // 'lp:project' or 'protocol://repositoryUrl/repository/'
+ // We are just looking for repository.
+ QString repo = repository.trimmed();
+ if (repo.startsWith(QLatin1String("lp:")))
+ return repo.mid(3);
+ else {
+ const QChar slash = QLatin1Char('/');
+ if (repo.endsWith(slash))
+ repo.truncate(repo.size() - 1);
+ // Take the basename or the repository url
+ return repo.mid(repo.lastIndexOf(slash) + 1);
+ }
+}
diff --git a/src/plugins/bazaar/clonewizardpage.h b/src/plugins/bazaar/clonewizardpage.h
new file mode 100644
index 0000000000..8c988dbe6f
--- /dev/null
+++ b/src/plugins/bazaar/clonewizardpage.h
@@ -0,0 +1,58 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef CLONEWIZARDPAGE_H
+#define CLONEWIZARDPAGE_H
+
+#include <vcsbase/basecheckoutwizardpage.h>
+
+namespace Bazaar {
+namespace Internal {
+class CloneOptionsPanel;
+
+class CloneWizardPage : public VCSBase::BaseCheckoutWizardPage
+{
+ Q_OBJECT
+public:
+ CloneWizardPage(QWidget *parent = 0);
+ const CloneOptionsPanel *cloneOptionsPanel() const;
+protected:
+ QString directoryFromRepository(const QString &repository) const;
+private:
+ CloneOptionsPanel *m_optionsPanel;
+};
+
+} //namespace Internal
+} //namespace Bazaar
+
+#endif // CLONEWIZARDPAGE_H
diff --git a/src/plugins/bazaar/commiteditor.cpp b/src/plugins/bazaar/commiteditor.cpp
new file mode 100644
index 0000000000..6b68787c78
--- /dev/null
+++ b/src/plugins/bazaar/commiteditor.cpp
@@ -0,0 +1,80 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "branchinfo.h"
+#include "commiteditor.h"
+#include "bazaarcommitwidget.h"
+
+#include <vcsbase/submitfilemodel.h>
+
+#include <QtCore/QDebug>
+
+#include <QDir> //TODO REMOVE WHEN BASE FILE CHANGES ARE PULLED
+
+using namespace Bazaar::Internal;
+
+CommitEditor::CommitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, QWidget *parent)
+ : VCSBase::VCSBaseSubmitEditor(parameters, new BazaarCommitWidget(parent)),
+ m_fileModel(0)
+{
+ setDisplayName(tr("Commit Editor"));
+}
+
+const BazaarCommitWidget *CommitEditor::commitWidget() const
+{
+ CommitEditor* nonConstThis = const_cast<CommitEditor*>(this);
+ return static_cast<const BazaarCommitWidget *>(nonConstThis->widget());
+}
+
+BazaarCommitWidget *CommitEditor::commitWidget()
+{
+ return static_cast<BazaarCommitWidget *>(widget());
+}
+
+void CommitEditor::setFields(const BranchInfo &branch,
+ const QString &userName, const QString &email,
+ const QList<QPair<QString, QString> > &repoStatus)
+{
+ BazaarCommitWidget *bazaarWidget = commitWidget();
+ if (!bazaarWidget)
+ return;
+
+ bazaarWidget->setFields(branch, userName, email);
+
+ m_fileModel = new VCSBase::SubmitFileModel(this);
+ typedef QPair<QString, QString> StringPair;
+ foreach (const StringPair &status, repoStatus)
+ if (status.first != QLatin1String("Unknown"))
+ m_fileModel->addFile(status.second, status.first, true);
+ setFileModel(m_fileModel);
+}
diff --git a/src/plugins/bazaar/commiteditor.h b/src/plugins/bazaar/commiteditor.h
new file mode 100644
index 0000000000..9f41b50103
--- /dev/null
+++ b/src/plugins/bazaar/commiteditor.h
@@ -0,0 +1,70 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef COMMITEDITOR_H
+#define COMMITEDITOR_H
+
+#include <vcsbase/vcsbasesubmiteditor.h>
+#include <QtCore/QFileInfo>
+
+namespace VCSBase {
+class SubmitFileModel;
+}
+
+namespace Bazaar {
+namespace Internal {
+
+class BranchInfo;
+class BazaarCommitWidget;
+
+class CommitEditor : public VCSBase::VCSBaseSubmitEditor
+{
+ Q_OBJECT
+public:
+ explicit CommitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters,
+ QWidget *parent);
+
+ void setFields(const BranchInfo &branch,
+ const QString &userName, const QString &email,
+ const QList<QPair<QString, QString> > &repoStatus);
+
+ const BazaarCommitWidget *commitWidget() const;
+
+private:
+ BazaarCommitWidget *commitWidget();
+ VCSBase::SubmitFileModel *m_fileModel;
+};
+
+}
+}
+#endif // COMMITEDITOR_H
diff --git a/src/plugins/bazaar/constants.h b/src/plugins/bazaar/constants.h
new file mode 100644
index 0000000000..216306e682
--- /dev/null
+++ b/src/plugins/bazaar/constants.h
@@ -0,0 +1,111 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef BAZAARCONSTANTS_H
+#define BAZAARCONSTANTS_H
+
+namespace Bazaar {
+namespace Constants {
+
+const char * const BAZAAR = "bazaar";
+const char * const BAZAARREPO = ".bzr";
+const char * const BAZAARDEFAULT = "bzr";
+
+//changeset identifiers
+const char * const CHANGESETID12 = " ([a-f0-9]{12,12}) "; //match 12 hex chars and capture
+const char * const CHANGESETID40 = " ([a-f0-9]{40,40}) ";
+const char * const CHANGEIDEXACT12 = "[a-f0-9]{12,12}"; //match 12 hex chars a
+const char * const CHANGEIDEXACT40 = "[a-f0-9]{40,40}";
+const char * const DIFFIDENTIFIER = "^[-+]{3,3} [ab]{1,1}.*"; // match e.g. +++ b/filename
+
+//BaseEditorParameters
+const char * const COMMANDLOG_ID = "Bazaar Command Log Editor";
+const char * const COMMANDLOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Bazaar Command Log Editor");
+const char * const COMMANDLOG = "Bazaar Command Log Editor";
+const char * const COMMANDAPP = "application/vnd.nokia.text.scs_bazaar_commandlog";
+const char * const COMMANDEXT = "vcsBazaarCommand";
+
+const char * const FILELOG_ID = "Bazaar File Log Editor";
+const char * const FILELOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Bazaar File Log Editor");
+const char * const FILELOG = "Bazaar File Log Editor";
+const char * const LOGAPP = "application/vnd.nokia.text.scs_bazaar_log";
+const char * const LOGEXT = "vcsBazaarLog";
+
+const char * const ANNOTATELOG_ID = "Bazaar Annotation Editor";
+const char * const ANNOTATELOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Bazaar Annotation Editor");
+const char * const ANNOTATELOG = "Bazaar Annotation Editor";
+const char * const ANNOTATEAPP = "application/vnd.nokia.text.scs_bazaar_annotatelog";
+const char * const ANNOTATEEXT = "vcsBazaarAnnotate";
+
+const char * const DIFFLOG_ID = "Bazaar Diff Editor";
+const char * const DIFFLOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Bazaar Diff Editor");
+const char * const DIFFLOG = "Bazaar Diff Editor";
+const char * const DIFFAPP = "text/x-patch";
+const char * const DIFFEXT = "diff";
+
+//SubmitEditorParameters
+const char * const COMMIT_ID = "Bazaar Commit Log Editor";
+const char * const COMMIT_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Bazaar Commit Log Editor");
+const char * const COMMITMIMETYPE = "application/vnd.nokia.text.scs_bazaar_commitlog";
+
+//menu items
+//File menu actions
+const char * const ADD = "Bazaar.AddSingleFile";
+const char * const DELETE = "Bazaar.DeleteSingleFile";
+const char * const ANNOTATE = "Bazaar.Annotate";
+const char * const DIFF = "Bazaar.DiffSingleFile";
+const char * const LOG = "Bazaar.LogSingleFile";
+const char * const REVERT = "Bazaar.RevertSingleFile";
+const char * const STATUS = "Bazaar.Status";
+
+//directory menu Actions
+const char * const DIFFMULTI = "Bazaar.Action.DiffMulti";
+const char * const REVERTMULTI = "Bazaar.Action.RevertALL";
+const char * const STATUSMULTI = "Bazaar.Action.StatusMulti";
+const char * const LOGMULTI = "Bazaar.Action.Logmulti";
+
+//repository menu actions
+const char * const PULL = "Bazaar.Action.Pull";
+const char * const PUSH = "Bazaar.Action.Push";
+const char * const UPDATE = "Bazaar.Action.Update";
+const char * const CLONE = "Bazaar.Action.Clone";
+const char * const COMMIT = "Bazaar.Action.Commit";
+const char * const CREATE_REPOSITORY = "Bazaar.Action.CreateRepository";
+
+//submit editor actions
+const char * const DIFFEDITOR = "Bazaar.Action.Editor.Diff";
+
+} // namespace Constants
+} // namespace Bazaar
+
+#endif // BAZAARCONSTANTS_H
diff --git a/src/plugins/bazaar/images/bazaar.png b/src/plugins/bazaar/images/bazaar.png
new file mode 100644
index 0000000000..19b6a8b29f
--- /dev/null
+++ b/src/plugins/bazaar/images/bazaar.png
Binary files differ
diff --git a/src/plugins/bazaar/optionspage.cpp b/src/plugins/bazaar/optionspage.cpp
new file mode 100644
index 0000000000..538210221d
--- /dev/null
+++ b/src/plugins/bazaar/optionspage.cpp
@@ -0,0 +1,139 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "optionspage.h"
+#include "constants.h"
+#include "bazaarsettings.h"
+#include "bazaarplugin.h"
+
+#include <coreplugin/icore.h>
+#include <utils/pathchooser.h>
+#include <vcsbase/vcsbaseconstants.h>
+
+#include <QtCore/QTextStream>
+
+using namespace Bazaar::Internal;
+using namespace Bazaar;
+
+OptionsPageWidget::OptionsPageWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ m_ui.setupUi(this);
+ m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
+ m_ui.commandChooser->setPromptDialogTitle(tr("Bazaar Command"));
+}
+
+BazaarSettings OptionsPageWidget::settings() const
+{
+ BazaarSettings rc;
+ rc.setBinary(m_ui.commandChooser->path());
+ rc.setUserName(m_ui.defaultUsernameLineEdit->text().trimmed());
+ rc.setEmail(m_ui.defaultEmailLineEdit->text().trimmed());
+ rc.setLogCount(m_ui.logEntriesCount->value());
+ rc.setTimeoutSeconds(m_ui.timeout->value());
+ rc.setPrompt(m_ui.promptOnSubmitCheckBox->isChecked());
+ return rc;
+}
+
+void OptionsPageWidget::setSettings(const BazaarSettings &s)
+{
+ m_ui.commandChooser->setPath(s.binary());
+ m_ui.defaultUsernameLineEdit->setText(s.userName());
+ m_ui.defaultEmailLineEdit->setText(s.email());
+ m_ui.logEntriesCount->setValue(s.logCount());
+ m_ui.timeout->setValue(s.timeoutSeconds());
+ m_ui.promptOnSubmitCheckBox->setChecked(s.prompt());
+}
+
+QString OptionsPageWidget::searchKeywords() const
+{
+ QString rc;
+ QLatin1Char sep(' ');
+ QTextStream(&rc)
+ << sep << m_ui.configGroupBox->title()
+ << sep << m_ui.mercurialCommandLabel->text()
+ << sep << m_ui.userGroupBox->title()
+ << sep << m_ui.defaultUsernameLabel->text()
+ << sep << m_ui.defaultEmailLabel->text()
+ << sep << m_ui.miscGroupBox->title()
+ << sep << m_ui.showLogEntriesLabel->text()
+ << sep << m_ui.timeoutSecondsLabel->text()
+ << sep << m_ui.promptOnSubmitCheckBox->text()
+ ;
+ rc.remove(QLatin1Char('&'));
+ return rc;
+}
+
+OptionsPage::OptionsPage()
+{
+}
+
+QString OptionsPage::id() const
+{
+ return QLatin1String(VCSBase::Constants::VCS_ID_BAZAAR);
+}
+
+QString OptionsPage::displayName() const
+{
+ return tr("Bazaar");
+}
+
+QWidget *OptionsPage::createPage(QWidget *parent)
+{
+ if (!m_optionsPageWidget)
+ m_optionsPageWidget = new OptionsPageWidget(parent);
+ m_optionsPageWidget->setSettings(BazaarPlugin::instance()->settings());
+ if (m_searchKeywords.isEmpty())
+ m_searchKeywords = m_optionsPageWidget->searchKeywords();
+ return m_optionsPageWidget;
+}
+
+void OptionsPage::apply()
+{
+ if (!m_optionsPageWidget)
+ return;
+ BazaarPlugin *plugin = BazaarPlugin::instance();
+ const BazaarSettings newSettings = m_optionsPageWidget->settings();
+ if (newSettings != plugin->settings()) {
+ //assume success and emit signal that settings are changed;
+ plugin->setSettings(newSettings);
+ newSettings.writeSettings(Core::ICore::instance()->settings(),
+ Constants::BAZAAR);
+ emit settingsChanged();
+ }
+}
+
+bool OptionsPage::matches(const QString &s) const
+{
+ return m_searchKeywords.contains(s, Qt::CaseInsensitive);
+}
diff --git a/src/plugins/bazaar/optionspage.h b/src/plugins/bazaar/optionspage.h
new file mode 100644
index 0000000000..b80ab1d13b
--- /dev/null
+++ b/src/plugins/bazaar/optionspage.h
@@ -0,0 +1,90 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef OPTIONSPAGE_H
+#define OPTIONSPAGE_H
+
+#include "ui_optionspage.h"
+
+#include <vcsbase/vcsbaseoptionspage.h>
+
+#include <QtGui/QWidget>
+#include <QtCore/QPointer>
+
+namespace Bazaar {
+namespace Internal {
+
+class BazaarSettings;
+
+class OptionsPageWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit OptionsPageWidget(QWidget *parent = 0);
+
+ BazaarSettings settings() const;
+ void setSettings(const BazaarSettings &s);
+ QString searchKeywords() const;
+
+private:
+ Ui::OptionsPage m_ui;
+};
+
+
+class OptionsPage : public VCSBase::VCSBaseOptionsPage
+{
+ Q_OBJECT
+
+public:
+ OptionsPage();
+ QString id() const;
+ QString displayName() const;
+
+ QWidget *createPage(QWidget *parent);
+ void apply();
+ void finish() { }
+ bool matches(const QString &s) const;
+
+signals:
+ void settingsChanged();
+
+private:
+ QString m_searchKeywords;
+ QPointer<OptionsPageWidget> m_optionsPageWidget;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // OPTIONSPAGE_H
diff --git a/src/plugins/bazaar/optionspage.ui b/src/plugins/bazaar/optionspage.ui
new file mode 100644
index 0000000000..046db37a25
--- /dev/null
+++ b/src/plugins/bazaar/optionspage.ui
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Bazaar::Internal::OptionsPage</class>
+ <widget class="QWidget" name="Bazaar::Internal::OptionsPage">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>359</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="configGroupBox">
+ <property name="title">
+ <string>Configuration</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="mercurialCommandLabel">
+ <property name="text">
+ <string>Command:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="Utils::PathChooser" name="commandChooser" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="userGroupBox">
+ <property name="title">
+ <string>User</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="defaultUsernameLabel">
+ <property name="toolTip">
+ <string>Username to use by default on commit.</string>
+ </property>
+ <property name="text">
+ <string>Default username:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="defaultUsernameLineEdit">
+ <property name="toolTip">
+ <string>Username to use by default on commit.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="defaultEmailLabel">
+ <property name="toolTip">
+ <string>Email to use by default on commit.</string>
+ </property>
+ <property name="text">
+ <string>Default email:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="defaultEmailLineEdit">
+ <property name="toolTip">
+ <string>Email to use by default on commit.</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="miscGroupBox">
+ <property name="title">
+ <string>Miscellaneous</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="showLogEntriesLabel">
+ <property name="text">
+ <string>Log count:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="logEntriesCount">
+ <property name="toolTip">
+ <string>The number of recent commit logs to show, choose 0 to see all enteries</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="timeoutSecondsLabel">
+ <property name="text">
+ <string>Timeout:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="timeout">
+ <property name="suffix">
+ <string>s</string>
+ </property>
+ <property name="value">
+ <number>30</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QCheckBox" name="promptOnSubmitCheckBox">
+ <property name="text">
+ <string>Prompt on submit</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::PathChooser</class>
+ <extends>QWidget</extends>
+ <header location="global">utils/pathchooser.h</header>
+ <container>1</container>
+ <slots>
+ <signal>editingFinished()</signal>
+ <signal>browsingFinished()</signal>
+ </slots>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/plugins/bazaar/pullorpushdialog.cpp b/src/plugins/bazaar/pullorpushdialog.cpp
new file mode 100644
index 0000000000..75b90dbbef
--- /dev/null
+++ b/src/plugins/bazaar/pullorpushdialog.cpp
@@ -0,0 +1,122 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "pullorpushdialog.h"
+#include "ui_pullorpushdialog.h"
+
+
+using namespace Bazaar::Internal;
+
+PullOrPushDialog::PullOrPushDialog(Mode mode, QWidget *parent) :
+ QDialog(parent),
+ m_mode(mode),
+ m_ui(new Ui::PullOrPushDialog)
+{
+ m_ui->setupUi(this);
+ m_ui->localPathChooser->setExpectedKind(Utils::PathChooser::Directory);
+ if (m_mode == PullMode)
+ {
+ this->setWindowTitle(tr("Pull source"));
+ m_ui->useExistingDirCheckBox->setVisible(false);
+ m_ui->createPrefixCheckBox->setVisible(false);
+ }
+ else
+ {
+ this->setWindowTitle(tr("Push destination"));
+ m_ui->localCheckBox->setVisible(false);
+ }
+ this->adjustSize();
+}
+
+PullOrPushDialog::~PullOrPushDialog()
+{
+ delete m_ui;
+}
+
+QString PullOrPushDialog::branchLocation() const
+{
+ if (m_ui->defaultButton->isChecked())
+ return QString();
+ else if (m_ui->localButton->isChecked())
+ return m_ui->localPathChooser->path();
+ else
+ return m_ui->urlLineEdit->text();
+}
+
+bool PullOrPushDialog::isRememberOptionEnabled() const
+{
+ if (m_ui->defaultButton->isChecked())
+ return false;
+ else
+ return m_ui->rememberCheckBox->isChecked();
+}
+
+bool PullOrPushDialog::isOverwriteOptionEnabled() const
+{
+ return m_ui->overwriteCheckBox->isChecked();
+}
+
+QString PullOrPushDialog::revision() const
+{
+ return m_ui->revisionLineEdit->text().simplified();
+}
+
+bool PullOrPushDialog::isLocalOptionEnabled() const
+{
+ Q_ASSERT(m_mode == PullMode);
+ return m_ui->localCheckBox->isChecked();
+}
+
+bool PullOrPushDialog::isUseExistingDirectoryOptionEnabled() const
+{
+ Q_ASSERT(m_mode == PushMode);
+ return m_ui->useExistingDirCheckBox->isChecked();
+}
+
+bool PullOrPushDialog::isCreatePrefixOptionEnabled() const
+{
+ Q_ASSERT(m_mode == PushMode);
+ return m_ui->createPrefixCheckBox->isChecked();
+}
+
+void PullOrPushDialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ m_ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
diff --git a/src/plugins/bazaar/pullorpushdialog.h b/src/plugins/bazaar/pullorpushdialog.h
new file mode 100644
index 0000000000..aab4980526
--- /dev/null
+++ b/src/plugins/bazaar/pullorpushdialog.h
@@ -0,0 +1,81 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Hugues Delorme
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, 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.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef PULLORPUSHDIALOG_H
+#define PULLORPUSHDIALOG_H
+
+#include <QtGui/QDialog>
+#include <utils/pathchooser.h>
+
+namespace Bazaar {
+namespace Internal {
+
+namespace Ui {
+class PullOrPushDialog;
+}
+
+class PullOrPushDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ enum Mode {
+ PullMode,
+ PushMode
+ };
+
+ PullOrPushDialog(Mode mode, QWidget *parent = 0);
+ ~PullOrPushDialog();
+
+ // Common parameters and options
+ QString branchLocation() const;
+ bool isRememberOptionEnabled() const;
+ bool isOverwriteOptionEnabled() const;
+ QString revision() const;
+ // Pull-specific options
+ bool isLocalOptionEnabled() const;
+ // Push-specific options
+ bool isUseExistingDirectoryOptionEnabled() const;
+ bool isCreatePrefixOptionEnabled() const;
+
+protected:
+ void changeEvent(QEvent *e);
+
+private:
+ Mode m_mode;
+ Ui::PullOrPushDialog *m_ui;
+};
+
+} // namespace Internal
+} // namespace Bazaar
+
+#endif // PULLORPUSHDIALOG_H
diff --git a/src/plugins/bazaar/pullorpushdialog.ui b/src/plugins/bazaar/pullorpushdialog.ui
new file mode 100644
index 0000000000..efc2645e5e
--- /dev/null
+++ b/src/plugins/bazaar/pullorpushdialog.ui
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Bazaar::Internal::PullOrPushDialog</class>
+ <widget class="QDialog" name="Bazaar::Internal::PullOrPushDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>327</width>
+ <height>334</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Branch location</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="defaultButton">
+ <property name="text">
+ <string>Default Location</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="localButton">
+ <property name="text">
+ <string>Local filesystem:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="Utils::PathChooser" name="localPathChooser" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QRadioButton" name="urlButton">
+ <property name="toolTip">
+ <string>e.g. https://[user[:pass]@]host[:port]/[path]</string>
+ </property>
+ <property name="text">
+ <string>Specify Url:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="urlLineEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>e.g. https://[user[:pass]@]host[:port]/[path]</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0" colspan="2">
+ <widget class="QCheckBox" name="rememberCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Remember specified location as default</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QCheckBox" name="overwriteCheckBox">
+ <property name="toolTip">
+ <string>Ignore differences between branches and overwrite
+unconditionally</string>
+ </property>
+ <property name="text">
+ <string>Overwrite</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QCheckBox" name="useExistingDirCheckBox">
+ <property name="toolTip">
+ <string>By default push will fail if the target directory exists, but does not already have a control directory.
+This flag will allow push to proceed</string>
+ </property>
+ <property name="text">
+ <string>Use exisiting directory</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QCheckBox" name="createPrefixCheckBox">
+ <property name="toolTip">
+ <string>Create the path leading up to the branch if it does not already exist</string>
+ </property>
+ <property name="text">
+ <string>Create prefix</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Revision:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLineEdit" name="revisionLineEdit"/>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QCheckBox" name="localCheckBox">
+ <property name="toolTip">
+ <string>Perform a local pull in a bound branch.
+Local pulls are not applied to the master branch</string>
+ </property>
+ <property name="text">
+ <string>Local</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>4</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::PathChooser</class>
+ <extends>QWidget</extends>
+ <header location="global">utils/pathchooser.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>Bazaar::Internal::PullOrPushDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>257</x>
+ <y>177</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>Bazaar::Internal::PullOrPushDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>325</x>
+ <y>177</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>urlButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>urlLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>80</x>
+ <y>121</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>332</x>
+ <y>123</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>localButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>localPathChooser</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>112</x>
+ <y>81</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>346</x>
+ <y>81</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>urlButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>rememberCheckBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>71</x>
+ <y>92</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>163</x>
+ <y>153</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>localButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>rememberCheckBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>71</x>
+ <y>67</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>163</x>
+ <y>153</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/plugins/bazaar/revertdialog.ui b/src/plugins/bazaar/revertdialog.ui
new file mode 100644
index 0000000000..1be40992c4
--- /dev/null
+++ b/src/plugins/bazaar/revertdialog.ui
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Bazaar::Internal::RevertDialog</class>
+ <widget class="QDialog" name="Bazaar::Internal::RevertDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>162</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Revert</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Specify a revision other than the default?</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <widget class="QWidget" name="formLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>361</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="revisionLabel">
+ <property name="text">
+ <string>Revision:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="revisionLineEdit"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>Bazaar::Internal::RevertDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>Bazaar::Internal::RevertDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>