File indexing completed on 2024-05-12 05:44:36

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2009 by Rajko Albrecht  ral@alwins-world.de        *
0003  *   https://kde.org/applications/development/org.kde.kdesvn               *
0004  *                                                                         *
0005  * This program is free software; you can redistribute it and/or           *
0006  * modify it under the terms of the GNU Lesser General Public              *
0007  * License as published by the Free Software Foundation; either            *
0008  * version 2.1 of the License, or (at your option) any later version.      *
0009  *                                                                         *
0010  * This program is distributed in the hope that it will be useful,         *
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
0013  * Lesser General Public License for more details.                         *
0014  *                                                                         *
0015  * You should have received a copy of the GNU Lesser General Public        *
0016  * License along with this program (in the file LGPL.txt); if not,         *
0017  * write to the Free Software Foundation, Inc., 51 Franklin St,            *
0018  * Fifth Floor, Boston, MA  02110-1301  USA                                *
0019  *                                                                         *
0020  * This software consists of voluntary contributions made by many          *
0021  * individuals.  For exact contribution history, see the revision          *
0022  * history and logs, available at https://commits.kde.org/kdesvn.          *
0023  ***************************************************************************/
0024 #ifndef REPOS_LOG_H
0025 #define REPOS_LOG_H
0026 
0027 #include "svnqt/client.h"
0028 #include "svnqt/revision.h"
0029 #include "svnqt/svnqt_defines.h"
0030 #include "svnqt/svnqttypes.h"
0031 
0032 #include <QSqlDatabase>
0033 #include <QString>
0034 #include <QStringList>
0035 
0036 namespace svn
0037 {
0038 
0039 namespace cache
0040 {
0041 
0042 class SVNQT_EXPORT ReposLog
0043 {
0044 protected:
0045     svn::ClientP m_Client;
0046     mutable QSqlDatabase m_Database;
0047     QString m_ReposRoot;
0048     svn::Revision m_latestHead;
0049     //! internal insert.
0050     bool _insertLogEntry(const svn::LogEntry &);
0051     bool checkFill(svn::Revision &_start, svn::Revision &_end, bool checkHead);
0052 
0053 public:
0054     explicit ReposLog(const svn::ClientP &aClient, const QString &aRepository = QString());
0055 
0056     QString ReposRoot() const
0057     {
0058         return m_ReposRoot;
0059     }
0060 
0061     QSqlDatabase Database() const
0062     {
0063         return m_Database;
0064     }
0065     //! search for latest head revision on network for assigned repository
0066     svn::Revision latestHeadRev();
0067     //! return lates revision in cache
0068     svn::Revision latestCachedRev();
0069     //! simple retrieves logentries
0070     /*!
0071      * This method acts on network, too for checking if there are new entries on server.
0072      *
0073      * @param target where to store the result
0074      * @param start revision to start for search
0075      * @param end revision to end for search
0076      * @param noNetwork if yes, no check on network for newer revisions will made
0077      * @return true if entries found and no error, if no entries found false
0078      * @exception svn::DatabaseException in case of errors
0079      */
0080     bool
0081     simpleLog(LogEntriesMap &target, const svn::Revision &start, const svn::Revision &end, bool noNetwork = false, const StringArray &exclude = StringArray());
0082     svn::Revision date2numberRev(const svn::Revision &, bool noNetwork = false);
0083     bool fillCache(const svn::Revision &end);
0084     bool insertLogEntry(const svn::LogEntry &);
0085     void cleanLogEntries();
0086     bool log(const svn::Path &,
0087              const svn::Revision &start,
0088              const svn::Revision &end,
0089              const svn::Revision &peg,
0090              svn::LogEntriesMap &target,
0091              bool strictNodeHistory,
0092              int limit);
0093     bool itemExists(const svn::Revision &, const svn::Path &);
0094 
0095     qlonglong count() const;
0096     qlonglong itemCount() const;
0097     qlonglong fileSize() const;
0098 
0099     bool isValid() const;
0100 };
0101 
0102 }
0103 }
0104 
0105 #endif