blob: e39a2c44b0b2c74e816ac49a4d1dfb7eb64d6723 (
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
/***************************************************************************
* Copyright (C) 2005-2007 by Rajko Albrecht *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "commititem.hpp"
#include <svn_client.h>
#include <svn_props.h>
namespace svn {
CommitItem::CommitItem(const svn_client_commit_item_t*_item)
{
init();
if (_item) {
m_Path = TQString::FROMUTF8(_item->path);
m_Kind = _item->kind;
m_Url = TQString::FROMUTF8(_item->url);
if (_item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY) {
m_CopyFromRevision = _item->revision;
} else {
m_Revision = _item->revision;
}
m_CopyFromUrl = TQString::FROMUTF8(_item->copyfrom_url);
m_State = _item->state_flags;
convertprop(_item->wcprop_changes);
}
}
CommitItem::CommitItem(const svn_client_commit_item2_t*_item)
{
init();
if (_item) {
m_Path = TQString::FROMUTF8(_item->path);
m_Kind = _item->kind;
m_Url = TQString::FROMUTF8(_item->url);
m_Revision = _item->revision;
m_CopyFromRevision = _item->copyfrom_rev;
m_CopyFromUrl = TQString::FROMUTF8(_item->copyfrom_url);
m_State = _item->state_flags;
convertprop(_item->wcprop_changes);
}
}
CommitItem::CommitItem(const svn_client_commit_item3_t*_item)
{
init();
if (_item) {
#if ((SVN_VER_MAJOR == 1) && (SVN_VER_MINOR >= 5)) || (SVN_VER_MAJOR > 1)
m_Path = TQString::FROMUTF8(_item->path);
m_Kind = _item->kind;
m_Url = TQString::FROMUTF8(_item->url);
m_Revision = _item->revision;
m_CopyFromRevision = _item->copyfrom_rev;
m_CopyFromUrl = TQString::FROMUTF8(_item->copyfrom_url);
m_State = _item->state_flags;
convertprop(_item->incoming_prop_changes);
if (_item->outgoing_prop_changes)
{
convertprop(_item->outgoing_prop_changes);
}
#endif
}
}
void CommitItem::convertprop(apr_array_header_t * list)
{
if (!list) {
m_CommitProperties.clear();
return;
}
for (int j = 0; j < list->nelts; ++j) {
svn_prop_t * item = ((svn_prop_t **)list->elts)[j];
if (!item) continue;
m_CommitProperties[TQString::FROMUTF8(item->name)]=TQString::FROMUTF8(item->value->data,item->value->len);
}
}
void CommitItem::init()
{
m_Kind = svn_node_unknown;
m_Revision=m_CopyFromRevision = -1;
m_State = 0;
m_CommitProperties.clear();
}
CommitItem::~CommitItem()
{
}
const TQString& CommitItem::path()const
{
return m_Path;
}
const TQString& CommitItem::url()const
{
return m_Url;
}
const TQString& CommitItem::copyfromurl()const
{
return m_CopyFromUrl;
}
const PropertiesMap& CommitItem::properties()const
{
return m_CommitProperties;
}
svn_revnum_t CommitItem::revision()const
{
return m_Revision;
}
svn_revnum_t CommitItem::copyfromrevision()const
{
return m_CopyFromRevision;
}
svn_node_kind_t CommitItem::kind()const
{
return m_Kind;
}
apr_byte_t CommitItem::state()const
{
return m_State;
}
char CommitItem::actionType()const
{
char r=0;
if (m_State & SVN_CLIENT_COMMIT_ITEM_IS_COPY) {
r = 'C';
} else if (m_State & SVN_CLIENT_COMMIT_ITEM_ADD){
r = 'A';
} else if (m_State & SVN_CLIENT_COMMIT_ITEM_DELETE){
r = 'D';
} else if (m_State & SVN_CLIENT_COMMIT_ITEM_PROP_MODS ||
m_State & SVN_CLIENT_COMMIT_ITEM_TEXT_MODS){
r = 'M';
} else if (m_State & SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN){
r = 'L';
}
return r;
}
}
|