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 0025 #include "info_entry.h" 0026 #include "conflictdescription.h" 0027 #include "pool.h" 0028 #include "svnqt_defines.h" 0029 #include <svn_client.h> 0030 #include <svn_path.h> 0031 #include <svn_version.h> 0032 0033 namespace svn 0034 { 0035 0036 InfoEntry::InfoEntry() 0037 { 0038 init(); 0039 } 0040 0041 InfoEntry::InfoEntry(const svn_client_info2_t *info, const char *path) 0042 { 0043 init(info, path); 0044 } 0045 0046 InfoEntry::InfoEntry(const svn_client_info2_t *info, const QString &path) 0047 { 0048 init(info, path); 0049 } 0050 0051 InfoEntry::~InfoEntry() 0052 { 0053 } 0054 0055 DateTime InfoEntry::cmtDate() const 0056 { 0057 return m_last_changed_date; 0058 } 0059 DateTime InfoEntry::textTime() const 0060 { 0061 return m_text_time; 0062 } 0063 DateTime InfoEntry::propTime() const 0064 { 0065 return m_prop_time; 0066 } 0067 bool InfoEntry::hasWc() const 0068 { 0069 return m_hasWc; 0070 } 0071 const LockEntry &InfoEntry::lockEntry() const 0072 { 0073 return m_Lock; 0074 } 0075 const QString &InfoEntry::cmtAuthor() const 0076 { 0077 return m_last_author; 0078 } 0079 const QString &InfoEntry::Name() const 0080 { 0081 return m_name; 0082 } 0083 const QString &InfoEntry::checksum() const 0084 { 0085 return m_checksum; 0086 } 0087 0088 const ConflictDescriptionList &InfoEntry::conflicts() const 0089 { 0090 return m_conflicts; 0091 } 0092 0093 const QUrl &InfoEntry::copyfromUrl() const 0094 { 0095 return m_copyfrom_url; 0096 } 0097 const QString &InfoEntry::prejfile() const 0098 { 0099 return m_prejfile; 0100 } 0101 const QUrl &InfoEntry::reposRoot() const 0102 { 0103 return m_repos_root; 0104 } 0105 const QUrl &InfoEntry::url() const 0106 { 0107 return m_url; 0108 } 0109 const QString &InfoEntry::uuid() const 0110 { 0111 return m_UUID; 0112 } 0113 svn_node_kind_t InfoEntry::kind() const 0114 { 0115 return m_kind; 0116 } 0117 const Revision &InfoEntry::cmtRev() const 0118 { 0119 return m_last_changed_rev; 0120 } 0121 const Revision &InfoEntry::copyfromRev() const 0122 { 0123 return m_copy_from_rev; 0124 } 0125 const Revision &InfoEntry::revision() const 0126 { 0127 return m_revision; 0128 } 0129 svn_wc_schedule_t InfoEntry::Schedule() const 0130 { 0131 return m_schedule; 0132 } 0133 0134 bool InfoEntry::isDir() const 0135 { 0136 return kind() == svn_node_dir; 0137 } 0138 const QByteArray &InfoEntry::changeList() const 0139 { 0140 return m_changeList; 0141 } 0142 qlonglong InfoEntry::size() const 0143 { 0144 return m_size; 0145 } 0146 qlonglong InfoEntry::working_size() const 0147 { 0148 return m_working_size; 0149 } 0150 svn::Depth InfoEntry::depth() const 0151 { 0152 return m_depth; 0153 } 0154 } 0155 0156 /*! 0157 \fn svn::InfoEntry::init() 0158 */ 0159 void svn::InfoEntry::init() 0160 { 0161 m_name.clear(); 0162 m_last_changed_date = DateTime(); 0163 m_text_time = DateTime(); 0164 m_prop_time = DateTime(); 0165 m_hasWc = false; 0166 m_Lock = LockEntry(); 0167 m_checksum.clear(); 0168 m_copyfrom_url.clear(); 0169 m_last_author.clear(); 0170 m_prejfile.clear(); 0171 m_repos_root.clear(); 0172 m_url.clear(); 0173 m_UUID.clear(); 0174 m_kind = svn_node_none; 0175 m_copy_from_rev = SVN_INVALID_REVNUM; 0176 m_last_changed_rev = SVN_INVALID_REVNUM; 0177 m_revision = SVN_INVALID_REVNUM; 0178 m_schedule = svn_wc_schedule_normal; 0179 0180 m_size = m_working_size = SVNQT_SIZE_UNKNOWN; 0181 m_changeList.clear(); 0182 m_depth = DepthUnknown; 0183 } 0184 0185 void svn::InfoEntry::init(const svn_client_info2_t *item, const char *path) 0186 { 0187 init(item, QString::fromUtf8(path)); 0188 } 0189 0190 void svn::InfoEntry::init(const svn_client_info2_t *item, const QString &path) 0191 { 0192 m_hasWc = false; 0193 if (!item) { 0194 init(); 0195 return; 0196 } 0197 m_name = path; 0198 m_last_changed_date = DateTime(item->last_changed_date); 0199 if (item->lock) { 0200 m_Lock.init(item->lock); 0201 } else { 0202 m_Lock = LockEntry(); 0203 } 0204 m_size = item->size != SVN_INVALID_FILESIZE ? qlonglong(item->size) : SVNQT_SIZE_UNKNOWN; 0205 m_repos_root = QUrl::fromEncoded(item->repos_root_URL); 0206 m_url = QUrl::fromEncoded(item->URL); 0207 m_UUID = QString::fromUtf8(item->repos_UUID); 0208 m_kind = item->kind; 0209 m_revision = item->rev; 0210 m_last_changed_rev = item->last_changed_rev; 0211 m_last_author = QString::fromUtf8(item->last_changed_author); 0212 if (item->wc_info != nullptr) { 0213 m_hasWc = true; 0214 m_schedule = item->wc_info->schedule; 0215 if (item->wc_info->copyfrom_url) 0216 m_copyfrom_url = QUrl::fromEncoded(item->wc_info->copyfrom_url); 0217 else 0218 m_copyfrom_url.clear(); 0219 m_copy_from_rev = item->wc_info->copyfrom_rev; 0220 if (item->wc_info->changelist) { 0221 m_changeList = QByteArray(item->wc_info->changelist, strlen(item->wc_info->changelist)); 0222 } else { 0223 m_changeList = QByteArray(); 0224 } 0225 if (item->wc_info->conflicts != nullptr) { 0226 for (int j = 0; j < item->wc_info->conflicts->nelts; ++j) { 0227 svn_wc_conflict_description2_t *_desc = ((svn_wc_conflict_description2_t **)item->wc_info->conflicts->elts)[j]; 0228 m_conflicts.push_back(ConflictDescriptionP(new ConflictDescription(_desc))); 0229 } 0230 } 0231 0232 switch (item->wc_info->depth) { 0233 case svn_depth_exclude: 0234 m_depth = DepthExclude; 0235 break; 0236 case svn_depth_empty: 0237 m_depth = DepthEmpty; 0238 break; 0239 case svn_depth_files: 0240 m_depth = DepthFiles; 0241 break; 0242 case svn_depth_immediates: 0243 m_depth = DepthImmediates; 0244 break; 0245 case svn_depth_infinity: 0246 m_depth = DepthInfinity; 0247 break; 0248 case svn_depth_unknown: 0249 default: 0250 m_depth = DepthUnknown; 0251 break; 0252 } 0253 } else { 0254 m_hasWc = false; 0255 } 0256 }