File indexing completed on 2024-04-28 05:42:10

0001 /***************************************************************************
0002  *   Copyright (C) 2006-2009 by Rajko Albrecht                             *
0003  *   ral@alwins-world.de                                                   *
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 #include "repository.h"
0025 #include "repositorydata.h"
0026 
0027 namespace svn
0028 {
0029 
0030 namespace repository
0031 {
0032 
0033 Repository::Repository(svn::repository::RepositoryListener *aListener)
0034 {
0035     m_Data = new RepositoryData(aListener);
0036 }
0037 
0038 Repository::~Repository()
0039 {
0040     delete m_Data;
0041 }
0042 
0043 /*!
0044     \fn svn::Repository::Open(const QString&)
0045  */
0046 void Repository::Open(const QString &name)
0047 {
0048     svn_error_t *error = m_Data->Open(name);
0049     if (error != nullptr) {
0050         throw ClientException(error);
0051     }
0052 }
0053 
0054 void Repository::CreateOpen(const CreateRepoParameter &params)
0055 {
0056     svn_error_t *error = m_Data->CreateOpen(params);
0057     if (error != nullptr) {
0058         throw ClientException(error);
0059     }
0060 }
0061 
0062 /*!
0063     \fn svn::Repository::dump(const QString&output,const svn::Revision&start,const svn::Revision&end, bool incremental, bool use_deltas)
0064  */
0065 void Repository::dump(const QString &output, const svn::Revision &start, const svn::Revision &end, bool incremental, bool use_deltas)
0066 {
0067     svn_error_t *error = m_Data->dump(output, start, end, incremental, use_deltas);
0068     if (error != nullptr) {
0069         throw ClientException(error);
0070     }
0071 }
0072 
0073 void Repository::loaddump(const QString &dump, LOAD_UUID uuida, const QString &parentFolder, bool usePre, bool usePost, bool validateProps)
0074 {
0075     svn_repos_load_uuid uuid_action;
0076     switch (uuida) {
0077     case UUID_IGNORE_ACTION:
0078         uuid_action = svn_repos_load_uuid_ignore;
0079         break;
0080     case UUID_FORCE_ACTION:
0081         uuid_action = svn_repos_load_uuid_force;
0082         break;
0083     case UUID_DEFAULT_ACTION:
0084     default:
0085         uuid_action = svn_repos_load_uuid_default;
0086         break;
0087     }
0088     svn_error_t *error = m_Data->loaddump(dump, uuid_action, parentFolder, usePre, usePost, validateProps);
0089     if (error != nullptr) {
0090         throw ClientException(error);
0091     }
0092 }
0093 
0094 /*!
0095     \fn svn::Repository::hotcopy(const QString&src,const QString&dest,bool cleanlogs)
0096  */
0097 void Repository::hotcopy(const QString &src, const QString &dest, bool cleanlogs)
0098 {
0099     svn_error_t *error = RepositoryData::hotcopy(src, dest, cleanlogs);
0100     if (error != nullptr) {
0101         throw ClientException(error);
0102     }
0103 }
0104 
0105 } // namespace repository
0106 
0107 } // namespace svn