File indexing completed on 2024-05-12 05:44:36
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 0025 #include "svnqt/client.h" 0026 #include "svnqt/client_parameter.h" 0027 #include "svnqt/status.h" 0028 #include "svnqt/svnqttypes.h" 0029 #include "svnqt/tests/testconfig.h" 0030 #include <iostream> 0031 0032 int main(int, char **) 0033 { 0034 svn::ContextP m_CurrentContext(new svn::Context); 0035 svn::ClientP m_Svnclient = svn::Client::getobject(m_CurrentContext); 0036 0037 svn::DirEntries dlist; 0038 QString p = QString("file://%1").arg(TESTREPOPATH); 0039 QString l = QString("%1").arg(TESTCOPATH); 0040 0041 try { 0042 dlist = m_Svnclient->list(svn::Path(p), svn::Revision::HEAD, svn::Revision::HEAD, svn::DepthInfinity, true); 0043 } catch (const svn::ClientException &e) { 0044 QString ex = e.msg(); 0045 std::cout << ex.toUtf8().data() << std::endl; 0046 return -1; 0047 } 0048 std::cout << "List 1 " << dlist.size() << std::endl; 0049 Q_FOREACH (const svn::DirEntry &entry, dlist) { 0050 QDateTime dt(svn::DateTime(entry.time()).toQDateTime()); 0051 std::cout << entry.name().toUtf8().data() << " " << entry.lastAuthor().toUtf8().data() << " " << entry.size() << " " << dt.toSecsSinceEpoch() 0052 << std::endl; 0053 } 0054 try { 0055 dlist = m_Svnclient->list(svn::Path(p), svn::Revision::HEAD, svn::Revision::HEAD, svn::DepthImmediates, false); 0056 } catch (const svn::ClientException &e) { 0057 QString ex = e.msg(); 0058 std::cout << ex.toUtf8().data() << std::endl; 0059 return -1; 0060 } 0061 std::cout << "================" << std::endl; 0062 std::cout << "List 2 " << dlist.size() << std::endl; 0063 Q_FOREACH (const svn::DirEntry &entry, dlist) { 0064 QDateTime dt = svn::DateTime(entry.time()).toQDateTime(); 0065 std::cout << entry.name().toUtf8().data() << " " << entry.lastAuthor().toUtf8().data() << " " << entry.size() << " " << dt.toSecsSinceEpoch() 0066 << std::endl; 0067 } 0068 std::cout << "================" << std::endl; 0069 svn::StatusEntries slist; 0070 svn::StatusParameter params(p); 0071 try { 0072 slist = m_Svnclient->status( 0073 params.depth(svn::DepthInfinity).all(true).update(true).noIgnore(true).revision(svn::Revision::HEAD).detailedRemote(true).ignoreExternals(false)); 0074 } catch (const svn::ClientException &e) { 0075 QString ex = e.msg(); 0076 std::cout << ex.toUtf8().data() << std::endl; 0077 return -1; 0078 } 0079 for (int i = 0; i < slist.size(); ++i) { 0080 std::cout << slist[i]->path().toUtf8().data() << std::endl; 0081 } 0082 std::cout << "================" << std::endl; 0083 std::cout << "Second status:" << std::endl; 0084 0085 try { 0086 slist = m_Svnclient->status(params.path(l) 0087 .depth(svn::DepthInfinity) 0088 .all(true) 0089 .update(true) 0090 .noIgnore(true) 0091 .revision(svn::Revision::WORKING) 0092 .detailedRemote(true) 0093 .ignoreExternals(false)); 0094 } catch (const svn::ClientException &e) { 0095 QString ex = e.msg(); 0096 std::cout << ex.toUtf8().data() << std::endl; 0097 return -1; 0098 } 0099 for (int i = 0; i < slist.size(); ++i) { 0100 std::cout << slist[i]->path().toUtf8().data() << std::endl; 0101 } 0102 0103 return 0; 0104 }