Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r7 - trunk

php-svn-client
Discussion topic

Back to topic list

svn commit: r7 - trunk

Reply

Author fedortyurin
Full name Fedor Tyurin
Date 2006-12-18 07:25:44 PST
Message Author: fedortyurin
Date: 2006-12-18 07:25:43-0800
New Revision: 7

Modified:
   trunk/php_svn_client.c
   trunk/php_svn_client.h

Log:
SVN update function was added

Modified: trunk/php_svn_client.c
Url: http://php-svn-clien​t.tigris.org/source/​browse/php-svn-clien​t/trunk/php_svn_clie​nt.c?view=diff&r​ev=7&p1=trunk/ph​p_svn_client.c&p​2=trunk/php_svn_clie​nt.c&r1=6&r2​=7
====================​====================​====================​==================
--- trunk/php_svn_client.c (original)
+++ trunk/php_svn_client.c 2006-12-18 07:25:43-0800
@@ -37,6 +37,7 @@
     PHP_FE(svn_client_cr​eate_providers, NULL)
     PHP_FE(svn_client_auth_open, NULL)
     PHP_FE(svn_client_checkout, NULL)
+ PHP_FE(svn_client_update, NULL)
     {NULL, NULL, NULL}
 };
 
@@ -161,12 +162,12 @@
     svn_boolean_t may_save,
     apr_pool_t *pool)
 {
- printf("hostname=%s\n", cert_info->hostname);
- printf("fingerprint=%s\n", cert_info->fingerprint);
- printf("valid_from=%s\n", cert_info->valid_from);
- printf("valid_until=%s\n", cert_info->valid_until);
- printf("issuer_dname=%s\n", cert_info->issuer_dname);
- printf("ascii_cert=%s\n", cert_info->ascii_cert);
+ //printf("hostname=%s\n", cert_info->hostname);
+ //printf("fingerprint=%s\n", cert_info->fingerprint);
+ //printf("valid_from=%s\n", cert_info->valid_from);
+ //printf("valid_until=%s\n", cert_info->valid_until);
+ //printf("issuer_dname=%s\n", cert_info->issuer_dname);
+ //printf("ascii_cert=%s\n", cert_info->ascii_cert);
 
     *cred = (svn_auth_cred_ssl_s​erver_trust_t*) apr_palloc(pool, sizeof(svn_auth_cred​_ssl_server_trust_t)​);
     (*cred)->may_save = 0;
@@ -453,9 +454,10 @@
 
 PHP_FUNCTION(svn_cli​ent_checkout)
 {
+ zval **z_resource_ctx = 0;
     zval **z_string_url = 0;
     zval **z_string_path = 0;
- zval **z_resource_ctx = 0;
+ zval **z_bool_recurse = 0;
 
     char *url = 0;
     svn_client_ctx_t* ctx = 0;
@@ -467,9 +469,16 @@
     svn_opt_revision_t revision;
     svn_opt_revision_t peg_revision;
 
+ int recurse = FALSE;
+
     switch (ZEND_NUM_ARGS()) {
         case 3:
- if (zend_get_parameters_ex(3, &z_string_url, &z_string_path, &z_resource_ctx)==FAILURE) {
+ if (zend_get_parameters_ex(3, &z_resource_ctx, &z_string_url, &z_string_path)==FAILURE) {
+ RETURN_FALSE;
+ }
+ break;
+ case 4:
+ if (zend_get_parameters_ex(4, &z_resource_ctx, &z_string_url, &z_string_path, &z_bool_recurse)==FAILURE) {
                 RETURN_FALSE;
             }
             break;
@@ -477,13 +486,19 @@
             WRONG_PARAM_COUNT;
             break;
     }
+
+ ZEND_FETCH_RESOURCE(ctx, svn_client_ctx_t*, z_resource_ctx, -1, "svn client context", le_svn_client_context);
+
     convert_to_string_ex​(z_string_url);
     url=Z_STRVAL_PP(z_string_url);
 
     convert_to_string_ex​(z_string_path);
     path=Z_STRVAL_PP(z_s​tring_path);
 
- ZEND_FETCH_RESOURCE(ctx, svn_client_ctx_t*, z_resource_ctx, -1, "svn client context", le_svn_client_context);
+ if (z_bool_recurse) {
+ convert_to_boolean_e​x(z_bool_recurse);
+ recurse = Z_BVAL_PP(z_bool_recurse);
+ }
 
     revision.kind = svn_opt_revision_unspecified;
 
@@ -512,7 +527,7 @@
     err = svn_client_checkout2(NULL, true_url, path,
                                    &peg_revision,
                                    &revision,
- TRUE,
+ recurse,
                                    FALSE,
                                    ctx, SVN_G(pool));
 
@@ -522,5 +537,76 @@
         RETURN_FALSE;
     }
 
- return;
+ RETURN_TRUE;
 }
+
+PHP_FUNCTION(svn_cl​ient_update)
+{
+ zval **z_resource_ctx = 0;
+ zval **z_string_path = 0;
+ zval **z_long_revision = 0;
+ zval **z_bool_recurse = 0;
+
+ char *url = 0;
+ svn_client_ctx_t* ctx = 0;
+ char *path = 0;
+
+ svn_error_t *err;
+
+ svn_revnum_t result_rev;
+
+ svn_opt_revision_t revision;
+
+ int recurse = FALSE;
+
+ switch (ZEND_NUM_ARGS()) {
+ case 2:
+ if (zend_get_parameters_ex(2, &z_resource_ctx, &z_string_path)==FAILURE) {
+ RETURN_FALSE;
+ }
+ break;
+ case 3:
+ if (zend_get_parameters_ex(3, &z_resource_ctx, &z_string_path, &z_long_revision)==FAILURE) {
+ RETURN_FALSE;
+ }
+ break;
+ case 4:
+ if (zend_get_parameters_ex(4, &z_resource_ctx, &z_string_path, &z_long_revision, &z_bool_recurse)==FAILURE) {
+ RETURN_FALSE;
+ }
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+
+ ZEND_FETCH_RESOURCE(ctx, svn_client_ctx_t*, z_resource_ctx, -1, "svn client context", le_svn_client_context);
+
+ convert_to_string_ex​(z_string_path);
+ path=Z_STRVAL_PP(z_s​tring_path);
+
+ if (z_long_revision) {
+ revision.kind = svn_opt_revision_number;
+ convert_to_long_ex(z​_long_revision);
+ revision.value.number = Z_LVAL_PP(z_long_revision);
+ }
+ else {
+ revision.kind = svn_opt_revision_head;
+ }
+
+ if (z_bool_recurse) {
+ convert_to_boolean_e​x(z_bool_recurse);
+ recurse = Z_BVAL_PP(z_bool_recurse);
+ }
+
+ err = svn_client_update(​&result_rev, path, &revision, recurse,
+ ctx, SVN_G(pool));
+
+ if (err) {
+ php_svn_client_handle_error(err TSRMLS_CC);
+ svn_error_clear(err);
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
\ No newline at end of file

Modified: trunk/php_svn_client.h
Url: http://php-svn-clien​t.tigris.org/source/​browse/php-svn-clien​t/trunk/php_svn_clie​nt.h?view=diff&r​ev=7&p1=trunk/ph​p_svn_client.h&p​2=trunk/php_svn_clie​nt.h&r1=6&r2​=7
====================​====================​====================​==================
--- trunk/php_svn_client.h (original)
+++ trunk/php_svn_client.h 2006-12-18 07:25:43-0800
@@ -25,6 +25,7 @@
 PHP_FUNCTION(svn_cli​ent_create_providers​);
 PHP_FUNCTION(svn_cli​ent_auth_open);
 PHP_FUNCTION(svn_cli​ent_checkout);
+PHP_FUNCTION(svn_cl​ient_update);
 
 ZEND_BEGIN_MODULE_GL​OBALS(svn_client)
     apr_allocator_t *allocator;

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r7 - trunk fedortyurin Fedor Tyurin 2006-12-18 07:25:44 PST
Messages per page: