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

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 #include "client_impl.h"
0025 
0026 // subversion api
0027 #include <svn_client.h>
0028 
0029 #include "client_parameter.h"
0030 #include "exception.h"
0031 #include "helper.h"
0032 #include "pool.h"
0033 #include "svnqt_defines.h"
0034 #include "targets.h"
0035 
0036 #include <QDebug>
0037 
0038 namespace svn
0039 {
0040 
0041 void Client_impl::merge_reintegrate(const MergeParameter &parameters)
0042 {
0043     Pool pool;
0044     svn_error_t *error = nullptr;
0045     error = svn_client_merge_reintegrate(parameters.path1().cstr(),
0046                                          parameters.peg().revision(),
0047                                          parameters.localPath().cstr(),
0048                                          parameters.dry_run(),
0049                                          parameters.merge_options().array(pool),
0050                                          *m_context,
0051                                          pool);
0052     if (error != nullptr) {
0053         throw ClientException(error);
0054     }
0055 }
0056 
0057 void Client_impl::merge(const MergeParameter &parameters)
0058 {
0059     Pool pool;
0060     svn_error_t *error = nullptr;
0061     if (parameters.reintegrate()) {
0062         merge_reintegrate(parameters);
0063     } else {
0064         // todo svn 1.8: svn_client_merge5
0065         error = svn_client_merge4(parameters.path1().cstr(),
0066                                   parameters.revision1().revision(),
0067                                   parameters.path2().cstr(),
0068                                   parameters.revision2().revision(),
0069                                   parameters.localPath().cstr(),
0070                                   internal::DepthToSvn(parameters.depth()),
0071                                   !parameters.notice_ancestry(),
0072                                   parameters.force(),
0073                                   parameters.record_only(),
0074                                   parameters.dry_run(),
0075                                   parameters.allow_mixed_rev(),
0076                                   parameters.merge_options().array(pool),
0077                                   *m_context,
0078                                   pool);
0079     }
0080 
0081     if (error != nullptr) {
0082         throw ClientException(error);
0083     }
0084 }
0085 
0086 void Client_impl::merge_peg(const MergeParameter &parameters)
0087 {
0088     Pool pool;
0089     internal::RevisionRangesToHash _rhash(parameters.revisions());
0090 
0091     // todo svn 1.8: svn_client_merge_peg5
0092     svn_error_t *error = svn_client_merge_peg4(parameters.path1().cstr(),
0093                                                _rhash.array(pool),
0094                                                parameters.peg(),
0095                                                parameters.localPath().cstr(),
0096                                                internal::DepthToSvn(parameters.depth()),
0097                                                !parameters.notice_ancestry(),
0098                                                parameters.force(),
0099                                                parameters.record_only(),
0100                                                parameters.dry_run(),
0101                                                parameters.allow_mixed_rev(),
0102                                                parameters.merge_options().array(pool),
0103                                                *m_context,
0104                                                pool);
0105     if (error != nullptr) {
0106         throw ClientException(error);
0107     }
0108 }
0109 }