summaryrefslogtreecommitdiffstats
path: root/src/svnqt/tests/lsdir.cpp
blob: f3a2f6fde14ab4f6e8b5fb2f7a1e153fd22c549c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

#include "src/svnqt/client.hpp"
#include "src/svnqt/tests/testconfig.h"
#include "src/svnqt/status.hpp"
#include "src/svnqt/svnqttypes.hpp"
#include <iostream>

int main(int,char**)
{
    svn::ContextP m_CurrentContext;
    svn::Client* m_Svnclient;
    m_Svnclient=svn::Client::getobject(0,0);
    m_CurrentContext = new svn::Context();

    m_Svnclient->setContext(m_CurrentContext);
    svn::DirEntries dlist;

    TQString p = TQString("file://%1").arg(TESTREPOPATH);
    TQString l = TQString("%1").arg(TESTCOPATH);

    try {
        dlist = m_Svnclient->list(svn::Path(p),svn::Revision::HEAD,svn::Revision::HEAD,svn::DepthInfinity,true);
    } catch (svn::ClientException e) {
        TQString ex = e.msg();
        std::cout << ex.TOUTF8() << std::endl;
        return -1;
    }
    std::cout << "List 1 "<<dlist.size()<<std::endl;
    for (unsigned int i=0; i < dlist.size();++i) {
        TQDateTime dt = svn::DateTime(dlist[i]->time());
        std::cout << dlist[i]->name() << " "
                << dlist[i]->lastAuthor() << " "
                << dlist[i]->size() << " "
                << dt.toTime_t() << std::endl;
    }
    try {
        dlist = m_Svnclient->list(svn::Path(p),svn::Revision::HEAD,svn::Revision::HEAD,svn::DepthImmediates,false);
    } catch (svn::ClientException e) {
        TQString ex = e.msg();
        std::cout << ex.TOUTF8() << std::endl;
        return -1;
    }
    std::cout << "================"<<std::endl;
    std::cout << "List 2 "<<dlist.size()<<std::endl;
    for (unsigned int i=0; i < dlist.size();++i) {
        TQDateTime dt = svn::DateTime(dlist[i]->time());
        std::cout << dlist[i]->name() << " "
                << dlist[i]->lastAuthor() << " "
                << dlist[i]->size() << " "
                << dt.toTime_t() << std::endl;
    }
    std::cout << "================"<<std::endl;
    svn::StatusEntries slist;
    try {
        slist = m_Svnclient->status(svn::Path(p),svn::DepthInfinity,true,true,true,svn::Revision::HEAD,true,false);
    } catch (svn::ClientException e) {
        TQString ex = e.msg();
        std::cout << ex.TOUTF8() << std::endl;
        return -1;
    }
    for (unsigned int i=0; i < slist.size();++i) {
        std::cout << slist[i]->path()<< std::endl;
    }
    std::cout << "================"<<std::endl;
    std::cout << "Second status:"<<std::endl;
    try {
        slist = m_Svnclient->status(svn::Path(l),svn::DepthInfinity,true,true,true,svn::Revision::WORKING,true,false);
    } catch (svn::ClientException e) {
        TQString ex = e.msg();
        std::cout << ex.TOUTF8() << std::endl;
        return -1;
    }
    for (unsigned int i=0; i < slist.size();++i) {
        std::cout << slist[i]->path()<< std::endl;
    }

    return 0;
}