diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -84,7 +84,6 @@ # BEGIN: VCS ecm_optional_add_subdirectory(bazaar) -ecm_optional_add_subdirectory(cvs) ecm_optional_add_subdirectory(git) ecm_optional_add_subdirectory(perforce) diff --git a/plugins/cvs/CMakeLists.txt b/plugins/cvs/CMakeLists.txt deleted file mode 100644 --- a/plugins/cvs/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"kdevcvs\") - -########### next target ############### - -ecm_qt_declare_logging_category(kdevcvs_LOG_PART_SRCS - HEADER debug.h - IDENTIFIER PLUGIN_CVS - CATEGORY_NAME "kdevelop.plugins.cvs" -) - -set(kdevcvs_PART_SRCS - cvsplugin.cpp - cvsmainview.cpp - cvsgenericoutputview.cpp - cvsjob.cpp - cvsproxy.cpp - editorsview.cpp - commitdialog.cpp - importmetadatawidget.cpp - importdialog.cpp - checkoutdialog.cpp - cvsannotatejob.cpp - cvslogjob.cpp - cvsdiffjob.cpp - cvsstatusjob.cpp - ${kdevcvs_LOG_PART_SRCS} -) - -set(kdevcvs_PART_UI - cvsmainview.ui - cvsgenericoutputview.ui - editorsview.ui - commitdialog.ui - importmetadatawidget.ui - checkoutdialog.ui -) - -ki18n_wrap_ui(kdevcvs_PART_SRCS ${kdevcvs_PART_UI}) - -qt5_add_resources(kdevcvs_PART_SRCS kdevcvs.qrc) -kdevplatform_add_plugin(kdevcvs JSON kdevcvs.json SOURCES ${kdevcvs_PART_SRCS}) - -target_link_libraries(kdevcvs - KF5::KIOWidgets - KF5::Parts - KDev::Util - KDev::Interfaces - KDev::Vcs - KDev::Project - KDev::Language -) - -if(BUILD_TESTING) - add_subdirectory(tests) -endif() diff --git a/plugins/cvs/DESIGN.txt b/plugins/cvs/DESIGN.txt deleted file mode 100644 --- a/plugins/cvs/DESIGN.txt +++ /dev/null @@ -1,59 +0,0 @@ -CVS plugin for KDevelop4 -======================== -(C) Robert Gruber [rgruber A users!sourceforge!net] - - -The CVS plugin is separated into three part. - -1) The CvsPart (cvspart.h) - It is the main entry point to the CVS plugin. By implementing - the IVersionControl interface it offers a lot of slots that will - invoke the different CVS actions. - This class serves as a dispatcher. It takes the urls and options - for the requested CVS action and passes them to the CvsProxy (#2) - to get a CvsJob returned. After starting, the job's result() signal - gets connected either directly to CvsMainView (#3) or to a custom - output view. - -2) CvsProxy (cvsproxy.h) and CvsJob (cvsjob.h) - The CvsProxy serves as a single point of entry for creating the - CvsJobs. The proxy offers a list of methods for the different - supported CVS actions. Each of these methods will return a CvsJob - object. So the caller does not have to worry about the whole - job and commandline creation. Calling the appropriate method will - do all the work and return a CvsJob object ready for starting. - -3) The CvsMainView (cvsmainview.h) and custom view (like editorsview.h) - The CvsMainView displays output from finished jobs. It holds a - KTabWidget to which everbody can add custom output views. For - instance when the user requested a "cvs log" action, a new view - will be added. This view will then parse the output of the "cvs log" - job and display it in a nice way. - But it does not make sense to add new views for every cvs action. - For example, adding a new view everytime "cvs commit", "cvs edit" or - similar actions get executed would be an overkill. Therefore - CvsMainView also provides a generic output view that just displays - the plain text output from such jobs. Unlike custom views, this - generic view can not be closed and it will simply append the output - from each job that got connected to it. - - - -The workflow of the CVS plugin looks like this: -1) The user requests a CVS action -2) The matching slot from CvsPart will be called -3) Optional: The user may be prompted for additional input - [ see: CvsPart::commit() ] -4) CvsPart passes all needed options to the CvsProxy by calling - it's method for the requested action. -5) CvsProxy assembles the commandline, creates a CvsJob object and - returns a pointer to the CvsJobs object -6) CvsPart calls start() for the returned CvsJob object and continues - with either #6.1 or #6.2 -6.1) Connectes the job's result() signal to the generic output view - from CvsMainView -6.2) Creates a custom view, connects the job's result() signal to it - and adds the view to CvsMainView - - - diff --git a/plugins/cvs/Messages.sh b/plugins/cvs/Messages.sh deleted file mode 100644 --- a/plugins/cvs/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -$EXTRACTRC `find . -name \*.rc` `find . -name \*.ui` >> rc.cpp -$XGETTEXT `find . -name \*.cc -o -name \*.cpp -o -name \*.h` -o $podir/kdevcvs.pot -rm -f rc.cpp diff --git a/plugins/cvs/checkoutdialog.h b/plugins/cvs/checkoutdialog.h deleted file mode 100644 --- a/plugins/cvs/checkoutdialog.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CHECKOUTDIALOG_H -#define KDEVPLATFORM_PLUGIN_CHECKOUTDIALOG_H - -#include -#include - -#include - -#include "ui_checkoutdialog.h" - -class CvsPlugin; - -/** - * Allows the user to define from where to checkout - * @author Robert Gruber - */ -class CheckoutDialog : public QDialog, private Ui::CheckoutDialogBase -{ - Q_OBJECT -public: - explicit CheckoutDialog(CvsPlugin* plugin, QWidget *parent=nullptr); - ~CheckoutDialog() override; - -public Q_SLOTS: - void accept() override; - void jobFinished(KJob* job); - -private: - CvsPlugin* m_plugin; -}; - -#endif diff --git a/plugins/cvs/checkoutdialog.cpp b/plugins/cvs/checkoutdialog.cpp deleted file mode 100644 --- a/plugins/cvs/checkoutdialog.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "checkoutdialog.h" - -#include -#include - -#include -#include - -#include "cvsplugin.h" -#include "cvsjob.h" -#include "cvsproxy.h" -#include "debug.h" - -CheckoutDialog::CheckoutDialog(CvsPlugin* plugin, QWidget *parent) - : QDialog(parent), Ui::CheckoutDialogBase(), m_plugin(plugin) -{ - Ui::CheckoutDialogBase::setupUi(this); - - localWorkingDir->setMode(KFile::Directory); -} - -CheckoutDialog::~CheckoutDialog() -{ -} - -void CheckoutDialog::accept() -{ - CvsJob *job = m_plugin->proxy()->checkout( - localWorkingDir->url(), - serverPath->text(), - module->currentText(), - QString(), - tag->text()); - if (job) { - connect(job, &CvsJob::result, - this, &CheckoutDialog::jobFinished); - KDevelop::ICore::self()->runController()->registerJob(job); - } -} - -void CheckoutDialog::jobFinished(KJob * job) -{ - if (job->error()) { - KMessageBox::error(this, i18n("Error on checkout"), i18n("Checkout Error")); - return; - } - - // The job finished, now let's check the output is everything was OK - CvsJob* cvsjob = static_cast(job); - - static QRegExp re_file("^.\\s(.*)"); - bool error = false; - QStringList lines = cvsjob->output().split('\n'); - foreach(const QString &line, lines) { - if (line.isEmpty()) { - // ignore empty lines - continue; - } else if (re_file.exactMatch(line)) { - // line that tell us that a file has been checkedout - continue; - } else { - // any other line must mean that an error occurred - qCDebug(PLUGIN_CVS) << line; - error = true; - } - } - - if (error) { - KMessageBox::error(this, - i18n("Some errors occurred while checking out into %1", localWorkingDir->url().toLocalFile()), - i18n("Checkout Error")); - } else { - QDialog::accept(); - } -} - diff --git a/plugins/cvs/checkoutdialog.ui b/plugins/cvs/checkoutdialog.ui deleted file mode 100644 --- a/plugins/cvs/checkoutdialog.ui +++ /dev/null @@ -1,156 +0,0 @@ - - CheckoutDialogBase - - - - 0 - 0 - 400 - 252 - - - - Checkout - - - - - - - - &Local destination directory: - - - false - - - localWorkingDir - - - - - - - - - - - - - - - 0 - 0 - - - - &Server path (e.g. :pserver:username@cvs.example.com:/cvsroot): - - - false - - - serverPath - - - - - - - - - - - - - - &Module: - - - module - - - - - - - true - - - - - - - - - - - Tag/Branch: - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - KUrlRequester - QWidget -
kurlrequester.h
-
-
- - - - buttonBox - accepted() - CheckoutDialogBase - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - CheckoutDialogBase - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/plugins/cvs/commitdialog.h b/plugins/cvs/commitdialog.h deleted file mode 100644 --- a/plugins/cvs/commitdialog.h +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_COMMITDIALOG_H -#define KDEVPLATFORM_PLUGIN_COMMITDIALOG_H - -#include -#include - -#include "ui_commitdialog.h" - -/** - * Allows to enter text which can them be used as - * parameter for @code cvs commit @endcode - * @author Robert Gruber - */ -class CommitDialog : public QDialog, private Ui::CommitDialogBase -{ -Q_OBJECT -public: - explicit CommitDialog(QDialog *parent = nullptr); - ~CommitDialog() override; - - /** - * @return The text entered by the user - */ - QString message() { return textedit->toPlainText(); } -}; - -#endif diff --git a/plugins/cvs/commitdialog.cpp b/plugins/cvs/commitdialog.cpp deleted file mode 100644 --- a/plugins/cvs/commitdialog.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "commitdialog.h" - -CommitDialog::CommitDialog(QDialog *parent) - : QDialog(parent), Ui::CommitDialogBase() -{ - Ui::CommitDialogBase::setupUi(this); -} - -CommitDialog::~CommitDialog() -{ -} - diff --git a/plugins/cvs/commitdialog.ui b/plugins/cvs/commitdialog.ui deleted file mode 100644 --- a/plugins/cvs/commitdialog.ui +++ /dev/null @@ -1,82 +0,0 @@ - - CommitDialogBase - - - - 0 - 0 - 387 - 269 - - - - Commit to Repository - - - - - - Message - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - KTextEdit - QTextEdit -
ktextedit.h
-
-
- - - - buttonBox - accepted() - CommitDialogBase - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - CommitDialogBase - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/plugins/cvs/cvsannotatejob.h b/plugins/cvs/cvsannotatejob.h deleted file mode 100644 --- a/plugins/cvs/cvsannotatejob.h +++ /dev/null @@ -1,36 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSANNOTATEJOB_H -#define KDEVPLATFORM_PLUGIN_CVSANNOTATEJOB_H - -#include - -#include "cvsjob.h" - -/** - * @author Robert Gruber - */ -class CvsAnnotateJob : public CvsJob -{ - Q_OBJECT -public: - explicit CvsAnnotateJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity = KDevelop::OutputJob::Verbose); - ~CvsAnnotateJob() override; - - // Begin: KDevelop::VcsJob - QVariant fetchResults() override; - // End: KDevelop::VcsJob - -private: - void parseOutput(const QString& jobOutput, const QString& workingDirectory, KDevelop::VcsAnnotation& annotateInfo); -}; - -#endif diff --git a/plugins/cvs/cvsannotatejob.cpp b/plugins/cvs/cvsannotatejob.cpp deleted file mode 100644 --- a/plugins/cvs/cvsannotatejob.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsannotatejob.h" -#include "debug.h" - -#include -#include -#include -#include - -#include - -CvsAnnotateJob::CvsAnnotateJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) - : CvsJob(parent, verbosity) -{ -} - -CvsAnnotateJob::~CvsAnnotateJob() -{ -} - -QVariant CvsAnnotateJob::fetchResults() -{ - // Convert job's output into KDevelop::VcsAnnotation - KDevelop::VcsAnnotation annotateInfo; - parseOutput(output(), getDirectory(), annotateInfo); - - QList lines; - for(int i=0; i < annotateInfo.lineCount(); i++) { - KDevelop::VcsAnnotationLine line = annotateInfo.line(i); - lines.append( qVariantFromValue( line ) ); - } - - return lines; -} - -void CvsAnnotateJob::parseOutput(const QString& jobOutput, const QString& workingDirectory, KDevelop::VcsAnnotation& annotateInfo) -{ - // each annotation line looks like this: - // 1.1 (kdedev 10-Nov-07): #include - static QRegExp re("([^\\s]+)\\s+\\(([^\\s]+)\\s+([^\\s]+)\\):\\s(.*)"); - - // the file is pomoted like this: - // Annotations for main.cpp - static QRegExp reFile("Annotations for\\s(.*)"); - - QStringList lines = jobOutput.split('\n'); - - for (int i=0, linenumber=0; i * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSDIFFJOB_H -#define KDEVPLATFORM_PLUGIN_CVSDIFFJOB_H - -#include "cvsjob.h" - -#include - -/** - * @author Robert Gruber - */ -class CvsDiffJob : public CvsJob -{ - Q_OBJECT -public: - explicit CvsDiffJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity = KDevelop::OutputJob::Verbose); - ~CvsDiffJob() override; - - // Begin: KDevelop::VcsJob - QVariant fetchResults() override; - // End: KDevelop::VcsJob - -private: - // Begin: KDevelop::DVcsJob - void slotProcessError(QProcess::ProcessError error) override; - // End: KDevelop::DVcsJob -}; - -#endif diff --git a/plugins/cvs/cvsdiffjob.cpp b/plugins/cvs/cvsdiffjob.cpp deleted file mode 100644 --- a/plugins/cvs/cvsdiffjob.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsdiffjob.h" - -#include - -CvsDiffJob::CvsDiffJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) - : CvsJob(parent, verbosity) -{ -} - -CvsDiffJob::~CvsDiffJob() -{ -} - -QVariant CvsDiffJob::fetchResults() -{ - KDevelop::VcsDiff diff; - diff.setBaseDiff( QUrl::fromLocalFile(process()->workingDirectory()) ); - - diff.setDiff( output() ); - - /// @todo check output of "cvs diff" if it reported binary files - diff.setContentType( KDevelop::VcsDiff::Text ); - - /// @todo hmmm, we always call "cvs diff" with it's -u option - /// but if this option would be omitted cvs would return an other format - diff.setType( KDevelop::VcsDiff::DiffUnified ); - - return qVariantFromValue( diff ); -} - -void CvsDiffJob::slotProcessError(QProcess::ProcessError error) { - // Do not blindly raise an error on non-zero return code of "cvs diff". - // If its output contains the "Index:" mark, the diff is probably intact, - // and non-zero return code indicates just that there are changes. - if (error == QProcess::UnknownError && output().contains(QStringLiteral("Index:"))) - return; - - KDevelop::DVcsJob::slotProcessError(error); -} - diff --git a/plugins/cvs/cvsgenericoutputview.h b/plugins/cvs/cvsgenericoutputview.h deleted file mode 100644 --- a/plugins/cvs/cvsgenericoutputview.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSGENERICOUTPUTVIEW_H -#define KDEVPLATFORM_PLUGIN_CVSGENERICOUTPUTVIEW_H - -#include -#include - -#include "ui_cvsgenericoutputview.h" - -class CvsPlugin; -class CvsJob; - -/** - * Shows plain text. - * - * Text can either be added directly by calling appendText(). - * - * Or by connecting a job's result() signal to slotJobFinished(). - * - * @author Robert Gruber - */ -class CvsGenericOutputView : public QWidget, private Ui::CvsGenericOutputViewBase { - Q_OBJECT -public: - explicit CvsGenericOutputView(CvsJob* job = nullptr, QWidget* parent = nullptr); - ~CvsGenericOutputView() override; - -public Q_SLOTS: - void appendText(const QString& text); - void slotJobFinished(KJob* job); -}; - -#endif diff --git a/plugins/cvs/cvsgenericoutputview.cpp b/plugins/cvs/cvsgenericoutputview.cpp deleted file mode 100644 --- a/plugins/cvs/cvsgenericoutputview.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsgenericoutputview.h" - -#include "cvsjob.h" -#include - -CvsGenericOutputView::CvsGenericOutputView(CvsJob* job, QWidget* parent) - : QWidget(parent), Ui::CvsGenericOutputViewBase() -{ - Ui::CvsGenericOutputViewBase::setupUi(this); - - if (job) { - connect(job, &CvsJob::result, - this, &CvsGenericOutputView::slotJobFinished); - } -} - -CvsGenericOutputView::~CvsGenericOutputView() -{ -} - -void CvsGenericOutputView::appendText(const QString& text) -{ - textArea->append(text); -} - -void CvsGenericOutputView::slotJobFinished(KJob * job) -{ - CvsJob * cvsjob = dynamic_cast(job); - if (cvsjob) { - appendText( cvsjob->cvsCommand() ); - appendText( cvsjob->output() ); - if (job->error() == 0) { - appendText( i18n("Job exited normally") ); - } else { - appendText( job->errorText() ); - } - } -} - diff --git a/plugins/cvs/cvsgenericoutputview.ui b/plugins/cvs/cvsgenericoutputview.ui deleted file mode 100644 --- a/plugins/cvs/cvsgenericoutputview.ui +++ /dev/null @@ -1,45 +0,0 @@ - - CvsGenericOutputViewBase - - - - 0 - 0 - 400 - 112 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QTextEdit::NoWrap - - - true - - - - - - - - diff --git a/plugins/cvs/cvsjob.h b/plugins/cvs/cvsjob.h deleted file mode 100644 --- a/plugins/cvs/cvsjob.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * This file was partly taken from cervisia's cvsservice * - * Copyright 2002-2003 Christian Loose * - * * - * Adapted for KDevelop * - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSJOB_H -#define KDEVPLATFORM_PLUGIN_CVSJOB_H - - -#include -#include -#include - -/** - * This class is capable of running our cvs commands - * Connect to Kjob::result(KJob*) to be notified when the job finished. - * @author Robert Gruber - */ -class CvsJob : public KDevelop::DVcsJob -{ - Q_OBJECT -public: - explicit CvsJob(const QDir& workingDir, KDevelop::IPlugin* parent=nullptr, KDevelop::OutputJob::OutputJobVerbosity verbosity = KDevelop::OutputJob::Verbose); - - explicit CvsJob(KDevelop::IPlugin* parent = nullptr, KDevelop::OutputJob::OutputJobVerbosity verbosity = KDevelop::OutputJob::Verbose); - - ~CvsJob() override; - - /** - * @return The command that is executed when calling start() - */ - QString cvsCommand(); - void clear(); - void setDirectory(const QString& directory); - QString getDirectory(); - - void setRSH(const QString& rsh); - void setServer(const QString& server); - - /** - * Call this method to start this job. - * @note Default communication mode is KProcess::AllOutput. - * @see Use setCommunicationMode() to override the default communication mode. - */ - void start() override; - -private: - class CvsJobPrivate* const d; -}; - -#endif diff --git a/plugins/cvs/cvsjob.cpp b/plugins/cvs/cvsjob.cpp deleted file mode 100644 --- a/plugins/cvs/cvsjob.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * This file was partly taken from cervisia's cvsservice * - * Copyright 2002-2003 Christian Loose * - * * - * Adapted for KDevelop * - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsjob.h" - -#include -#include - -#include -#include - -class CvsJobPrivate -{ -public: - QString server; - QString rsh; -}; - - -CvsJob::CvsJob(const QDir& workingDir, KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) - : DVcsJob(workingDir, parent, verbosity), d(new CvsJobPrivate) -{ -} - -CvsJob::CvsJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) - : DVcsJob(QDir::home(), parent, verbosity), d(new CvsJobPrivate) -{ -} - -CvsJob::~CvsJob() -{ - delete d; -} - -QString CvsJob::cvsCommand() -{ - return dvcsCommand().join(QLatin1Char(' ')); -} - -void CvsJob::clear() -{ - process()->clearEnvironment(); -} - -void CvsJob::setDirectory(const QString& directory) -{ - process()->setWorkingDirectory(directory); -} - -QString CvsJob::getDirectory() -{ - return directory().absolutePath(); -} - -void CvsJob::setRSH(const QString& rsh) -{ - d->rsh = rsh; -} - -void CvsJob::setServer(const QString& server) -{ - d->server = server; -} - -void CvsJob::start() -{ - if( !d->rsh.isEmpty() ) { - process()->setEnv(QStringLiteral("CVS_RSH"), d->rsh); - } - - if( !d->server.isEmpty() ) { - process()->setEnv(QStringLiteral("CVS_SERVER"), d->server); - } - - DVcsJob::start(); -} - diff --git a/plugins/cvs/cvslogjob.h b/plugins/cvs/cvslogjob.h deleted file mode 100644 --- a/plugins/cvs/cvslogjob.h +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSLOGJOB_H -#define KDEVPLATFORM_PLUGIN_CVSLOGJOB_H - -#include "cvsjob.h" - -/** - * @author Robert Gruber - */ -class CvsLogJob : public CvsJob -{ - Q_OBJECT -public: - explicit CvsLogJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity = KDevelop::OutputJob::Verbose); - ~CvsLogJob() override; - - // Begin: KDevelop::VcsJob - QVariant fetchResults() override; - // End: KDevelop::VcsJob - -private: - void parseOutput(const QString& jobOutput, QList& events); -}; - -#endif diff --git a/plugins/cvs/cvslogjob.cpp b/plugins/cvs/cvslogjob.cpp deleted file mode 100644 --- a/plugins/cvs/cvslogjob.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvslogjob.h" -#include "debug.h" - -#include -#include - -#include -#include - -CvsLogJob::CvsLogJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) - : CvsJob(parent, verbosity) -{ -} - -CvsLogJob::~CvsLogJob() -{ -} - -QVariant CvsLogJob::fetchResults() -{ - // Convert job's output into KDevelop::VcsEvent - QList events; - parseOutput(output(), events); - - return events; -} - -void CvsLogJob::parseOutput(const QString& jobOutput, QList& events) -{ - static QRegExp rx_sep( "[-=]+" ); - static QRegExp rx_rev( "revision ((\\d+\\.?)+)" ); - static QRegExp rx_branch( "branches:\\s+(.*)" ); - static QRegExp rx_date( "date:\\s+([^;]*);\\s+author:\\s+([^;]*).*" ); - - - QStringList lines = jobOutput.split('\n'); - - KDevelop::VcsEvent item; - bool firstSeperatorReached = false; - QString log; - - for (int i=0; i * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSMAINVIEW_H -#define KDEVPLATFORM_PLUGIN_CVSMAINVIEW_H - -#include -#include -#include - -#include "ui_cvsmainview.h" - -class CvsPlugin; -class CvsGenericOutputView; - -/** - * This class is the main output view of KDevelop's CVS plugin. - * It only constists out of a QTabWidget. - * - * When created, a CvsGenericOutputView will be inserted. - * - * Inserting text into that default output view is possible via the - * slotJobFinished() slot. - * - * Additional tabs can be added via slotAddTab(). - * - * @author Robert Gruber - */ -class CvsMainView : public QWidget, private Ui::CvsMainViewBase { - Q_OBJECT -public: - CvsMainView(CvsPlugin *plugin, QWidget* parent); - ~CvsMainView() override; - -public Q_SLOTS: - /** - * Inserts @p tag into the QTabWidget and calls it @p label . - * This slot gets connected to CvsPlugin::addNewTabToMainView(). - */ - void slotAddTab(QWidget* tab, const QString& label); - - /** - * When this slot gets called, the output of the job will be written to - * the default outputview of the QTabWidget. - * This slot gets connected to CvsPlugin::jobFinished(). - */ - void slotJobFinished(KJob* job); - - /** - * Closes the current active tab (if it's not the first tab) - */ - void slotTabClose(); - -private: - CvsPlugin* m_plugin; - CvsGenericOutputView* m_mainview; - QToolButton* m_closeButton; -}; - -#endif diff --git a/plugins/cvs/cvsmainview.cpp b/plugins/cvs/cvsmainview.cpp deleted file mode 100644 --- a/plugins/cvs/cvsmainview.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsmainview.h" - -#include - -#include "cvsplugin.h" -#include "cvsjob.h" -#include "cvsgenericoutputview.h" -#include "debug.h" - -CvsMainView::CvsMainView( CvsPlugin *plugin, QWidget* parent ) - : QWidget( parent ), - Ui::CvsMainViewBase(), - m_plugin(plugin) -{ - Ui::CvsMainViewBase::setupUi(this); - setWindowTitle(i18n("CVS")); - - // CvsPlugin will notify when a job finished - connect(m_plugin, &CvsPlugin::jobFinished, - this, &CvsMainView::slotJobFinished); - - // allow appending of new views - connect(m_plugin, &CvsPlugin::addNewTabToMainView, - this, &CvsMainView::slotAddTab ); - - // create a default output view - m_mainview = new CvsGenericOutputView; - tabwidget->addTab( m_mainview, i18n("CVS") ); - - // add a close button as corner widget - m_closeButton = new QToolButton(tabwidget); - m_closeButton->setIcon( QIcon::fromTheme( QStringLiteral("tab-close") ) ); - m_closeButton->adjustSize(); - m_closeButton->setAutoRaise(true); - m_closeButton->setEnabled(false); - tabwidget->setCornerWidget( m_closeButton ); - connect(m_closeButton, &QToolButton::clicked, - this, &CvsMainView::slotTabClose); -} - -CvsMainView::~CvsMainView() -{ - delete m_mainview; -} - -void CvsMainView::slotAddTab(QWidget * tab, const QString& label) -{ - qCDebug(PLUGIN_CVS) << "adding tab:" << label; - - int idx = tabwidget->addTab( tab, label ); - tabwidget->setCurrentIndex(idx); - - if (tabwidget->count() > 1) - m_closeButton->setEnabled(true); -} - -void CvsMainView::slotJobFinished(KJob * job) -{ - m_mainview->slotJobFinished(job); - tabwidget->setCurrentIndex(0); -} - -void CvsMainView::slotTabClose() -{ - int idx = tabwidget->currentIndex(); - - // don't allow to close the first tab - if (idx != 0) - tabwidget->removeTab( idx ); - - // if only the first tab remains, disable the close button - if (tabwidget->count() <= 1) - m_closeButton->setEnabled(false); -} - diff --git a/plugins/cvs/cvsmainview.ui b/plugins/cvs/cvsmainview.ui deleted file mode 100644 --- a/plugins/cvs/cvsmainview.ui +++ /dev/null @@ -1,32 +0,0 @@ - - CvsMainViewBase - - - - 0 - 0 - 400 - 300 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - diff --git a/plugins/cvs/cvsplugin.h b/plugins/cvs/cvsplugin.h deleted file mode 100644 --- a/plugins/cvs/cvsplugin.h +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSPLUGIN_H -#define KDEVPLATFORM_PLUGIN_CVSPLUGIN_H - -#include -#include - -#include -#include -#include -#include - -class CvsProxy; - -/** - * This is the main class of KDevelop's CVS plugin. - * - * It implements the IVersionControl interface. - * - * @author Robert Gruber - */ -class CvsPlugin : public KDevelop::IPlugin, public KDevelop::ICentralizedVersionControl -{ - Q_OBJECT - Q_INTERFACES(KDevelop::IBasicVersionControl KDevelop::ICentralizedVersionControl) - - friend class CvsProxy; - -public: - explicit CvsPlugin(QObject *parent, const QVariantList & args = QVariantList()); - ~CvsPlugin() override; - - void unload() override; - - QString name() const override; - KDevelop::VcsImportMetadataWidget* createImportMetadataWidget(QWidget* parent) override; - - // From KDevelop::IPlugin - KDevelop::ContextMenuExtension contextMenuExtension(KDevelop::Context* context, QWidget* parent) override; - - // Begin: KDevelop::IBasicVersionControl - bool isValidRemoteRepositoryUrl(const QUrl& remoteLocation) override; - bool isVersionControlled(const QUrl& localLocation) override; - KDevelop::VcsJob* repositoryLocation(const QUrl& localLocation) override; - KDevelop::VcsJob* add(const QList& localLocations, - KDevelop::IBasicVersionControl::RecursionMode recursion) override; - KDevelop::VcsJob* remove(const QList& localLocations) override; - KDevelop::VcsJob* copy(const QUrl& localLocationSrc, - const QUrl& localLocationDstn) override; - KDevelop::VcsJob* move(const QUrl& localLocationSrc, - const QUrl& localLocationDst) override; - KDevelop::VcsJob* status(const QList& localLocations, - KDevelop::IBasicVersionControl::RecursionMode recursion) override; - KDevelop::VcsJob* revert(const QList& localLocations, - KDevelop::IBasicVersionControl::RecursionMode recursion) override; - KDevelop::VcsJob* update(const QList& localLocations, - const KDevelop::VcsRevision& rev, - KDevelop::IBasicVersionControl::RecursionMode recursion) override; - KDevelop::VcsJob* commit(const QString& message, - const QList& localLocations, - KDevelop::IBasicVersionControl::RecursionMode recursion) override; - KDevelop::VcsJob* diff(const QUrl& fileOrDirectory, - const KDevelop::VcsRevision& srcRevision, - const KDevelop::VcsRevision& dstRevision, - KDevelop::VcsDiff::Type, - KDevelop::IBasicVersionControl::RecursionMode = KDevelop::IBasicVersionControl::Recursive) override; - KDevelop::VcsJob* log(const QUrl& localLocation, - const KDevelop::VcsRevision& rev, - unsigned long limit) override; - KDevelop::VcsJob* log(const QUrl& localLocation, - const KDevelop::VcsRevision& rev, - const KDevelop::VcsRevision& limit) override; - KDevelop::VcsJob* annotate(const QUrl& localLocation, - const KDevelop::VcsRevision& rev) override; - KDevelop::VcsJob* resolve(const QList& localLocations, - KDevelop::IBasicVersionControl::RecursionMode recursion) override; - KDevelop::VcsJob* createWorkingCopy(const KDevelop::VcsLocation & sourceRepository, const QUrl & destinationDirectory, KDevelop::IBasicVersionControl::RecursionMode recursion = KDevelop::IBasicVersionControl::Recursive) override; - // End: KDevelop::IBasicVersionControl - - // Begin: KDevelop::ICentralizedVersionControl - KDevelop::VcsJob* edit(const QUrl& localLocation) override; - KDevelop::VcsJob* unedit(const QUrl& localLocation) override; - KDevelop::VcsJob* localRevision(const QUrl& localLocation, - KDevelop::VcsRevision::RevisionType) override; - KDevelop::VcsJob* import(const QString& commitMessage, const QUrl& sourceDirectory, const KDevelop::VcsLocation& destinationRepository) override; -// End: KDevelop::ICentralizedVersionControl - - CvsProxy* proxy(); - - const QUrl urlFocusedDocument() const; - KDevelop::VcsLocationWidget* vcsLocation(QWidget* parent) const override; -public Q_SLOTS: - // slots for context menu - void ctxEdit(); - void ctxUnEdit(); - void ctxEditors(); - - // slots for menu - void slotImport(); - void slotCheckout(); - void slotStatus(); - -Q_SIGNALS: - /** - * Some actions like commit, add, remove... will connect the job's - * result() signal to this signal. Anybody, like for instance the - * CvsMainView class, that is interested in getting notified about - * jobs that finished can connect to this signal. - * @see class CvsMainView - */ - void jobFinished(KJob* job); - - /** - * Gets emmited when a job like log, editors... was created. - * CvsPlugin will connect the newly created view to the result() signal - * of a job. So the new view will show the output of that job as - * soon as it has finished. - */ - void addNewTabToMainView(QWidget* tab, QString label); - -private: - void setupActions(); - QString findWorkingDir(const QUrl& location); - -private: - const QScopedPointer d; -}; - -#endif diff --git a/plugins/cvs/cvsplugin.cpp b/plugins/cvs/cvsplugin.cpp deleted file mode 100644 --- a/plugins/cvs/cvsplugin.cpp +++ /dev/null @@ -1,492 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsplugin.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "cvsmainview.h" -#include "cvsproxy.h" -#include "cvsjob.h" -#include "editorsview.h" -#include "commitdialog.h" -#include "cvsgenericoutputview.h" -#include "checkoutdialog.h" -#include "importdialog.h" -#include "importmetadatawidget.h" -#include "debug.h" -#include -#include -#include - -K_PLUGIN_FACTORY(KDevCvsFactory, registerPlugin();) -// K_EXPORT_PLUGIN(KDevCvsFactory(KAboutData("kdevcvs", "kdevcvs", ki18n("CVS"), "0.1", ki18n("Support for CVS version control system"), KAboutData::License_GPL))) - -class KDevCvsViewFactory: public KDevelop::IToolViewFactory -{ -public: - explicit KDevCvsViewFactory(CvsPlugin *plugin): m_plugin(plugin) {} - QWidget* create(QWidget *parent = nullptr) override { - return new CvsMainView(m_plugin, parent); - } - Qt::DockWidgetArea defaultPosition() override { - return Qt::BottomDockWidgetArea; - } - QString id() const override { - return QStringLiteral("org.kdevelop.CVSView"); - } - -private: - CvsPlugin *m_plugin; -}; - -class CvsPluginPrivate -{ -public: - explicit CvsPluginPrivate(CvsPlugin *pThis) - : m_factory(new KDevCvsViewFactory(pThis)) - , m_proxy(new CvsProxy(pThis)) - , m_common(new KDevelop::VcsPluginHelper(pThis, pThis)) {} - - KDevCvsViewFactory* m_factory; - QPointer m_proxy; - QScopedPointer m_common; -}; - -CvsPlugin::CvsPlugin(QObject *parent, const QVariantList &) - : KDevelop::IPlugin(QStringLiteral("kdevcvs"), parent) - , d(new CvsPluginPrivate(this)) -{ - core()->uiController()->addToolView(i18n("CVS"), d->m_factory); - - setXMLFile(QStringLiteral("kdevcvs.rc")); - setupActions(); -} - -CvsPlugin::~CvsPlugin() -{ -} - - -void CvsPlugin::unload() -{ - core()->uiController()->removeToolView( d->m_factory ); -} - - -CvsProxy* CvsPlugin::proxy() -{ - return d->m_proxy; -} - -void CvsPlugin::setupActions() -{ - QAction *action; - - action = actionCollection()->addAction(QStringLiteral("cvs_import")); - action->setText(i18n("Import Directory...")); - connect(action, &QAction::triggered, this, &CvsPlugin::slotImport); - - action = actionCollection()->addAction(QStringLiteral("cvs_checkout")); - action->setText(i18n("Checkout...")); - connect(action, &QAction::triggered, this, &CvsPlugin::slotCheckout); - - action = actionCollection()->addAction(QStringLiteral("cvs_status")); - action->setText(i18n("Status...")); - connect(action, &QAction::triggered, this, &CvsPlugin::slotStatus); -} - -const QUrl CvsPlugin::urlFocusedDocument() const -{ - KParts::ReadOnlyPart *plugin = - dynamic_cast(core()->partController()->activePart()); - if (plugin) { - if (plugin->url().isLocalFile()) { - return plugin->url(); - } - } - return QUrl(); -} - - -void CvsPlugin::slotImport() -{ - QUrl url = urlFocusedDocument(); - - ImportDialog dlg(this, url); - dlg.exec(); -} - -void CvsPlugin::slotCheckout() -{ - ///@todo don't use proxy directly; use interface instead - - CheckoutDialog dlg(this); - - dlg.exec(); -} - -void CvsPlugin::slotStatus() -{ - QUrl url = urlFocusedDocument(); - QList urls; - urls << url; - - KDevelop::VcsJob* j = status(urls, KDevelop::IBasicVersionControl::Recursive); - CvsJob* job = dynamic_cast(j); - if (job) { - CvsGenericOutputView* view = new CvsGenericOutputView(job); - emit addNewTabToMainView(view, i18n("Status")); - KDevelop::ICore::self()->runController()->registerJob(job); - } -} - - -KDevelop::ContextMenuExtension CvsPlugin::contextMenuExtension(KDevelop::Context* context, QWidget* parent) -{ - d->m_common->setupFromContext(context); - QList const & ctxUrlList = d->m_common->contextUrlList(); - - bool hasVersionControlledEntries = false; - foreach(const QUrl &url, ctxUrlList) { - if (d->m_proxy->isValidDirectory(url)) { - hasVersionControlledEntries = true; - break; - } - } - - qCDebug(PLUGIN_CVS) << "version controlled?" << hasVersionControlledEntries; - - if (!hasVersionControlledEntries) - return IPlugin::contextMenuExtension(context, parent); - - QMenu* menu = d->m_common->commonActions(parent); - menu->addSeparator(); - - QAction *action; - // Just add actions which are not covered by the cvscommon plugin - action = new QAction(i18n("Edit"), menu); - connect(action, &QAction::triggered, this, &CvsPlugin::ctxEdit); - menu->addAction(action); - - action = new QAction(i18n("Unedit"), menu); - connect(action, &QAction::triggered, this, &CvsPlugin::ctxUnEdit); - menu->addAction(action); - - action = new QAction(i18n("Show Editors"), menu); - connect(action, &QAction::triggered, this, &CvsPlugin::ctxEditors); - menu->addAction(action); - - KDevelop::ContextMenuExtension menuExt; - menuExt.addAction(KDevelop::ContextMenuExtension::VcsGroup, menu->menuAction()); - - return menuExt; -} - -void CvsPlugin::ctxEdit() -{ - QList const & urls = d->m_common->contextUrlList(); - Q_ASSERT(!urls.empty()); - - KDevelop::VcsJob* j = edit(urls.front()); - CvsJob* job = dynamic_cast(j); - if (job) { - connect(job, &CvsJob::result, - this, &CvsPlugin::jobFinished); - KDevelop::ICore::self()->runController()->registerJob(job); - } -} - -void CvsPlugin::ctxUnEdit() -{ - QList const & urls = d->m_common->contextUrlList(); - Q_ASSERT(!urls.empty()); - - KDevelop::VcsJob* j = unedit(urls.front()); - CvsJob* job = dynamic_cast(j); - if (job) { - connect(job, &CvsJob::result, - this, &CvsPlugin::jobFinished); - KDevelop::ICore::self()->runController()->registerJob(job); - } -} - -void CvsPlugin::ctxEditors() -{ - QList const & urls = d->m_common->contextUrlList(); - Q_ASSERT(!urls.empty()); - - CvsJob* job = d->m_proxy->editors(findWorkingDir(urls.front()), - urls); - if (job) { - KDevelop::ICore::self()->runController()->registerJob(job); - EditorsView* view = new EditorsView(job); - emit addNewTabToMainView(view, i18n("Editors")); - } -} - -QString CvsPlugin::findWorkingDir(const QUrl& location) -{ - QFileInfo fileInfo(location.toLocalFile()); - - // find out correct working directory - if (fileInfo.isFile()) { - return fileInfo.absolutePath(); - } else { - return fileInfo.absoluteFilePath(); - } -} - - -// Begin: KDevelop::IBasicVersionControl - -bool CvsPlugin::isValidRemoteRepositoryUrl(const QUrl& remoteLocation) -{ - Q_UNUSED(remoteLocation); - // TODO - return false; -} - -bool CvsPlugin::isVersionControlled(const QUrl & localLocation) -{ - return d->m_proxy->isVersionControlled(localLocation); -} - -KDevelop::VcsJob * CvsPlugin::repositoryLocation(const QUrl & localLocation) -{ - Q_UNUSED(localLocation); - return nullptr; -} - -KDevelop::VcsJob * CvsPlugin::add(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - CvsJob* job = d->m_proxy->add(findWorkingDir(localLocations[0]), - localLocations, - (recursion == KDevelop::IBasicVersionControl::Recursive) ? true : false); - return job; -} - -KDevelop::VcsJob * CvsPlugin::remove(const QList & localLocations) -{ - CvsJob* job = d->m_proxy->remove(findWorkingDir(localLocations[0]), - localLocations); - return job; -} - -KDevelop::VcsJob * CvsPlugin::localRevision(const QUrl & localLocation, KDevelop::VcsRevision::RevisionType) -{ - Q_UNUSED(localLocation) - return nullptr; -} - -KDevelop::VcsJob * CvsPlugin::status(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - CvsJob* job = d->m_proxy->status(findWorkingDir(localLocations[0]), - localLocations, - (recursion == KDevelop::IBasicVersionControl::Recursive) ? true : false); - return job; -} - -KDevelop::VcsJob * CvsPlugin::unedit(const QUrl& localLocation) -{ - CvsJob* job = d->m_proxy->unedit(findWorkingDir(localLocation), - QList() << localLocation); - return job; -} - -KDevelop::VcsJob * CvsPlugin::edit(const QUrl& localLocation) -{ - CvsJob* job = d->m_proxy->edit(findWorkingDir(localLocation), - QList() << localLocation); - return job; -} - -KDevelop::VcsJob * CvsPlugin::copy(const QUrl & localLocationSrc, const QUrl & localLocationDstn) -{ - bool ok = QFile::copy(localLocationSrc.toLocalFile(), localLocationDstn.path()); - if (!ok) { - return nullptr; - } - - QList listDstn; - listDstn << localLocationDstn; - - CvsJob* job = d->m_proxy->add(findWorkingDir(localLocationDstn), - listDstn, true); - - return job; -} - -KDevelop::VcsJob * CvsPlugin::move(const QUrl &, const QUrl &) -{ - return nullptr; -} - -KDevelop::VcsJob * CvsPlugin::revert(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - KDevelop::VcsRevision rev; - CvsJob* job = d->m_proxy->update(findWorkingDir(localLocations[0]), - localLocations, - rev, - QStringLiteral("-C"), - (recursion == KDevelop::IBasicVersionControl::Recursive) ? true : false, - false, false); - return job; -} - -KDevelop::VcsJob * CvsPlugin::update(const QList & localLocations, const KDevelop::VcsRevision & rev, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - CvsJob* job = d->m_proxy->update(findWorkingDir(localLocations[0]), - localLocations, - rev, - QString(), - (recursion == KDevelop::IBasicVersionControl::Recursive) ? true : false, - false, false); - return job; -} - -KDevelop::VcsJob * CvsPlugin::commit(const QString & message, const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - Q_UNUSED(recursion); - QString msg = message; - if (msg.isEmpty()) { - CommitDialog dlg; - if (dlg.exec() == QDialog::Accepted) { - msg = dlg.message(); - } - } - - CvsJob* job = d->m_proxy->commit(findWorkingDir(localLocations[0]), - localLocations, - msg); - return job; -} - -KDevelop::VcsJob * CvsPlugin::diff(const QUrl & fileOrDirectory, const KDevelop::VcsRevision & srcRevision, const KDevelop::VcsRevision & dstRevision, KDevelop::VcsDiff::Type, KDevelop::IBasicVersionControl::RecursionMode) -{ - CvsJob* job = d->m_proxy->diff(fileOrDirectory, srcRevision, dstRevision, QStringLiteral("-uN")/*always unified*/); - return job; -} - -KDevelop::VcsJob * CvsPlugin::log(const QUrl & localLocation, const KDevelop::VcsRevision & rev, unsigned long limit) -{ - Q_UNUSED(limit) - - CvsJob* job = d->m_proxy->log(localLocation, rev); - return job; -} - -KDevelop::VcsJob * CvsPlugin::log(const QUrl & localLocation, const KDevelop::VcsRevision & rev, const KDevelop::VcsRevision & limit) -{ - Q_UNUSED(limit) - return log(localLocation, rev, 0); -} - -KDevelop::VcsJob * CvsPlugin::annotate(const QUrl & localLocation, const KDevelop::VcsRevision & rev) -{ - CvsJob* job = d->m_proxy->annotate(localLocation, rev); - return job; -} - -KDevelop::VcsJob * CvsPlugin::resolve(const QList & localLocations, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - Q_UNUSED(localLocations); - Q_UNUSED(recursion); - return nullptr; -} - -KDevelop::VcsJob * CvsPlugin::import(const QString& commitMessage, const QUrl& sourceDirectory, const KDevelop::VcsLocation& destinationRepository) -{ - if (commitMessage.isEmpty() - || !sourceDirectory.isLocalFile() - || !destinationRepository.isValid() - || destinationRepository.type() != KDevelop::VcsLocation::RepositoryLocation) { - return nullptr; - } - - qCDebug(PLUGIN_CVS) << "CVS Import requested " - << "src:" << sourceDirectory.toLocalFile() - << "srv:" << destinationRepository.repositoryServer() - << "module:" << destinationRepository.repositoryModule(); - - CvsJob* job = d->m_proxy->import(sourceDirectory, - destinationRepository.repositoryServer(), - destinationRepository.repositoryModule(), - destinationRepository.userData().toString(), - destinationRepository.repositoryTag(), - commitMessage); - return job; -} - -KDevelop::VcsJob * CvsPlugin::createWorkingCopy(const KDevelop::VcsLocation & sourceRepository, const QUrl & destinationDirectory, KDevelop::IBasicVersionControl::RecursionMode recursion) -{ - Q_UNUSED(recursion); - if (!destinationDirectory.isLocalFile() - || !sourceRepository.isValid() - || sourceRepository.type() != KDevelop::VcsLocation::RepositoryLocation) { - return nullptr; - } - - qCDebug(PLUGIN_CVS) << "CVS Checkout requested " - << "dest:" << destinationDirectory.toLocalFile() - << "srv:" << sourceRepository.repositoryServer() - << "module:" << sourceRepository.repositoryModule() - << "branch:" << sourceRepository.repositoryBranch() << endl; - - CvsJob* job = d->m_proxy->checkout(destinationDirectory, - sourceRepository.repositoryServer(), - sourceRepository.repositoryModule(), - QString(), - sourceRepository.repositoryBranch(), - true, true); - return job; -} - -QString CvsPlugin::name() const -{ - return i18n("CVS"); -} - -KDevelop::VcsImportMetadataWidget* CvsPlugin::createImportMetadataWidget(QWidget* parent) -{ - return new ImportMetadataWidget(parent); -} - -KDevelop::VcsLocationWidget* CvsPlugin::vcsLocation(QWidget* parent) const -{ - return new KDevelop::StandardVcsLocationWidget(parent); -} - -// End: KDevelop::IBasicVersionControl - -#include "cvsplugin.moc" diff --git a/plugins/cvs/cvsproxy.h b/plugins/cvs/cvsproxy.h deleted file mode 100644 --- a/plugins/cvs/cvsproxy.h +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSPROXY_H -#define KDEVPLATFORM_PLUGIN_CVSPROXY_H - - -#include - -#include -#include - -class CvsJob; - -namespace KDevelop -{ -class IPlugin; -} - -/** - * This proxy acts as a single point of entry for most of the common cvs commands. - * It is very easy to use, as the caller does not have to deal which the CvsJob class directly. - * All the command line generation and job handling is done internally. The caller gets a CvsJob - * object returned from the proxy and can then call it's start() method. - * - * Here is and example of how to user the proxy: - * @code - * CvsJob* job = proxy->editors( repo, urls ); - * if ( job ) { - * connect(job, SIGNAL( result(KJob*) ), - * this, SIGNAL( jobFinished(KJob*) )); - * job->start(); - * } - * @endcode - * - * @note All actions that take a QList also need an url to the repository which - * must be a common base directory to all files from the QList. - * Actions that just take a single QUrl don't need a repository, the cvs command will be - * called directly in the directory of the given file - * - * @author Robert Gruber - */ -class CvsProxy : public QObject -{ - Q_OBJECT -public: - explicit CvsProxy(KDevelop::IPlugin* parent = nullptr); - ~CvsProxy() override; - - bool isValidDirectory(const QUrl& dirPath) const; - bool isVersionControlled(const QUrl& filePath) const; - - CvsJob* import(const QUrl &directory, - const QString & server, const QString& repositoryName, - const QString& vendortag, const QString& releasetag, - const QString& message); - CvsJob* log(const QUrl &file, const KDevelop::VcsRevision& rev); - CvsJob* diff(const QUrl &url, - const KDevelop::VcsRevision& revA, - const KDevelop::VcsRevision& revB, - const QString& diffOptions=QString()); - CvsJob* annotate(const QUrl &url, const KDevelop::VcsRevision& rev); - CvsJob* edit(const QString& repo, const QList& files); - CvsJob* unedit(const QString& repo, const QList& files); - CvsJob* editors(const QString& repo, const QList& files); - CvsJob* commit(const QString& repo, const QList& files, - const QString& message); - CvsJob* add(const QString& repo, const QList& files, - bool recursiv = true, bool binary = false); - CvsJob* remove(const QString& repo, const QList& files); - CvsJob* update(const QString& repo, const QList& files, - const KDevelop::VcsRevision& rev, - const QString& updateOptions, - bool resursive = true, bool pruneDirs = true, bool createDirs = true); - - CvsJob* checkout(const QUrl &targetDir, - const QString & server, const QString& module, - const QString& checkoutOptions=QString(), - const QString& revision=QString(), - bool recursive = true, - bool pruneDirs = true); - - CvsJob* status(const QString & repo, const QList & files, - bool recursive=false, bool taginfo=false); - -private: - bool addFileList(CvsJob* job, const QString& repository, const QList& urls); - QString convertVcsRevisionToString(const KDevelop::VcsRevision& rev); - QString convertRevisionToPrevious(const KDevelop::VcsRevision& rev); - - enum RequestedOperation { - NormalOperation, - Import, - CheckOut - }; - bool prepareJob(CvsJob* job, const QString& repository, - enum RequestedOperation op = CvsProxy::NormalOperation); - KDevelop::IPlugin* vcsplugin; -}; - -#endif diff --git a/plugins/cvs/cvsproxy.cpp b/plugins/cvs/cvsproxy.cpp deleted file mode 100644 --- a/plugins/cvs/cvsproxy.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsproxy.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include "cvsjob.h" -#include "cvsannotatejob.h" -#include "cvslogjob.h" -#include "cvsstatusjob.h" -#include "cvsdiffjob.h" -#include - -#include - -CvsProxy::CvsProxy(KDevelop::IPlugin* parent) -: QObject(parent), vcsplugin(parent) -{ -} - -CvsProxy::~CvsProxy() -{ -} - -bool CvsProxy::isValidDirectory(const QUrl& dirPath) const -{ - const QFileInfo fsObject( dirPath.toLocalFile() ); - QDir dir = fsObject.isDir() ? fsObject.absoluteDir() : fsObject.dir(); - - return dir.exists(QStringLiteral("CVS")); -} - -bool CvsProxy::isVersionControlled(const QUrl& filePath) const -{ - const QFileInfo fsObject( filePath.toLocalFile() ); - QDir dir = fsObject.isDir() ? fsObject.absoluteDir() : fsObject.dir(); - - if( !dir.cd(QStringLiteral("CVS")) ) - return false; - - if( fsObject.isDir() ) - return true; - - QFile cvsEntries( dir.absoluteFilePath(QStringLiteral("Entries")) ); - cvsEntries.open( QIODevice::ReadOnly ); - QString cvsEntriesData = cvsEntries.readAll(); - cvsEntries.close(); - return ( cvsEntriesData.indexOf( fsObject.fileName() ) != -1 ); -} - - -bool CvsProxy::prepareJob(CvsJob* job, const QString& repository, enum RequestedOperation op) -{ - // Only do this check if it's a normal operation like diff, log ... - // For other operations like "cvs import" isValidDirectory() would fail as the - // directory is not yet under CVS control - if (op == CvsProxy::NormalOperation && - !isValidDirectory(QUrl::fromLocalFile(repository))) { - qCDebug(PLUGIN_CVS) << repository << " is not a valid CVS repository"; - return false; - } - - // clear commands and args from a possible previous run - job->clear(); - - // setup the working directory for the new job - job->setDirectory(repository); - - return true; -} - -bool CvsProxy::addFileList(CvsJob* job, const QString& repository, const QList& urls) -{ - QStringList args; - - QDir repoDir(repository); - foreach(const QUrl &url, urls) { - ///@todo this is ok for now, but what if some of the urls are not - /// to the given repository - const QString file = repoDir.relativeFilePath(url.toLocalFile()); - args << KShell::quoteArg( file ); - } - - *job << args; - - return true; -} - -QString CvsProxy::convertVcsRevisionToString(const KDevelop::VcsRevision & rev) -{ - QString str; - - switch (rev.revisionType()) - { - case KDevelop::VcsRevision::Special: - break; - - case KDevelop::VcsRevision::FileNumber: - if (rev.revisionValue().isValid()) - str = "-r"+rev.revisionValue().toString(); - break; - - case KDevelop::VcsRevision::Date: - if (rev.revisionValue().isValid()) - str = "-D"+rev.revisionValue().toString(); - break; - - case KDevelop::VcsRevision::GlobalNumber: // !! NOT SUPPORTED BY CVS !! - default: - break; - } - - return str; -} - -QString CvsProxy::convertRevisionToPrevious(const KDevelop::VcsRevision& rev) -{ - QString str; - - // this only works if the revision is a real revisionnumber and not a date or special - switch (rev.revisionType()) - { - case KDevelop::VcsRevision::FileNumber: - if (rev.revisionValue().isValid()) { - QString orig = rev.revisionValue().toString(); - - // First we need to find the base (aka branch-part) of the revision number which will not change - QString base(orig); - base.truncate(orig.lastIndexOf(QLatin1Char('.'))); - - // next we need to cut off the last part of the revision number - // this number is a count of revisions with a branch - // so if we want to diff to the previous we just need to lower it by one - int number = orig.midRef(orig.lastIndexOf(QLatin1Char('.'))+1).toInt(); - if (number > 1) // of course this is only possible if our revision is not the first on the branch - number--; - - str = QStringLiteral("-r") + base + '.' + QString::number(number); - qCDebug(PLUGIN_CVS) << "Converted revision "<(); - if (specialtype == KDevelop::VcsRevision::Previous) { - rA = convertRevisionToPrevious(revB); - } - } else { - rA = convertVcsRevisionToString(revA); - } - if (!rA.isEmpty()) - *job << rA; - - QString rB = convertVcsRevisionToString(revB); - if (!rB.isEmpty()) - *job << rB; - - // in case the QUrl is a directory there is no filename - if (!info.fileName().isEmpty()) - *job << KShell::quoteArg(info.fileName()); - - return job; - } - delete job; - return nullptr; -} - -CvsJob * CvsProxy::annotate(const QUrl& url, const KDevelop::VcsRevision& rev) -{ - QFileInfo info(url.toLocalFile()); - - CvsAnnotateJob* job = new CvsAnnotateJob(vcsplugin); - if ( prepareJob(job, info.absolutePath()) ) { - *job << "cvs"; - *job << "annotate"; - - QString revision = convertVcsRevisionToString(rev); - if (!revision.isEmpty()) - *job << revision; - - *job << KShell::quoteArg(info.fileName()); - - return job; - } - delete job; - return nullptr; -} - -CvsJob* CvsProxy::edit(const QString& repo, const QList& files) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "edit"; - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - - -CvsJob* CvsProxy::unedit(const QString& repo, const QList& files) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "unedit"; - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - -CvsJob* CvsProxy::editors(const QString& repo, const QList& files) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "editors"; - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - -CvsJob* CvsProxy::commit(const QString& repo, const QList& files, const QString& message) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "commit"; - - *job << "-m"; - *job << KShell::quoteArg( message ); - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - -CvsJob* CvsProxy::add(const QString& repo, const QList& files, - bool recursiv, bool binary) -{ - Q_UNUSED(recursiv); - // FIXME recursiv is not implemented yet - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "add"; - - if (binary) { - *job << "-kb"; - } - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - -CvsJob * CvsProxy::remove(const QString& repo, const QList& files) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "remove"; - - *job << "-f"; //existing files will be deleted - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - -CvsJob * CvsProxy::update(const QString& repo, const QList& files, - const KDevelop::VcsRevision & rev, - const QString & updateOptions, - bool recursive, bool pruneDirs, bool createDirs) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "update"; - - if (recursive) - *job << "-R"; - else - *job << "-L"; - if (pruneDirs) - *job << "-P"; - if (createDirs) - *job << "-d"; - if (!updateOptions.isEmpty()) - *job << updateOptions; - - QString revision = convertVcsRevisionToString(rev); - if (!revision.isEmpty()) - *job << revision; - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - -CvsJob * CvsProxy::import(const QUrl& directory, - const QString & server, const QString & repositoryName, - const QString & vendortag, const QString & releasetag, - const QString& message) -{ - CvsJob* job = new CvsJob(vcsplugin); - if ( prepareJob(job, directory.toLocalFile(), CvsProxy::Import) ) { - *job << "cvs"; - *job << "-q"; // don't print directory changes - *job << "-d"; - *job << server; - *job << "import"; - - *job << "-m"; - *job << KShell::quoteArg( message ); - - *job << repositoryName; - *job << vendortag; - *job << releasetag; - - return job; - } - delete job; - return nullptr; -} - -CvsJob * CvsProxy::checkout(const QUrl& targetDir, - const QString & server, const QString & module, - const QString & checkoutOptions, - const QString & revision, - bool recursive, - bool pruneDirs) -{ - CvsJob* job = new CvsJob(vcsplugin); - ///@todo when doing a checkout we don't have the targetdir yet, - /// for now it'll work to just run the command from the root - if ( prepareJob(job, QStringLiteral("/"), CvsProxy::CheckOut) ) { - *job << "cvs"; - *job << "-q"; // don't print directory changes - *job << "-d" << server; - *job << "checkout"; - - if (!checkoutOptions.isEmpty()) - *job << checkoutOptions; - - if (!revision.isEmpty()) { - *job << "-r" << revision; - } - - if (pruneDirs) - *job << "-P"; - - if (!recursive) - *job << "-l"; - - *job << "-d" << targetDir.toString(QUrl::PreferLocalFile | QUrl::StripTrailingSlash); - - *job << module; - - return job; - } - delete job; - return nullptr; -} - -CvsJob * CvsProxy::status(const QString & repo, const QList & files, bool recursive, bool taginfo) -{ - CvsStatusJob* job = new CvsStatusJob(vcsplugin); - job->setCommunicationMode( KProcess::MergedChannels ); - if ( prepareJob(job, repo) ) { - *job << "cvs"; - *job << "status"; - - if (recursive) - *job << "-R"; - else - *job << "-l"; - if (taginfo) - *job << "-v"; - - addFileList(job, repo, files); - - return job; - } - delete job; - return nullptr; -} - diff --git a/plugins/cvs/cvsstatusjob.h b/plugins/cvs/cvsstatusjob.h deleted file mode 100644 --- a/plugins/cvs/cvsstatusjob.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_CVSSTATUSJOB_H -#define KDEVPLATFORM_PLUGIN_CVSSTATUSJOB_H - -#include "cvsjob.h" -#include - -/** - * @author Robert Gruber - */ -class CvsStatusJob : public CvsJob -{ - Q_OBJECT -public: - explicit CvsStatusJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity = KDevelop::OutputJob::Verbose); - ~CvsStatusJob() override; - - // Begin: KDevelop::VcsJob - QVariant fetchResults() override; - // End: KDevelop::VcsJob - -private: - void parseOutput(const QString& jobOutput, QList& infos); - void addInfoToList(QList& infos, - const QString& currentDir, const QString& filename, - const QString& statusString); - - KDevelop::VcsStatusInfo::State String2EnumState(const QString& stateAsString); - -}; - -#endif diff --git a/plugins/cvs/cvsstatusjob.cpp b/plugins/cvs/cvsstatusjob.cpp deleted file mode 100644 --- a/plugins/cvs/cvsstatusjob.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - * Copyright 2008 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "cvsstatusjob.h" -#include "debug.h" - -#include -#include -#include - -#include - - -CvsStatusJob::CvsStatusJob(KDevelop::IPlugin* parent, KDevelop::OutputJob::OutputJobVerbosity verbosity) - : CvsJob(parent, verbosity) -{ -} - -CvsStatusJob::~CvsStatusJob() -{ -} - -QVariant CvsStatusJob::fetchResults() -{ - // Convert job's output into KDevelop::VcsStatusInfo - QList infos; - parseOutput(output(), infos); - - return infos; -} - -void CvsStatusJob::addInfoToList(QList& infos, - const QString& currentDir, const QString& filename, - const QString& statusString) -{ - KDevelop::VcsStatusInfo::State cvsState = String2EnumState( statusString ); - - QString correctedFilename = filename; - if (cvsState == KDevelop::VcsStatusInfo::ItemDeleted) { - // cvs status writes "no file" in front of the filename - // in case the file was locally removed - correctedFilename.remove(QStringLiteral("no file ")); - } - - // join the current directory (if any) and the found filename ... - // note: current directy is always relative to the directory where the - // cvs command was executed - QString file = currentDir; - if (file.length() > 0) { - file += QDir::separator(); - } - file += correctedFilename; - - // ... and create a VcsFileInfo entry - KDevelop::VcsStatusInfo info; - info.setUrl(QUrl::fromLocalFile(QString(getDirectory() + QDir::separator() + file))); - info.setState(cvsState); - - qCDebug(PLUGIN_CVS) << "Added status of: " << info.url() << endl; - infos << qVariantFromValue( info ); -} - -void CvsStatusJob::parseOutput(const QString& jobOutput, QList& infos) -{ - QString filename; - QString status; - QString reporev; - QString workrev; - - static QRegExp re_start("^=+$"); - static QRegExp re_file("File:\\s+(.*)\\s+Status:\\s+(.*)"); - static QRegExp re_workrev("\\s+Working revision:\\s+([\\d\\.]*).*"); - static QRegExp re_reporev("\\s+Repository revision:\\s+([\\d\\.]*).*"); - static QRegExp re_dirchange("cvs status: Examining\\s+(.*)"); - - QString currentDir; - - QStringList lines = jobOutput.split('\n'); - for (int i=0; i * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_EDITORSVIEW_H -#define KDEVPLATFORM_PLUGIN_EDITORSVIEW_H - -#include -#include -#include - -#include "ui_editorsview.h" - -class CvsPlugin; -class CvsJob; - -/** - * This is a helper class for the EditorsView::parseOutput() method. - * It holds information about a single locker of a file. - * @see EditorsView::parseOutput() - */ -class CvsLocker { -public: - QString user; - QString date; - QString machine; - QString localrepo; -}; - -/** - * Shows the output from @code cvs editors @endcode in a nice way. - * Create a CvsJob by calling CvsProxy::editors() and connect the job's - * result(KJob*) signal to EditorsView::slotJobFinished(KJob* job) - * @author Robert Gruber - */ -class EditorsView : public QWidget, private Ui::EditorsViewBase -{ -Q_OBJECT -public: - explicit EditorsView(CvsJob* job=nullptr, QWidget *parent = nullptr); - ~EditorsView() override; - - /** - * Parses the output generated by a @code cvs editors @endcode command and - * fills the given QMultiMap with all files and their lockers found in the output. - * @param jobOutput Pass in the plain output of a @code cvs editors @endcode job - * @param editorsInfo This QMultiMap will be filled with information about which files - * are locked by whom. The key of the map is the filename. For each - * filename a list of CvsLocker objects will be created, depending - * on how many people are editing the file. - * If editorsInfo.size() is zero, this means that no information was - * found in the given @p jobOutput. - */ - static void parseOutput(const QString& jobOutput, - QMultiMap& editorsInfo); - -private Q_SLOTS: - /** - * Connect a job's result() signal to this slot. When called, the output from the job - * will be passed to the parseOutput() method and any found locker information will be - * displayed. - * @note If you pass a CvsJob object to the ctor, it's result() signal - * will automatically be connected to this slot. - */ - void slotJobFinished(KJob* job); - -private: - QString m_output; -}; - -#endif diff --git a/plugins/cvs/editorsview.cpp b/plugins/cvs/editorsview.cpp deleted file mode 100644 --- a/plugins/cvs/editorsview.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "editorsview.h" - -#include -#include -#include -#include -#include - -#include "cvsplugin.h" -#include "cvsjob.h" -#include "cvsproxy.h" - - -EditorsView::EditorsView(CvsJob* job, QWidget *parent) - : QWidget(parent), Ui::EditorsViewBase() -{ - Ui::EditorsViewBase::setupUi(this); - - if (job) { - connect(job, &CvsJob::result, - this, &EditorsView::slotJobFinished); - } -} - -EditorsView::~EditorsView() -{ -} - -void EditorsView::slotJobFinished(KJob* job) -{ - if ( job->error() ) - { - textbrowser->append( i18n("Listing editors failed") ); - return; - } - - CvsJob * cvsjob = dynamic_cast(job); - if (!cvsjob) { - return; - } - - - QMultiMap lockedFiles; - - parseOutput(cvsjob->output(), lockedFiles); - - if (lockedFiles.size() == 0) { - textbrowser->append(i18n("No files from your query are marked as being edited.")); - } else { - QString html; - - foreach (const QString &key, lockedFiles.uniqueKeys()) { - html += "

