KDE/kdevplatform [POSSIBLY UNSAFE]
Andreas Pakulat
apaku at gmx.de
Sat Jun 9 16:54:55 UTC 2007
SVN commit 673262 by apaku:
Implementations for the various helper classes.
Removal of the now obsolte iversioncontrol interface
Moving the pure interfaces into interfaces subdir
Move some of the classes to their own header/cpp to unclutter the vcshelpers class
CCMAIL:kdevelop-devel at kdevelop.org
M +2 -2 plugins/CMakeLists.txt
M +21 -3 src/vcs/CMakeLists.txt
D src/vcs/ibasicversioncontrol.h
D src/vcs/ibranchingversioncontrol.h
D src/vcs/ibrowsableversioncontrol.h
D src/vcs/idistributedversioncontrol.h
A src/vcs/interfaces (directory)
A src/vcs/interfaces/ibasicversioncontrol.h src/vcs/ibasicversioncontrol.h#672852 [POSSIBLY UNSAFE: system] [License: GPL (v2+)]
A src/vcs/interfaces/ibranchingversioncontrol.h src/vcs/ibranchingversioncontrol.h#672852 [License: GPL (v2+)]
A src/vcs/interfaces/ibrowsableversioncontrol.h src/vcs/ibrowsableversioncontrol.h#672852 [License: GPL (v2+)]
A src/vcs/interfaces/idistributedversioncontrol.h src/vcs/idistributedversioncontrol.h#672852 [License: GPL (v2+)]
A src/vcs/interfaces/irepositoryversioncontrol.h src/vcs/irepositoryversioncontrol.h#672852 [License: GPL (v2+)]
D src/vcs/irepositoryversioncontrol.h
D src/vcs/iversioncontrol.cpp
D src/vcs/iversioncontrol.h
A src/vcs/vcsannotation.cpp [License: LGPL (v2+)]
A src/vcs/vcsannotation.h src/vcs/vcshelpers.h#672852 [License: GPL (v2+)]
A src/vcs/vcsdiff.cpp [License: no copyright LGPL (v2+)]
A src/vcs/vcsdiff.h src/vcs/vcshelpers.h#672852 [License: GPL (v2+)]
A src/vcs/vcsevent.cpp [License: LGPL (v2+)]
A src/vcs/vcsevent.h src/vcs/vcshelpers.h#672852 [License: GPL (v2+)]
A src/vcs/vcshelpers.cpp [License: LGPL (v2+)]
M +18 -325 src/vcs/vcshelpers.h
A src/vcs/vcsjob.cpp [License: LGPL (v2+)]
A src/vcs/vcsjob.h src/vcs/vcshelpers.h#672852 [License: GPL (v2+)]
A src/vcs/vcsrevision.cpp [License: LGPL (v2+)]
A src/vcs/vcsrevision.h src/vcs/vcshelpers.h#672852 [License: GPL (v2+)]
--- trunk/KDE/kdevplatform/plugins/CMakeLists.txt #673261:673262
@@ -5,7 +5,7 @@
add_subdirectory(genericprojectmanager)
add_subdirectory(standardoutputview)
macro_optional_add_subdirectory(snippet)
-macro_optional_add_subdirectory(cvs)
+#macro_optional_add_subdirectory(cvs)
find_package(Commoncpp)
find_package(BoostLibraries)
@@ -15,7 +15,7 @@
find_package(SubversionLibrary)
if(SUBVERSION_FOUND)
- macro_optional_add_subdirectory(subversion)
+#macro_optional_add_subdirectory(subversion)
endif(SUBVERSION_FOUND)
--- trunk/KDE/kdevplatform/src/vcs/CMakeLists.txt #673261:673262
@@ -1,10 +1,14 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/src/interfaces
)
set(kdevplatformvcs_LIB_SRCS
- iversioncontrol.cpp
+ vcsjob.cpp
+ vcsrevision.cpp
+ vcsannotation.cpp
+ vcsdiff.cpp
+ vcsevent.cpp
+ vcshelpers.cpp
)
kde4_automoc(${kdevplatformvcs_LIB_SRCS})
@@ -16,7 +20,21 @@
install(FILES
vcsexport.h
- iversioncontrol.h
+ vcsjob.h
+ vcsrevision.h
+ vcsannotation.h
+ vcsdiff.h
+ vcsevent.h
+ vcshelpers.h
DESTINATION ${INCLUDE_INSTALL_DIR}/kdevplatform/vcs
)
+
+install(FILES
+ interfaces/ibasicversioncontrol.h
+ interfaces/ibranchingversioncontrol.h
+ interfaces/ibrowsableversioncontrol.h
+ interfaces/idistributedversioncontrol.h
+ interfaces/irepositoryversioncontrol.h
+ DESTINATION ${INCLUDE_INSTALL_DIR}/kdevplatform/vcs/interfaces
+)
--- trunk/KDE/kdevplatform/src/vcs/vcshelpers.h #673261:673262
@@ -22,12 +22,12 @@
#ifndef VCSHELPERS_H
#define VCSHELPERS_H
-#include <QVariant>
-#include <QString>
-#include <KUrl>
-
+#include <QtCore/QVariant>
#include "vcsexport.h"
+class QString;
+class QStringList;
+
namespace KDevelop
{
@@ -45,49 +45,6 @@
};
/**
- * Encapsulates a vcs revision number, date or range of revisions
- */
-class KDEVPLATFORMVCS_EXPORT VcsRevision
-{
-public:
- /**
- * @note Not all VCS's support both FileNumber and GlobalNumber. For those
- * that don't, asking for one may give you the other, therefore you should
- * check which is returned. For example, CVS does not support GlobalNumber,
- * and Subversion does not support FileNumber, while Perforce supports both.
- */
- enum RevisionType
- {
- Special /**<One of the special versions in RevisionSpecialType.*/,
- GlobalNumber /**<Global repository version when item was last changed.*/,
- FileNumber /**<Item's independent version number.*/,
- Date,
- };
- enum RevisionSpecialType
- {
- Head /**<Latest revision in the repository.*/,
- Working /**<The local copy (including any changes made).*/,
- Base /**<The repository source of the local copy.*/,
- Previous /**<The version prior the other one (only valid in functions that take two revisions).*/,
- };
-
- /**
- * Set the value of this revision
- */
- bool setRevisionValue( const QVariant& rev, RevisionType );
-
- /**
- * returns the type of the revision
- */
- RevisionType revisionType() const;
-
- /**
- * return the value of this revision
- */
- QString revisionValue() const;
-};
-
-/**
* Small container class that has a mapping of
* repository-location -> local location including a recursion flag
*
@@ -102,290 +59,26 @@
NonRecursive = 2
};
- void addMapping( const KUrl& sourceLocation,
- const KUrl& destinationLocation,
+ VcsMapping();
+ ~VcsMapping();
+ VcsMapping(const VcsMapping&);
+
+ void addMapping( const QString& sourceLocation,
+ const QString& destinationLocation,
MappingFlag recursion );
- void removeMapping( const KUrl& sourceLocation);
- KUrl::List sourceLocations();
- KUrl destinationLocation( const KUrl& sourceLocation );
- MappingFlag mappingFlag( const KUrl& sourceLocation ) const;
-};
+ void removeMapping( const QString& sourceLocation);
+ QStringList sourceLocations() const;
+ QString destinationLocation( const QString& sourceLocation ) const;
+ MappingFlag mappingFlag( const QString& sourceLocation ) const;
-/**
- * Small container class that contains information about a history event of a
- * single repository item.
- */
-class KDEVPLATFORMVCS_EXPORT VcsItemEvent
-{
-public:
- /**
- * Class that tells you what happened to a given repository location in a
- * specific revision.
- *
- * Combinations of some of the flags are possible, for example Add|Modified,
- * Copy|Modified or Merge|Modified, or when returned from VcsEvent::actions().
- */
- enum Action
- {
- Added = 1<<0 /**<Item was added.*/,
- Deleted = 1<<1 /**<Item was deleted.*/,
- Modified = 1<<2 /**<Item was modified, for example by editing.*/,
- Copied = 1<<3 /**<Item was copied.*/,
- Merged = 1<<4 /**<Item had changes merged into it.*/,
- ContentsModified = 1<<5 /**<Directory was not changed (only contents changed).*/,
- };
- Q_DECLARE_FLAGS( Actions, Action )
-
- KUrl repositoryLocation();
- KUrl repositoryCopySourceLocation(); // may be empty
- VcsRevision repositoryCopySourceRevision(); // may be invalid, even if rCSL is not
- VcsRevision revision(); // the FileNumber revision, may be the same as the GlobalNumber
- Actions actions();
+ VcsMapping& operator=( const VcsMapping& rhs);
+private:
+ class VcsMappingPrivate* const d;
};
-/**
- * Small container class that contains information about a single revision.
- *
- * @note log() only returns information about the specific item that was asked
- * about. When working with a VCS that supports atomic commits (i.e. where a
- * revision might affect more than one item), use change() to retrieve
- * information about all items affected by a particular revision.
- */
-class KDEVPLATFORMVCS_EXPORT VcsEvent
-{
-public:
- VcsRevision revision(); // the GlobalNumber revision
- QString author();
- QDate date();
- QString message();
- VcsItemEvent::Actions actions();
- QList<VcsItemEvent> items();
-};
-
-/**
- * This class encapsulates running a vcs job. It allows to start a job and
- * retrieve results
- *
- * @TODO: Should this stay an interface or do we just subclass KJob?
- */
-class KDEVPLATFORMVCS_EXPORT VcsJob
-{
-public:
- /**
- * To easily check which type of job this is
- *
- * @TODO: Check how this can be extended via plugins, maybe use QFlag? (not
- * QFlags!)
- */
- enum Type
- {
- Add,
- Remove,
- Copy,
- Move,
- Diff,
- Commit,
- Update,
- Merge,
- Resolve,
- Import,
- Checkout,
- Log,
- Push,
- Pull,
- Annotate,
- Clone,
- Status,
- Revert
- };
-
- /**
- * Simple enum to define how the job finished
- */
- enum FinishStatus
- {
- Succeeded,
- Canceled,
- Failed
- };
-
- /**
- * This method will return all new results of the job. The actual data
- * type that is wrapped in the QVariant depends on the type of job.
- *
- * @note Results returned by a previous call to fetchResults are not
- * returned.
- */
- QVariant fetchResults();
-
- /**
- * Used to find out about the type of job
- *
- * @return the type of job
- */
- Type type();
-
- /**
- * Can be used to obtain an error message if the job exited with an error
- * status. If there is no error, or the job is not finished, this is an
- * empty string.
- */
- QString errorMessage();
-
- /**
- * The job is started and the method returns control to the caller only
- * after the job has finished.
- *
- * There's no need to setup signal/slot connections to be able to use
- * this method, all results are available after exec returned.
- *
- * @return the FinishStatus
- */
- FinishStatus exec();
-
-public Q_SLOTS:
- /**
- * The job is not allowed to emit any signals until this method has been
- * called. A plugin may either really start the job here, or it may
- * buffer any signals before start has been called.
- *
- * This method executes the job in an asynchronous way and the job
- * will emit signals.
- */
- void start();
-
- /**
- * This cancels the job. The job shall not emit any signals except the
- * finished() signal when the cancelling is done and any resources have
- * been cleaned up.
- */
- void cancel();
-
-Q_SIGNALS:
- /**
- * This signal is emitted when new results are available. Depending on
- * the plugin and the operation, it may be emitted only once when all
- * results are ready, or several times.
- */
- void resultsReady( VcsJob* );
-
- /**
- * This signal is emitted when the job has completed. Depending on
- * @p FinishStatus, this may mean that the job failed, succeeded, or has
- * been fully cancelled.
- *
- * It is safe to delete the job once this signal has been emitted.
- * job.
- */
- void finished( VcsJob*, FinishStatus );
-};
-
-/**
- * Annotations for a local file.
- *
- * This class lets the user fetch information for each line of a local file,
- * including date of last change, author of last change and revision of
- * last change to the line.
- */
-class KDEVPLATFORMVCS_EXPORT VcsAnnotation
-{
-public:
- /**
- * @return the local url of the file
- */
- KUrl location();
- /**
- * @return the number of lines in the file
- */
- int lineCount();
- /**
- * @param linenum the number of the line, counting from 0
- * @return the content of the specified line
- */
- QString line( int linenum );
- /**
- * @param linenum the number of the line, counting from 0
- * @return the revision of the last change on the specified line
- */
- VcsRevision revision( int linenum );
- /**
- * @param linenum the number of the line, counting from 0
- * @return the author of the last change on the specified line
- */
- QString author( int linenum );
- /**
- * @param linenum the number of the line, counting from 0
- * @return the date of the last change on the specified line
- */
- QDateTime date( int linenum );
-};
-
-class KDEVPLATFORMVCS_EXPORT VcsDiff
-{
-public:
- /**
- * Specify the type of difference the diff() method should create. Note that a
- * request for DiffUnified may not be honored, e.g. if the items being diffed are
- * binary rather than text.
- */
- enum Type
- {
- DiffRaw /**<Request complete copies of both items.*/,
- DiffUnified /**<Request copy of first item with diff.*/,
- DiffDontCare /**<Don't care; plugin will return whichever is easiest.*/,
- };
-
- enum Content
- {
- Binary /** Binary diff, using the full content of both files.*/,
- Text /** Textual diff.*/,
- };
-
- /**
- * @returns the type of diff, i.e. raw or unified
- */
- Type type() const;
-
- /**
- * @returns the content type, i.e. binary or text
- */
- Content contentType() const;
-
- /**
- * @returns the binary content of the first file of the difference or
- * an empty QByteArray if this is a textual diff
- */
- QByteArray firstBinary() const;
-
- /**
- * @returns the binary content of the second file of the difference or
- * an empty QByteArray if this is a textual diff
- */
- QByteArray secondBinary() const;
-
- /**
- * @returns the textual content of the first file of the difference or
- * an empty QString if this is a binary diff
- */
- QString firstText() const;
-
- /**
- * @returns the textual content of the second file of the difference or
- * an empty QString if this is a unified or binary diff
- */
- QString secondText() const;
-
- /**
- * @returns the difference between the first and the second file in
- * unified diff format or an empty QString if this is a binary diff
- * or a textual diff using raw format
- */
- QString diff() const;
-};
-
}
-Q_DECLARE_OPERATORS_FOR_FLAGS( KDevelop::VcsItemEvent::Actions )
+Q_DECLARE_METATYPE( KDevelop::VcsMapping )
#endif
More information about the KDevelop-devel
mailing list