File indexing completed on 2024-04-28 05:42:07
0001 /* 0002 * Port for usage with qt-framework and development for kdesvn 0003 * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) 0004 * https://kde.org/applications/development/org.kde.kdesvn 0005 */ 0006 /* 0007 * ==================================================================== 0008 * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. 0009 * dev@rapidsvn.tigris.org 0010 * 0011 * This library is free software; you can redistribute it and/or 0012 * modify it under the terms of the GNU Lesser General Public 0013 * License as published by the Free Software Foundation; either 0014 * version 2.1 of the License, or (at your option) any later version. 0015 * 0016 * This library is distributed in the hope that it will be useful, 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0019 * Lesser General Public License for more details. 0020 * 0021 * You should have received a copy of the GNU Lesser General Public 0022 * License along with this library (in the file LGPL.txt); if not, 0023 * write to the Free Software Foundation, Inc., 51 Franklin St, 0024 * Fifth Floor, Boston, MA 02110-1301 USA 0025 * 0026 * This software consists of voluntary contributions made by many 0027 * individuals. For exact contribution history, see the revision 0028 * history and logs, available at http://rapidsvn.tigris.org/. 0029 * ==================================================================== 0030 */ 0031 0032 // svncpp 0033 #include "client_impl.h" 0034 0035 // Subversion api 0036 #include <svn_client.h> 0037 #include <svn_path.h> 0038 // apr 0039 #include <apr_xlate.h> 0040 0041 #include "client_parameter.h" 0042 #include "diff_data.h" 0043 #include "exception.h" 0044 #include "helper.h" 0045 #include "pool.h" 0046 #include "status.h" 0047 #include "svnqt_defines.h" 0048 0049 namespace svn 0050 { 0051 QByteArray Client_impl::diff_peg(const DiffParameter &options) 0052 { 0053 Pool pool; 0054 svn_error_t *error; 0055 const apr_array_header_t *_options; 0056 0057 // svn_client_diff needs an options array, even if it is empty 0058 _options = options.extra().array(pool); 0059 DiffData ddata(options.tmpPath(), options.path1(), options.rev1(), options.path1(), options.rev2()); 0060 0061 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0062 error = svn_client_diff_peg6( 0063 #else 0064 error = svn_client_diff_peg5( 0065 #endif 0066 _options, 0067 options.path1().cstr(), 0068 options.peg(), 0069 ddata.r1().revision(), 0070 ddata.r2().revision(), 0071 options.relativeTo().length() > 0 ? options.relativeTo().cstr() : QByteArray(/*0*/), 0072 internal::DepthToSvn(options.depth()), 0073 options.ignoreAncestry(), 0074 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0075 false, // TODO: no_diff_added 0076 #endif 0077 options.noDiffDeleted(), 0078 options.copies_as_adds(), 0079 options.ignoreContentType(), 0080 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0081 false, // TODO: ignore_properties 0082 false, // TODO: properties_only 0083 #endif 0084 options.git_diff_format(), 0085 APR_LOCALE_CHARSET, 0086 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0087 ddata.outStream(), 0088 ddata.errStream(), 0089 #else 0090 ddata.outFile(), 0091 ddata.errFile(), 0092 #endif 0093 options.changeList().array(pool), 0094 *m_context, 0095 pool); 0096 0097 if (error != nullptr) { 0098 throw ClientException(error); 0099 } 0100 return ddata.content(); 0101 } 0102 0103 QByteArray Client_impl::diff(const DiffParameter &options) 0104 { 0105 Pool pool; 0106 svn_error_t *error; 0107 const apr_array_header_t *_options; 0108 0109 // svn_client_diff needs an options array, even if it is empty 0110 if (options.extra().isNull()) { 0111 _options = apr_array_make(pool, 0, 0); 0112 } else { 0113 _options = options.extra().array(pool); 0114 } 0115 DiffData ddata(options.tmpPath(), options.path1(), options.rev1(), options.path2(), options.rev2()); 0116 0117 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0118 error = svn_client_diff6(_options, 0119 #else 0120 error = svn_client_diff5(_options, 0121 #endif 0122 options.path1().cstr(), 0123 ddata.r1().revision(), 0124 options.path2().cstr(), 0125 ddata.r2().revision(), 0126 options.relativeTo().length() > 0 ? options.relativeTo().cstr() : QByteArray(/*0*/), 0127 internal::DepthToSvn(options.depth()), 0128 options.ignoreAncestry(), 0129 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0130 false, // TODO: no_diff_added 0131 #endif 0132 options.noDiffDeleted(), 0133 options.copies_as_adds(), 0134 options.ignoreContentType(), 0135 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0136 false, // TODO: ignore_properties 0137 false, // TODO: properties_only 0138 #endif 0139 options.git_diff_format(), 0140 APR_LOCALE_CHARSET, 0141 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1, 8, 0) 0142 ddata.outStream(), 0143 ddata.errStream(), 0144 #else 0145 ddata.outFile(), 0146 ddata.errFile(), 0147 #endif 0148 options.changeList().array(pool), 0149 *m_context, 0150 pool); 0151 0152 if (error != nullptr) { 0153 throw ClientException(error); 0154 } 0155 return ddata.content(); 0156 } 0157 } 0158 0159 /* ----------------------------------------------------------------- 0160 * local variables: 0161 * eval: (load-file "../../rapidsvn-dev.el") 0162 * end: 0163 */