"+key+"


"; - - foreach(const CvsLocker &item, lockedFiles.values( key )) { - html += ""+i18n("User")+": "+item.user+"
"; - html += ""+i18n("Date")+": "+item.date+"
"; - html += ""+i18n("Machine")+": "+item.machine+"
"; - html += ""+i18n("Repository")+": "+item.localrepo+"
"; - html += QLatin1String("
"); - } - html += QLatin1String("
"); - } - - textbrowser->setHtml( html ); - } -} - -void EditorsView::parseOutput(const QString& jobOutput, QMultiMap& editorsInfo) -{ - // the first line contains the filename and than the locker information - static QRegExp re("([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+" - "([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(.*)"); - // if there are more than one locker of a single file, the second line for a file - // only contains the locker information (no filename) - static QRegExp subre("\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+" - "([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(.*)"); - - QString lastfilename; - - QStringList lines = jobOutput.split('\n'); - - for (int i=0; i - - EditorsViewBase - - - - 0 - 0 - 416 - 200 - - - - Editors - - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - - - - - - diff --git a/plugins/cvs/importdialog.h b/plugins/cvs/importdialog.h deleted file mode 100644 --- a/plugins/cvs/importdialog.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_IMPORTDIALOG_H -#define KDEVPLATFORM_PLUGIN_IMPORTDIALOG_H - -#include -#include -#include - -class ImportMetadataWidget; - -class CvsPlugin; - -/** - * Asks the user for all options needed to import an existing directory into - * a CVS repository - * @author Robert Gruber - */ -class ImportDialog : public QDialog -{ - Q_OBJECT -public: - ImportDialog(CvsPlugin *plugin, const QUrl &url, QWidget* parent=nullptr); - ~ImportDialog() override; - -public Q_SLOTS: - void accept() override; - void jobFinished(KJob* job); - -private: - QUrl m_url; - CvsPlugin* m_plugin; - ImportMetadataWidget* m_widget; -}; - -#endif diff --git a/plugins/cvs/importdialog.cpp b/plugins/cvs/importdialog.cpp deleted file mode 100644 --- a/plugins/cvs/importdialog.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "importdialog.h" - -#include -#include - -#include -#include - -#include "cvsplugin.h" -#include "cvsproxy.h" -#include "cvsjob.h" -#include "debug.h" - -#include - -#include "importmetadatawidget.h" - -ImportDialog::ImportDialog(CvsPlugin* plugin, const QUrl &url, QWidget *parent) - : QDialog(parent), m_url(url), m_plugin(plugin) -{ - m_widget = new ImportMetadataWidget(this); - m_widget->setSourceLocation( KDevelop::VcsLocation(m_url) ); - m_widget->setSourceLocationEditable( true ); - auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - auto layout = new QVBoxLayout(); - setLayout(layout); - layout->addWidget(m_widget); - layout->addWidget(buttonBox); - connect(buttonBox, &QDialogButtonBox::accepted, this, &ImportDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, this, &ImportDialog::reject); -} - -ImportDialog::~ImportDialog() -{ -} - -void ImportDialog::accept() -{ - KDevelop::VcsJob *job = m_plugin->import(m_widget->message(), m_widget->source(), - m_widget->destination()); - if (job) { - connect(job, &KDevelop::VcsJob::result, - this, &ImportDialog::jobFinished); - KDevelop::ICore::self()->runController()->registerJob(job); - } -} - -void ImportDialog::jobFinished(KJob * job) -{ - if (job->error()) { - KMessageBox::error(this, i18n("Error on importing"), i18n("Import Error")); - return; - } - - // The job finished, now let's check the output is everything was OK - CvsJob* cvsjob = static_cast(job); - - static QRegExp re_file("^[IN]\\s(.*)"); - bool error = false; - QStringList lines = cvsjob->output().split('\n'); - foreach(const QString &line, lines) { - if (line.isEmpty()) { - // ignore empty lines - continue; - } else if (re_file.exactMatch(line)) { - // line that tell us that a file has been added are OK - continue; - // this normaly should be the last line - } else if (line.contains(QStringLiteral("No conflicts created by this import"))) { - continue; - } else { - // any other line must mean that an error occurred - qCDebug(PLUGIN_CVS) <<"ERR: "<< line; - error = true; - } - } - - if (error) { - KMessageBox::error(this, - i18n("Some errors occurred while importing %1", m_url.toLocalFile()), - i18n("Import Error")); - } else { - QDialog::accept(); - } -} - diff --git a/plugins/cvs/importmetadatawidget.h b/plugins/cvs/importmetadatawidget.h deleted file mode 100644 --- a/plugins/cvs/importmetadatawidget.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * Copyright 2007 Andreas Pakulat * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_IMPORTMETADATAWIDGET_H -#define KDEVPLATFORM_PLUGIN_IMPORTMETADATAWIDGET_H - -#include - -#include "ui_importmetadatawidget.h" - -class CvsPlugin; - -namespace KDevelop -{ -class VcsLocation; -} - -/** - * Asks the user for all options needed to import an existing directory into - * a CVS repository - * @author Robert Gruber - */ -class ImportMetadataWidget : public KDevelop::VcsImportMetadataWidget, private Ui::ImportMetadataWidget -{ - Q_OBJECT -public: - explicit ImportMetadataWidget(QWidget* parent=nullptr); - ~ImportMetadataWidget() override; - - QUrl source() const override; - KDevelop::VcsLocation destination() const override; - QString message() const override; - void setSourceLocation( const KDevelop::VcsLocation& ) override; - void setSourceLocationEditable( bool ) override; - void setMessage(const QString& message) override; - bool hasValidData() const override; - -private: - Ui::ImportMetadataWidget* m_ui; -}; - -#endif diff --git a/plugins/cvs/importmetadatawidget.cpp b/plugins/cvs/importmetadatawidget.cpp deleted file mode 100644 --- a/plugins/cvs/importmetadatawidget.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * Copyright 2007 Andreas Pakulat * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "importmetadatawidget.h" - -#include - -#include - -ImportMetadataWidget::ImportMetadataWidget(QWidget *parent) - : KDevelop::VcsImportMetadataWidget(parent), m_ui( new Ui::ImportMetadataWidget ) -{ - m_ui->setupUi(this); - - m_ui->sourceLoc->setEnabled( false ); - m_ui->sourceLoc->setMode( KFile::Directory ); - - connect( m_ui->sourceLoc, &KUrlRequester::textChanged, this, &ImportMetadataWidget::changed ); - connect( m_ui->sourceLoc, &KUrlRequester::urlSelected, this, &ImportMetadataWidget::changed ); - connect( m_ui->comment, &KTextEdit::textChanged, this, &ImportMetadataWidget::changed ); - connect( m_ui->module, &QLineEdit::textEdited, this, &ImportMetadataWidget::changed ); - connect( m_ui->releaseTag, &QLineEdit::textEdited, this, &ImportMetadataWidget::changed ); - connect( m_ui->repository, &QLineEdit::textEdited, this, &ImportMetadataWidget::changed ); - connect( m_ui->vendorTag, &QLineEdit::textEdited, this, &ImportMetadataWidget::changed ); - -} - -ImportMetadataWidget::~ImportMetadataWidget() -{ - delete m_ui; -} - -QUrl ImportMetadataWidget::source() const -{ - return m_ui->sourceLoc->url() ; -} - -KDevelop::VcsLocation ImportMetadataWidget::destination() const -{ - KDevelop::VcsLocation destloc; - destloc.setRepositoryServer(m_ui->repository->text() ); - destloc.setRepositoryModule(m_ui->module->text()); - destloc.setRepositoryTag(m_ui->vendorTag->text()); - destloc.setUserData(m_ui->releaseTag->text()); - return destloc; -} - -QString ImportMetadataWidget::message( ) const -{ - return m_ui->comment->toPlainText(); -} - -void ImportMetadataWidget::setSourceLocation( const KDevelop::VcsLocation& url ) -{ - m_ui->sourceLoc->setUrl( url.localUrl() ); -} - -void ImportMetadataWidget::setSourceLocationEditable( bool enable ) -{ - m_ui->sourceLoc->setEnabled( enable ); -} - -void ImportMetadataWidget::setMessage(const QString& message) -{ - m_ui->comment->setText(message); -} - -bool ImportMetadataWidget::hasValidData() const -{ - return !m_ui->comment->toPlainText().isEmpty() && !m_ui->sourceLoc->text().isEmpty() - && !m_ui->module->text().isEmpty() && !m_ui->repository->text().isEmpty(); -} - diff --git a/plugins/cvs/importmetadatawidget.ui b/plugins/cvs/importmetadatawidget.ui deleted file mode 100644 --- a/plugins/cvs/importmetadatawidget.ui +++ /dev/null @@ -1,140 +0,0 @@ - - ImportMetadataWidget - - - - 0 - 0 - 581 - 261 - - - - Import - - - - 0 - - - - - Source Directory: - - - - - - - - - - &Repository: - - - false - - - repository - - - - - - - - - - Mo&dule: - - - false - - - module - - - - - - - - - - &Vendor tag: - - - false - - - vendorTag - - - - - - - vendor - - - - - - - Re&lease tag: - - - false - - - releaseTag - - - - - - - start - - - - - - - Co&mment: - - - false - - - comment - - - - - - - - - - - KTextEdit - QTextEdit -
ktextedit.h
-
- - KUrlRequester - QWidget -
kurlrequester.h
- 1 -
-
- - repository - module - vendorTag - releaseTag - - - -
diff --git a/plugins/cvs/kdevcvs.json b/plugins/cvs/kdevcvs.json deleted file mode 100644 --- a/plugins/cvs/kdevcvs.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "KPlugin": { - "Authors": [ - { - "Name": "Robert Gruber", - "Name[x-test]": "xxRobert Gruberxx" - } - ], - "Category": "Version Control", - "Description": "This plugin integrates CVS to KDevelop", - "Description[ca@valencia]": "Este connector integra el CVS al KDevelop", - "Description[ca]": "Aquest connector integra el CVS al KDevelop", - "Description[cs]": "Tento modul integruje podporu pro CVS v KDevelop", - "Description[es]": "Este complemento integra CVS en KDevelop", - "Description[et]": "See plugin lõimib CVS-i KDevelopiga", - "Description[fi]": "Tämä liitännäinen integroi CVS:n KDevelopiin", - "Description[fr]": "Ce module intègre CVS dans KDevelop", - "Description[gl]": "Este complemento integra CVS en KDevelop", - "Description[it]": "Questa estensione integra CVS in KDevelop", - "Description[nl]": "Deze plugin integreert CVS in KDevelop", - "Description[pl]": "Ta wtyczka udostępnia obsługę CVS w KDevelopie", - "Description[pt]": "Este 'plugin' integra o CVS no KDevelop", - "Description[pt_BR]": "Esta extensão integra o CVS ao KDevelop", - "Description[sk]": "Tento plugin integruje CVS do KDevelop.", - "Description[sv]": "Insticksprogrammet integrerar CVS i KDevelop", - "Description[tr]": "Bu eklenti CVS uygulamasını KDevelop ile bütünleştirir", - "Description[uk]": "За допомогою цього додатка можна інтегрувати CVS до KDevelop", - "Description[x-test]": "xxThis plugin integrates CVS to KDevelopxx", - "Description[zh_CN]": "此插件将 CVS 整合到 KDevelop", - "Icon": "cervisia", - "Id": "kdevcvs", - "License": "GPL", - "Name": "CVS Support", - "Name[ca@valencia]": "Implementació de CVS", - "Name[ca]": "Implementació de CVS", - "Name[cs]": "Podpora CVS", - "Name[de]": "CVS-Unterstützung", - "Name[es]": "Implementación de CVS", - "Name[fr]": "Prise en charge de CVS", - "Name[it]": "Supporto per CVS", - "Name[nb]": "CVS-støtte", - "Name[nl]": "CVS-ondersteuning", - "Name[pl]": "Obsługa CVS", - "Name[pt]": "Suporte para o CVS", - "Name[sk]": "Podpora CVS", - "Name[sv]": "CVS-stöd", - "Name[tr]": "CVS Desteği", - "Name[uk]": "Підтримка CVS", - "Name[x-test]": "xxCVS Supportxx", - "Name[zh_CN]": "CVS 支持", - "ServiceTypes": [ - "KDevelop/Plugin" - ], - "Version": "0.1" - }, - "X-KDevelop-Category": "Global", - "X-KDevelop-Interfaces": [ - "org.kdevelop.IBasicVersionControl" - ], - "X-KDevelop-Mode": "GUI" -} diff --git a/plugins/cvs/kdevcvs.qrc b/plugins/cvs/kdevcvs.qrc deleted file mode 100644 --- a/plugins/cvs/kdevcvs.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - - kdevcvs.rc - - diff --git a/plugins/cvs/kdevcvs.rc b/plugins/cvs/kdevcvs.rc deleted file mode 100644 --- a/plugins/cvs/kdevcvs.rc +++ /dev/null @@ -1,11 +0,0 @@ - - - - - CVS - - - - - - diff --git a/plugins/cvs/tests/CMakeLists.txt b/plugins/cvs/tests/CMakeLists.txt deleted file mode 100644 --- a/plugins/cvs/tests/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Due to the use of system() and some unix-style paths this test will only run -# under Linux. (Maybe this can be fixed later) -# -# Moreover, I'm not sure if there is a cvs commandline client for windows -# (need to check this out ...) - -if (UNIX) - -# Running the test only makes sense if the cvs command line client -# is present. So check for it before adding the test ... -find_program(CVS NAMES cvs - PATHS - /bin - /usr/bin - /usr/local/bin -) - -if (CVS) - include_directories( - .. - ${CMAKE_CURRENT_BINARY_DIR}/.. - ) - set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - set(test_cvs_SRCS test_cvs.cpp - ../cvsjob.cpp - ../cvsproxy.cpp - ../cvsannotatejob.cpp - ../cvslogjob.cpp - ../cvsstatusjob.cpp - ../cvsdiffjob.cpp - ${kdevcvs_LOG_PART_SRCS} - ) - ecm_add_test(${test_cvs_SRCS} - TEST_NAME test_cvs - LINK_LIBRARIES - Qt5::Test - KDev::Util - KDev::Vcs - KDev::Tests - ) - -endif () - -endif () - diff --git a/plugins/cvs/tests/test_cvs.h b/plugins/cvs/tests/test_cvs.h deleted file mode 100644 --- a/plugins/cvs/tests/test_cvs.h +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KDEVPLATFORM_PLUGIN_TEST_CVS_H -#define KDEVPLATFORM_PLUGIN_TEST_CVS_H - -#include - -class CvsProxy; - -class TestCvs: public QObject -{ - Q_OBJECT - -private: - void repoInit(); - void importTestData(); - void checkoutTestData(); - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - - void init(); - void cleanup(); - - void testInitAndImport(); - void testLogFolder(); - -private: - CvsProxy* m_proxy; -}; - -#endif diff --git a/plugins/cvs/tests/test_cvs.cpp b/plugins/cvs/tests/test_cvs.cpp deleted file mode 100644 --- a/plugins/cvs/tests/test_cvs.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/*************************************************************************** - * Copyright 2007 Robert Gruber * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "test_cvs.h" - -#include -#include - -#include - -#include -#include - -#include -#include - -#define CVSTEST_BASEDIR "/tmp/kdevcvs_testdir/" -#define CVS_REPO CVSTEST_BASEDIR "repo/" -#define CVS_IMPORT CVSTEST_BASEDIR "import/" -#define CVS_TESTFILE_NAME "testfile" -#define CVS_CHECKOUT CVSTEST_BASEDIR "working/" - -void TestCvs::initTestCase() -{ - KDevelop::AutoTestShell::init(); - KDevelop::TestCore::initialize(KDevelop::Core::NoUi); - - m_proxy = new CvsProxy; - - // If the basedir for this cvs test exists from a - // previous run; remove it... - cleanup(); -} - -void TestCvs::cleanupTestCase() -{ - KDevelop::TestCore::shutdown(); - - delete m_proxy; -} - -void TestCvs::init() -{ - // Now create the basic directory structure - QDir tmpdir(QStringLiteral("/tmp")); - tmpdir.mkdir(CVSTEST_BASEDIR); - tmpdir.mkdir(CVS_REPO); - tmpdir.mkdir(CVS_IMPORT); -} - -void TestCvs::cleanup() -{ - if ( QFileInfo::exists(CVSTEST_BASEDIR) ) - KIO::del(QUrl::fromLocalFile(QStringLiteral(CVSTEST_BASEDIR)))->exec(); -} - -void TestCvs::repoInit() -{ - // make job that creates the local repository - CvsJob* j = new CvsJob(0); - QVERIFY( j ); - j->setDirectory(CVSTEST_BASEDIR); - *j << "cvs" << "-d" << CVS_REPO << "init"; - - // try to start the job - QVERIFY( j->exec() ); - - //check if the CVSROOT directory in the new local repository exists now - QVERIFY( QFileInfo::exists(QString(CVS_REPO "/CVSROOT")) ); -} - -void TestCvs::importTestData() -{ - // create a file so we don't import an empty dir - QFile f(CVS_IMPORT "" CVS_TESTFILE_NAME); - if(f.open(QIODevice::WriteOnly)) { - QTextStream input( &f ); - input << "HELLO WORLD"; - } - f.flush(); - - - CvsJob* j = m_proxy->import(QUrl::fromLocalFile(CVS_IMPORT), CVS_REPO, - QStringLiteral("test"), QStringLiteral("vendor"), QStringLiteral("release"), - QStringLiteral("test import message")); - QVERIFY( j ); - - // try to start the job - QVERIFY( j->exec() ); - - //check if the directory has been added to the repository - QString testdir(CVS_REPO "/test"); - QVERIFY( QFileInfo::exists(testdir) ); - - //check if the file has been added to the repository - QString testfile(CVS_REPO "/test/" CVS_TESTFILE_NAME ",v"); - QVERIFY( QFileInfo::exists(testfile) ); -} - - -void TestCvs::checkoutTestData() -{ - CvsJob* j = m_proxy->checkout(QUrl::fromLocalFile(CVS_CHECKOUT), CVS_REPO, QStringLiteral("test")); - QVERIFY( j ); - - // try to start the job - QVERIFY( j->exec() ); - - //check if the directory is there - QString testdir(CVS_CHECKOUT); - QVERIFY( QFileInfo::exists(testdir) ); - - //check if the file is there - QString testfile(CVS_CHECKOUT "" CVS_TESTFILE_NAME); - QVERIFY( QFileInfo::exists(testfile) ); -} - - -void TestCvs::testInitAndImport() -{ - repoInit(); - importTestData(); - checkoutTestData(); -} - -void TestCvs::testLogFolder() -{ - repoInit(); - importTestData(); - checkoutTestData(); - QString testdir(CVS_CHECKOUT); - KDevelop::VcsRevision rev = KDevelop::VcsRevision::createSpecialRevision(KDevelop::VcsRevision::Head); - CvsJob* job = m_proxy->log(QUrl::fromLocalFile(testdir), rev); - QVERIFY(job); -} - -QTEST_MAIN(TestCvs)