File indexing completed on 2024-05-12 17:16:20
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 * http://kdesvn.alwins-world.de 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 "exception.h" 0042 #include "pool.h" 0043 #include "status.h" 0044 #include "svnqt_defines.h" 0045 #include "helper.h" 0046 #include "diff_data.h" 0047 #include "client_parameter.h" 0048 0049 namespace svn 0050 { 0051 QByteArray 0052 Client_impl::diff_peg(const DiffParameter &options) 0053 { 0054 Pool pool; 0055 svn_error_t *error; 0056 const apr_array_header_t *_options; 0057 0058 // svn_client_diff needs an options array, even if it is empty 0059 _options = options.extra().array(pool); 0060 DiffData ddata(options.tmpPath(), options.path1(), options.rev1(), options.path1(), options.rev2()); 0061 0062 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0063 error = svn_client_diff_peg6( 0064 #else 0065 error = svn_client_diff_peg5( 0066 #endif 0067 _options, 0068 options.path1().cstr(), 0069 options.peg(), 0070 ddata.r1().revision(), 0071 ddata.r2().revision(), 0072 options.relativeTo().length() > 0 ? options.relativeTo().cstr() : QByteArray(/*0*/), 0073 internal::DepthToSvn(options.depth()), 0074 options.ignoreAncestry(), 0075 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0076 false, // TODO: no_diff_added 0077 #endif 0078 options.noDiffDeleted(), 0079 options.copies_as_adds(), 0080 options.ignoreContentType(), 0081 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0082 false, // TODO: ignore_properties 0083 false, // TODO: properties_only 0084 #endif 0085 options.git_diff_format(), 0086 APR_LOCALE_CHARSET, 0087 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0088 ddata.outStream(), 0089 ddata.errStream(), 0090 #else 0091 ddata.outFile(), 0092 ddata.errFile(), 0093 #endif 0094 options.changeList().array(pool), 0095 *m_context, 0096 pool 0097 ); 0098 0099 if (error != nullptr) { 0100 throw ClientException(error); 0101 } 0102 return ddata.content(); 0103 } 0104 0105 QByteArray 0106 Client_impl::diff(const DiffParameter &options) 0107 { 0108 0109 Pool pool; 0110 svn_error_t *error; 0111 const apr_array_header_t *_options; 0112 0113 // svn_client_diff needs an options array, even if it is empty 0114 if (options.extra().isNull()) { 0115 _options = apr_array_make(pool, 0, 0); 0116 } else { 0117 _options = options.extra().array(pool); 0118 } 0119 DiffData ddata(options.tmpPath(), options.path1(), options.rev1(), options.path2(), options.rev2()); 0120 0121 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0122 error = svn_client_diff6(_options, 0123 #else 0124 error = svn_client_diff5(_options, 0125 #endif 0126 options.path1().cstr(), 0127 ddata.r1().revision(), 0128 options.path2().cstr(), 0129 ddata.r2().revision(), 0130 options.relativeTo().length() > 0 ? options.relativeTo().cstr() : QByteArray(/*0*/), 0131 internal::DepthToSvn(options.depth()), 0132 options.ignoreAncestry(), 0133 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0134 false, // TODO: no_diff_added 0135 #endif 0136 options.noDiffDeleted(), 0137 options.copies_as_adds(), 0138 options.ignoreContentType(), 0139 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0140 false, // TODO: ignore_properties 0141 false, // TODO: properties_only 0142 #endif 0143 options.git_diff_format(), 0144 APR_LOCALE_CHARSET, 0145 #if SVN_API_VERSION >= SVN_VERSION_CHECK(1,8,0) 0146 ddata.outStream(), 0147 ddata.errStream(), 0148 #else 0149 ddata.outFile(), 0150 ddata.errFile(), 0151 #endif 0152 options.changeList().array(pool), 0153 *m_context, 0154 pool); 0155 0156 if (error != nullptr) { 0157 throw ClientException(error); 0158 } 0159 return ddata.content(); 0160 0161 } 0162 } 0163 0164 /* ----------------------------------------------------------------- 0165 * local variables: 0166 * eval: (load-file "../../rapidsvn-dev.el") 0167 * end: 0168 */