ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/Subversion/Client.cpp
Revision: 704
Committed: 2006-03-16T05:20:28-08:00 (19 years, 3 months ago) by douglas
File size: 2659 byte(s)
Log Message:
This should probably have been committed yesterdayishlyaphone.

File Contents

# User Rev Content
1 douglas 697 // Subversion Client
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include <cxx/standard.hh>
8    
9 douglas 704 #include <apr_tables.h>
10    
11 douglas 697 #include "Client.hpp"
12    
13     namespace Subversion
14     {
15    
16     Client::Client()
17     {
18 douglas 698 CheckError(::svn_client_create_context(&context, pool));
19 douglas 704
20     ::apr_array_header_t *providers(::apr_array_make(pool, 5, sizeof (::svn_auth_provider_object_t *)));
21    
22     #ifdef _WIN32
23     ::svn_client_get_windows_simple_provider(reinterpret_cast< ::svn_auth_provider_object_t **>(::apr_array_push(providers)), pool);
24     #endif
25     ::svn_client_get_simple_provider(reinterpret_cast< ::svn_auth_provider_object_t **>(::apr_array_push(providers)), pool);
26     ::svn_client_get_username_provider(reinterpret_cast< ::svn_auth_provider_object_t **>(::apr_array_push(providers)), pool);
27     ::svn_client_get_ssl_server_trust_file_provider(reinterpret_cast< ::svn_auth_provider_object_t **>(::apr_array_push(providers)), pool);
28     ::svn_client_get_ssl_client_cert_file_provider(reinterpret_cast< ::svn_auth_provider_object_t **>(::apr_array_push(providers)), pool);
29     ::svn_client_get_ssl_client_cert_pw_file_provider(reinterpret_cast< ::svn_auth_provider_object_t **>(::apr_array_push(providers)), pool);
30     ::svn_auth_open(&context->auth_baton, providers, pool);
31 douglas 697 }
32    
33 douglas 701 cse::String Client::GetProperty(const cse::String &property, const cse::String &target) const
34 douglas 697 {
35 douglas 704 api::Apr::Pool pool;
36 douglas 700 ::apr_hash_t *hash;
37     ::svn_opt_revision_t revision = { ::svn_opt_revision_unspecified };
38    
39     CheckError(::svn_client_propget2(&hash, property.NullTerminate(), target.NullTerminate(), &revision, &revision, false, context, pool));
40    
41     if (::apr_hash_index_t *index = ::apr_hash_first(pool, hash))
42     {
43     ::svn_string_t *string;
44    
45     ::apr_hash_this(index, NULL, NULL, reinterpret_cast<void **>(&string));
46    
47     return cse::String(string->data, string->len);
48     }
49     else
50     return cse::EmptyString;
51 douglas 697 }
52    
53 douglas 701 _L<Entry> Client::GetEntries(const cse::String &target) const
54 douglas 697 {
55 douglas 704 api::Apr::Pool pool;
56 douglas 701 ::apr_hash_t *hash;
57     ::svn_opt_revision_t revision = { ::svn_opt_revision_unspecified };
58 douglas 697
59 douglas 703 #if (SVN_VER_MAJOR == 1) && (SVN_VER_MINOR == 2)
60 douglas 701 CheckError(::svn_client_ls2(&hash, target.NullTerminate(), &revision, &revision, false, context, pool));
61 douglas 703 #else
62 douglas 701 CheckError(::svn_client_ls3(&hash, NULL, target.NullTerminate(), &revision, &revision, false, context, pool));
63 douglas 703 #endif
64 douglas 697
65 douglas 701 _L<Entry> entries;
66    
67     for (::apr_hash_index_t *index(::apr_hash_first(pool, hash)); index; index = apr_hash_next(index))
68     {
69     const char *string;
70     ::apr_ssize_t size;
71     ::svn_dirent_t *entry;
72    
73     ::apr_hash_this(index, reinterpret_cast<const void **>(&string), &size, reinterpret_cast<void **>(&entry));
74    
75     entries.InsertLast(Entry(cse::String(string, size), entry));
76     }
77    
78     return entries;
79 douglas 697 }
80    
81     }

Properties

Name Value
svn:eol-style native
svn:keywords Id