// Subversion Client // // Douglas Thrift // // $Id$ #include #include "Client.hpp" namespace Subversion { namespace { ::svn_error_t *GetEntryCommittedDate_(void *date, const char *path, const ::svn_info_t *info, ::apr_pool_t *pool) { *reinterpret_cast(date) = apr_time_sec(info->last_changed_date); return SVN_NO_ERROR; } } Client::Client() { CheckError(::svn_client_create_context(&context, pool)); } cse::String Client::GetProperty(const cse::String &property, const cse::String &target) { ::apr_hash_t *hash; ::svn_opt_revision_t revision = { ::svn_opt_revision_unspecified }; CheckError(::svn_client_propget2(&hash, property.NullTerminate(), target.NullTerminate(), &revision, &revision, false, context, pool)); if (::apr_hash_index_t *index = ::apr_hash_first(pool, hash)) { ::svn_string_t *string; ::apr_hash_this(index, NULL, NULL, reinterpret_cast(&string)); return cse::String(string->data, string->len); } else return cse::EmptyString; } std::time_t Client::GetEntryCommittedDate(const cse::String &target) { std::time_t date; CheckError(::svn_client_info(target.NullTerminate(), NULL, NULL, &GetEntryCommittedDate_, &date, false, context, pool)); return date; } }