1 |
// Subversion Client |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#include <cxx/standard.hh> |
8 |
|
9 |
#include "Client.hpp" |
10 |
|
11 |
namespace Subversion |
12 |
{ |
13 |
|
14 |
namespace |
15 |
{ |
16 |
|
17 |
::svn_error_t *GetEntryCommittedDate_(void *date, const char *path, const ::svn_info_t *info, ::apr_pool_t *pool) |
18 |
{ |
19 |
*reinterpret_cast<std::time_t *>(date) = apr_time_sec(info->last_changed_date); |
20 |
|
21 |
return SVN_NO_ERROR; |
22 |
} |
23 |
|
24 |
} |
25 |
|
26 |
Client::Client() |
27 |
{ |
28 |
CheckError(::svn_client_create_context(&context, pool)); |
29 |
} |
30 |
|
31 |
cse::String Client::GetProperty(const cse::String &property, const cse::String &target) |
32 |
{ |
33 |
::apr_hash_t *hash; |
34 |
::svn_opt_revision_t revision = { ::svn_opt_revision_unspecified }; |
35 |
|
36 |
CheckError(::svn_client_propget2(&hash, property.NullTerminate(), target.NullTerminate(), &revision, &revision, false, context, pool)); |
37 |
|
38 |
if (::apr_hash_index_t *index = ::apr_hash_first(pool, hash)) |
39 |
{ |
40 |
::svn_string_t *string; |
41 |
|
42 |
::apr_hash_this(index, NULL, NULL, reinterpret_cast<void **>(&string)); |
43 |
|
44 |
return cse::String(string->data, string->len); |
45 |
} |
46 |
else |
47 |
return cse::EmptyString; |
48 |
} |
49 |
|
50 |
std::time_t Client::GetEntryCommittedDate(const cse::String &target) |
51 |
{ |
52 |
std::time_t date; |
53 |
|
54 |
CheckError(::svn_client_info(target.NullTerminate(), NULL, NULL, &GetEntryCommittedDate_, &date, false, context, pool)); |
55 |
|
56 |
return date; |
57 |
} |
58 |
|
59 |
} |