|
|
Subject: cvs: pecl /svn config.m4 php_svn.h svn.c svn.php - msg#00154
List: php.pecl.cvs
wez Tue Apr 26 17:55:41 2005 EDT
Modified files:
/pecl/svn config.m4 php_svn.h svn.c svn.php
Log:
implement svn_repos_recover
http://cvs.php.net/diff.php/pecl/svn/config.m4?r1=1.3&r2=1.4&ty=u
Index: pecl/svn/config.m4
diff -u pecl/svn/config.m4:1.3 pecl/svn/config.m4:1.4
--- pecl/svn/config.m4:1.3 Tue Apr 26 14:47:32 2005
+++ pecl/svn/config.m4 Tue Apr 26 17:55:40 2005
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.3 2005/04/26 18:47:32 wez Exp $
+dnl $Id: config.m4,v 1.4 2005/04/26 21:55:40 wez Exp $
dnl config.m4 for extension svn
dnl vim:se ts=2 sw=2 et:
@@ -40,7 +40,7 @@
],[
$PHP_SVN_LDFLAGS
])
-
+
PHP_EVAL_LIBLINE($PHP_SVN_LDFLAGS, SVN_SHARED_LIBADD)
PHP_SUBST(SVN_SHARED_LIBADD)
http://cvs.php.net/diff.php/pecl/svn/php_svn.h?r1=1.5&r2=1.6&ty=u
Index: pecl/svn/php_svn.h
diff -u pecl/svn/php_svn.h:1.5 pecl/svn/php_svn.h:1.6
--- pecl/svn/php_svn.h:1.5 Tue Apr 26 17:42:16 2005
+++ pecl/svn/php_svn.h Tue Apr 26 17:55:40 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_svn.h,v 1.5 2005/04/26 21:42:16 wez Exp $ */
+/* $Id: php_svn.h,v 1.6 2005/04/26 21:55:40 wez Exp $ */
#ifndef PHP_SVN_H
#define PHP_SVN_H
@@ -53,9 +53,9 @@
PHP_FUNCTION(svn_cleanup);
PHP_FUNCTION(svn_repos_create);
+PHP_FUNCTION(svn_repos_recover);
/* TODO: */
-PHP_FUNCTION(svn_repos_recover);
PHP_FUNCTION(svn_repos_hotcopy);
PHP_FUNCTION(svn_status);
http://cvs.php.net/diff.php/pecl/svn/svn.c?r1=1.6&r2=1.7&ty=u
Index: pecl/svn/svn.c
diff -u pecl/svn/svn.c:1.6 pecl/svn/svn.c:1.7
--- pecl/svn/svn.c:1.6 Tue Apr 26 17:42:16 2005
+++ pecl/svn/svn.c Tue Apr 26 17:55:40 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: svn.c,v 1.6 2005/04/26 21:42:16 wez Exp $ */
+/* $Id: svn.c,v 1.7 2005/04/26 21:55:40 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -58,6 +58,7 @@
PHP_FE(svn_diff, NULL)
PHP_FE(svn_cleanup, NULL)
PHP_FE(svn_repos_create, NULL)
+ PHP_FE(svn_repos_recover, NULL)
{NULL, NULL, NULL} /* Must be the last line in svn_functions[] */
};
/* }}} */
@@ -907,6 +908,39 @@
}
/* }}} */
+/* {{{ proto bool svn_repos_recover(string path)
+ Run recovery procedures on the repository located at path. */
+PHP_FUNCTION(svn_repos_recover)
+{
+ char *path;
+ int pathlen;
+ apr_pool_t *subpool;
+ svn_error_t *err;
+
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
+ &path, &pathlen)) {
+ return;
+ }
+
+ init_svn_client(TSRMLS_C);
+ subpool = svn_pool_create(SVN_G(pool));
+ if (!subpool) {
+ RETURN_FALSE;
+ }
+
+ err = svn_repos_recover2(path, 0, NULL, NULL, subpool);
+
+ if (err) {
+ php_svn_handle_error(err TSRMLS_CC);
+ RETVAL_FALSE;
+ } else {
+ RETVAL_TRUE;
+ }
+
+ svn_pool_destroy(subpool);
+}
+/* }}} */
+
static void php_svn_get_version(char *buf, int buflen)
{
http://cvs.php.net/diff.php/pecl/svn/svn.php?r1=1.2&r2=1.3&ty=u
Index: pecl/svn/svn.php
diff -u pecl/svn/svn.php:1.2 pecl/svn/svn.php:1.3
--- pecl/svn/svn.php:1.2 Tue Apr 26 17:42:16 2005
+++ pecl/svn/svn.php Tue Apr 26 17:55:40 2005
@@ -4,7 +4,9 @@
}
$x = svn_repos_create('/tmp/wez-svn-foo', null, array(SVN_FS_CONFIG_FS_TYPE =>
SVN_FS_TYPE_FSFS));
-debug_zval_dump($x);
+if ($x) {
+ svn_repos_recover('/tmp/wez-svn-foo');
+}
exit;
//svn_checkout(" http://www.akbkhome.com/svn/ext_svn","/tmp/ext_svn");
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
cvs: pecl /svn php_svn.h svn.c svn.php
wez Tue Apr 26 17:42:16 2005 EDT
Modified files:
/pecl/svn php_svn.h svn.c svn.php
Log:
implement svn_cleanup() and svn_repos_create().
http://cvs.php.net/diff.php/pecl/svn/php_svn.h?r1=1.4&r2=1.5&ty=u
Index: pecl/svn/php_svn.h
diff -u pecl/svn/php_svn.h:1.4 pecl/svn/php_svn.h:1.5
--- pecl/svn/php_svn.h:1.4 Tue Apr 26 16:04:00 2005
+++ pecl/svn/php_svn.h Tue Apr 26 17:42:16 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_svn.h,v 1.4 2005/04/26 20:04:00 wez Exp $ */
+/* $Id: php_svn.h,v 1.5 2005/04/26 21:42:16 wez Exp $ */
#ifndef PHP_SVN_H
#define PHP_SVN_H
@@ -50,6 +50,36 @@
PHP_FUNCTION(svn_auth_get_parameter);
PHP_FUNCTION(svn_client_version);
PHP_FUNCTION(svn_diff);
+PHP_FUNCTION(svn_cleanup);
+
+PHP_FUNCTION(svn_repos_create);
+
+/* TODO: */
+PHP_FUNCTION(svn_repos_recover);
+PHP_FUNCTION(svn_repos_hotcopy);
+
+PHP_FUNCTION(svn_status);
+PHP_FUNCTION(svn_blame);
+PHP_FUNCTION(svn_merge);
+PHP_FUNCTION(svn_update);
+PHP_FUNCTION(svn_commit);
+PHP_FUNCTION(svn_revert);
+PHP_FUNCTION(svn_resolved);
+PHP_FUNCTION(svn_copy);
+PHP_FUNCTION(svn_move);
+PHP_FUNCTION(svn_propset);
+PHP_FUNCTION(svn_propget);
+PHP_FUNCTION(svn_proplist);
+PHP_FUNCTION(svn_export);
+PHP_FUNCTION(svn_url_from_path);
+PHP_FUNCTION(svn_uuid_from_url);
+PHP_FUNCTION(svn_uuid_from_path);
+PHP_FUNCTION(svn_switch);
+PHP_FUNCTION(svn_add);
+PHP_FUNCTION(svn_mkdir);
+PHP_FUNCTION(svn_delete);
+PHP_FUNCTION(svn_import);
+
ZEND_BEGIN_MODULE_GLOBALS(svn)
apr_pool_t *pool;
http://cvs.php.net/diff.php/pecl/svn/svn.c?r1=1.5&r2=1.6&ty=u
Index: pecl/svn/svn.c
diff -u pecl/svn/svn.c:1.5 pecl/svn/svn.c:1.6
--- pecl/svn/svn.c:1.5 Tue Apr 26 16:04:01 2005
+++ pecl/svn/svn.c Tue Apr 26 17:42:16 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: svn.c,v 1.5 2005/04/26 20:04:01 wez Exp $ */
+/* $Id: svn.c,v 1.6 2005/04/26 21:42:16 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -33,6 +33,8 @@
#include "svn_config.h"
#include "svn_auth.h"
#include "svn_path.h"
+#include "svn_fs.h"
+#include "svn_repos.h"
/* If you declare any globals in php_svn.h uncomment this: */
ZEND_DECLARE_MODULE_GLOBALS(svn)
@@ -54,6 +56,8 @@
PHP_FE(svn_auth_get_parameter, NULL)
PHP_FE(svn_client_version, NULL)
PHP_FE(svn_diff, NULL)
+ PHP_FE(svn_cleanup, NULL)
+ PHP_FE(svn_repos_create, NULL)
{NULL, NULL, NULL} /* Must be the last line in svn_functions[] */
};
/* }}} */
@@ -254,6 +258,9 @@
STRING_CONST(SVN_AUTH_PARAM_SERVER_GROUP);
STRING_CONST(SVN_AUTH_PARAM_CONFIG_DIR);
STRING_CONST(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS);
+ STRING_CONST(SVN_FS_CONFIG_FS_TYPE);
+ STRING_CONST(SVN_FS_TYPE_BDB);
+ STRING_CONST(SVN_FS_TYPE_FSFS);
/*
REGISTER_INI_ENTRIES();
@@ -796,6 +803,111 @@
}
/* }}} */
+/* {{{ proto bool svn_cleanup(string workingdir)
+ Recursively cleanup a working copy directory, finishing any incomplete
operations, removing lockfiles, etc. */
+PHP_FUNCTION(svn_cleanup)
+{
+ char *workingdir;
+ int len;
+ svn_error_t *err;
+ apr_pool_t *subpool;
+
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&workingdir, &len)) {
+ RETURN_FALSE;
+ }
+
+ init_svn_client(TSRMLS_C);
+ subpool = svn_pool_create(SVN_G(pool));
+ if (!subpool) {
+ RETURN_FALSE;
+ }
+
+ err = svn_client_cleanup(workingdir, SVN_G(ctx), subpool);
+
+ if (err) {
+ php_svn_handle_error(err TSRMLS_CC);
+ RETVAL_FALSE;
+ } else {
+ RETVAL_TRUE;
+ }
+
+ svn_pool_destroy(subpool);
+}
+/* }}} */
+
+static int replicate_hash(void *pDest, int num_args, va_list args,
zend_hash_key *key)
+{
+ zval **val = (zval **)pDest;
+ apr_hash_t *hash = va_arg(args, apr_hash_t*);
+
+ if (key->nKeyLength && Z_TYPE_PP(val) == IS_STRING) {
+ /* apr doesn't want the NUL terminator in its keys */
+ apr_hash_set(hash, key->arKey, key->nKeyLength-1,
Z_STRVAL_PP(val));
+ }
+
+ va_end(args);
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+
+static apr_hash_t *replicate_zend_hash_to_apr_hash(zval *arr, apr_pool_t *pool
TSRMLS_DC)
+{
+ apr_hash_t *hash;
+
+ if (!arr) return NULL;
+
+ hash = apr_hash_make(pool);
+
+ zend_hash_apply_with_arguments(Z_ARRVAL_P(arr), replicate_hash, 1,
hash);
+
+ return hash;
+}
+
+/* {{{ proto bool svn_repos_create(string path [, array config [, array
fsconfig]])
+ Create a new subversion repository at path */
+PHP_FUNCTION(svn_repos_create)
+{
+ char *path;
+ int pathlen;
+ zval *config = NULL;
+ zval *fsconfig = NULL;
+ apr_hash_t *config_hash = NULL;
+ apr_hash_t *fsconfig_hash = NULL;
+ apr_pool_t *subpool;
+ svn_error_t *err;
+ svn_repos_t *repos = NULL;
+
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"s|a!a!",
+ &path, &pathlen, &config, &fsconfig)) {
+ return;
+ }
+
+ init_svn_client(TSRMLS_C);
+ subpool = svn_pool_create(SVN_G(pool));
+ if (!subpool) {
+ RETURN_FALSE;
+ }
+
+ config_hash = replicate_zend_hash_to_apr_hash(config, subpool
TSRMLS_CC);
+ fsconfig_hash = replicate_zend_hash_to_apr_hash(fsconfig, subpool
TSRMLS_CC);
+
+ err = svn_repos_create(&repos, path, NULL, NULL, config_hash,
fsconfig_hash, subpool);
+
+ if (err) {
+ php_svn_handle_error(err TSRMLS_CC);
+ }
+
+ if (repos) {
+ RETVAL_TRUE;
+ } else {
+ RETVAL_FALSE;
+ }
+
+ svn_pool_destroy(subpool);
+}
+/* }}} */
+
+
static void php_svn_get_version(char *buf, int buflen)
{
const svn_version_t *vers;
http://cvs.php.net/diff.php/pecl/svn/svn.php?r1=1.1&r2=1.2&ty=u
Index: pecl/svn/svn.php
diff -u pecl/svn/svn.php:1.1 pecl/svn/svn.php:1.2
--- pecl/svn/svn.php:1.1 Mon Apr 25 23:05:08 2005
+++ pecl/svn/svn.php Tue Apr 26 17:42:16 2005
@@ -2,6 +2,11 @@
if(!extension_loaded('svn')) {
dl('svn.' . PHP_SHLIB_SUFFIX);
}
+
+$x = svn_repos_create('/tmp/wez-svn-foo', null, array(SVN_FS_CONFIG_FS_TYPE =>
SVN_FS_TYPE_FSFS));
+debug_zval_dump($x);
+exit;
+
//svn_checkout("http://www.akbkhome.com/svn/ext_svn","/tmp/ext_svn");
//print_r(svn_cat("http://www.akbkhome.com/svn/ext_svn/svn.c"));
//print_r(svn_ls("http://www.akbkhome.com/svn/ext_svn/"));
Next Message by Date:
click to view message preview
Re: cvs: pecl /svn config.m4
Unfortunatly debian doesnt bundle svn-config, I'm not quite sure which
version it got added as well, It's probaly worth falling back to look
for svn_client.h etc. if it cant be found.
Regards
Alan
On Tue, 2005-04-26 at 18:47 +0000, Wez Furlong wrote:
> wez Tue Apr 26 14:47:33 2005 EDT
>
> Modified files:
> /pecl/svn config.m4
> Log:
> use svn-config to locate headers and libs
>
> http://cvs.php.net/diff.php/pecl/svn/config.m4?r1=1.2&r2=1.3&ty=u
> Index: pecl/svn/config.m4
> diff -u pecl/svn/config.m4:1.2 pecl/svn/config.m4:1.3
> --- pecl/svn/config.m4:1.2 Mon Apr 25 23:39:38 2005
> +++ pecl/svn/config.m4 Tue Apr 26 14:47:32 2005
> @@ -1,52 +1,48 @@
> -dnl $Id: config.m4,v 1.2 2005/04/26 03:39:38 wez Exp $
> +dnl $Id: config.m4,v 1.3 2005/04/26 18:47:32 wez Exp $
> dnl config.m4 for extension svn
> dnl vim:se ts=2 sw=2 et:
>
> PHP_ARG_WITH(svn, for svn support,
>
> -[ --with-svn Include svn support])
> +[ --with-svn=[/path/to/svn-config] Include svn support])
>
>
> if test "$PHP_SVN" != "no"; then
> - # --with-svn -> check with-path
> - SEARCH_PATH="/usr/local /usr" # you might want to change this
> - SEARCH_FOR="/include/subversion-1/svn_client.h" # you most likely want to
> change this
> - if test -r $PHP_SVN/$SEARCH_FOR; then # path given as parameter
> - SVN_DIR=$PHP_SVN
> - else # search default path list
> - AC_MSG_CHECKING([for svn files in default path])
> - for i in $SEARCH_PATH ; do
> - if test -r $i/$SEARCH_FOR; then
> - SVN_DIR=$i
> - AC_MSG_RESULT(found in $i)
> + AC_MSG_CHECKING([for svn-config])
> + if ! test -x $PHP_SVN ; then
> + for i in $PHP_SVN /usr/local/bin /usr/bin ; do
> + if test -x $i/svn-config ; then
> + PHP_SVN=$i/svn-config
> + break;
> fi
> done
> fi
> -
> - if test -z "$SVN_DIR"; then
> + if test -x $PHP_SVN ; then
> + AC_MSG_RESULT($PHP_SVN)
> + else
> AC_MSG_RESULT([not found])
> - AC_MSG_ERROR([Please reinstall the svn distribution])
> + AC_MSG_ERROR([
> +Did not find svn-config; please ensure that you have installed
> +the svn developer package or equivalent for you system.
> +])
> fi
>
> - # --with-svn -> add include path
> - PHP_ADD_INCLUDE($SVN_DIR/include/subversion-1)
> - PHP_ADD_INCLUDE($SVN_DIR/include/apr-0)
> -
> - # --with-svn -> check for lib and symbol presence
> - LIBNAME=svn_client-1
> - LIBSYMBOL=svn_client_create_context
> + PHP_SVN_INCLUDES=`$PHP_SVN --includes`
> + PHP_SVN_CFLAGS=`$PHP_SVN --cppflags --cflags`
> + PHP_SVN_LDFLAGS=`$PHP_SVN --ldflags --libs`
>
> - PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
> + PHP_CHECK_LIBRARY(svn_client-1,svn_client_create_context,
> [
> - PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SVN_DIR/lib, SVN_SHARED_LIBADD)
> + PHP_ADD_LIBRARY(svn_client-1, 1, SVN_SHARED_LIBADD)
> AC_DEFINE(HAVE_SVNLIB,1,[ ])
> ],[
> AC_MSG_ERROR([wrong svn lib version or lib not found])
> ],[
> - -L$SVN_DIR/lib -lm -ldl -lsvn_client-1 -lapr-0
> + $PHP_SVN_LDFLAGS
> ])
> -
> +
> + PHP_EVAL_LIBLINE($PHP_SVN_LDFLAGS, SVN_SHARED_LIBADD)
> PHP_SUBST(SVN_SHARED_LIBADD)
>
> - PHP_NEW_EXTENSION(svn, svn.c, $ext_shared)
> + PHP_NEW_EXTENSION(svn, svn.c, $ext_shared,,$PHP_SVN_INCLUDES
> $PHP_SVN_CFLAGS)
> fi
>
Previous Message by Thread:
click to view message preview
cvs: pecl /svn php_svn.h svn.c svn.php
wez Tue Apr 26 17:42:16 2005 EDT
Modified files:
/pecl/svn php_svn.h svn.c svn.php
Log:
implement svn_cleanup() and svn_repos_create().
http://cvs.php.net/diff.php/pecl/svn/php_svn.h?r1=1.4&r2=1.5&ty=u
Index: pecl/svn/php_svn.h
diff -u pecl/svn/php_svn.h:1.4 pecl/svn/php_svn.h:1.5
--- pecl/svn/php_svn.h:1.4 Tue Apr 26 16:04:00 2005
+++ pecl/svn/php_svn.h Tue Apr 26 17:42:16 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_svn.h,v 1.4 2005/04/26 20:04:00 wez Exp $ */
+/* $Id: php_svn.h,v 1.5 2005/04/26 21:42:16 wez Exp $ */
#ifndef PHP_SVN_H
#define PHP_SVN_H
@@ -50,6 +50,36 @@
PHP_FUNCTION(svn_auth_get_parameter);
PHP_FUNCTION(svn_client_version);
PHP_FUNCTION(svn_diff);
+PHP_FUNCTION(svn_cleanup);
+
+PHP_FUNCTION(svn_repos_create);
+
+/* TODO: */
+PHP_FUNCTION(svn_repos_recover);
+PHP_FUNCTION(svn_repos_hotcopy);
+
+PHP_FUNCTION(svn_status);
+PHP_FUNCTION(svn_blame);
+PHP_FUNCTION(svn_merge);
+PHP_FUNCTION(svn_update);
+PHP_FUNCTION(svn_commit);
+PHP_FUNCTION(svn_revert);
+PHP_FUNCTION(svn_resolved);
+PHP_FUNCTION(svn_copy);
+PHP_FUNCTION(svn_move);
+PHP_FUNCTION(svn_propset);
+PHP_FUNCTION(svn_propget);
+PHP_FUNCTION(svn_proplist);
+PHP_FUNCTION(svn_export);
+PHP_FUNCTION(svn_url_from_path);
+PHP_FUNCTION(svn_uuid_from_url);
+PHP_FUNCTION(svn_uuid_from_path);
+PHP_FUNCTION(svn_switch);
+PHP_FUNCTION(svn_add);
+PHP_FUNCTION(svn_mkdir);
+PHP_FUNCTION(svn_delete);
+PHP_FUNCTION(svn_import);
+
ZEND_BEGIN_MODULE_GLOBALS(svn)
apr_pool_t *pool;
http://cvs.php.net/diff.php/pecl/svn/svn.c?r1=1.5&r2=1.6&ty=u
Index: pecl/svn/svn.c
diff -u pecl/svn/svn.c:1.5 pecl/svn/svn.c:1.6
--- pecl/svn/svn.c:1.5 Tue Apr 26 16:04:01 2005
+++ pecl/svn/svn.c Tue Apr 26 17:42:16 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: svn.c,v 1.5 2005/04/26 20:04:01 wez Exp $ */
+/* $Id: svn.c,v 1.6 2005/04/26 21:42:16 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -33,6 +33,8 @@
#include "svn_config.h"
#include "svn_auth.h"
#include "svn_path.h"
+#include "svn_fs.h"
+#include "svn_repos.h"
/* If you declare any globals in php_svn.h uncomment this: */
ZEND_DECLARE_MODULE_GLOBALS(svn)
@@ -54,6 +56,8 @@
PHP_FE(svn_auth_get_parameter, NULL)
PHP_FE(svn_client_version, NULL)
PHP_FE(svn_diff, NULL)
+ PHP_FE(svn_cleanup, NULL)
+ PHP_FE(svn_repos_create, NULL)
{NULL, NULL, NULL} /* Must be the last line in svn_functions[] */
};
/* }}} */
@@ -254,6 +258,9 @@
STRING_CONST(SVN_AUTH_PARAM_SERVER_GROUP);
STRING_CONST(SVN_AUTH_PARAM_CONFIG_DIR);
STRING_CONST(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS);
+ STRING_CONST(SVN_FS_CONFIG_FS_TYPE);
+ STRING_CONST(SVN_FS_TYPE_BDB);
+ STRING_CONST(SVN_FS_TYPE_FSFS);
/*
REGISTER_INI_ENTRIES();
@@ -796,6 +803,111 @@
}
/* }}} */
+/* {{{ proto bool svn_cleanup(string workingdir)
+ Recursively cleanup a working copy directory, finishing any incomplete
operations, removing lockfiles, etc. */
+PHP_FUNCTION(svn_cleanup)
+{
+ char *workingdir;
+ int len;
+ svn_error_t *err;
+ apr_pool_t *subpool;
+
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&workingdir, &len)) {
+ RETURN_FALSE;
+ }
+
+ init_svn_client(TSRMLS_C);
+ subpool = svn_pool_create(SVN_G(pool));
+ if (!subpool) {
+ RETURN_FALSE;
+ }
+
+ err = svn_client_cleanup(workingdir, SVN_G(ctx), subpool);
+
+ if (err) {
+ php_svn_handle_error(err TSRMLS_CC);
+ RETVAL_FALSE;
+ } else {
+ RETVAL_TRUE;
+ }
+
+ svn_pool_destroy(subpool);
+}
+/* }}} */
+
+static int replicate_hash(void *pDest, int num_args, va_list args,
zend_hash_key *key)
+{
+ zval **val = (zval **)pDest;
+ apr_hash_t *hash = va_arg(args, apr_hash_t*);
+
+ if (key->nKeyLength && Z_TYPE_PP(val) == IS_STRING) {
+ /* apr doesn't want the NUL terminator in its keys */
+ apr_hash_set(hash, key->arKey, key->nKeyLength-1,
Z_STRVAL_PP(val));
+ }
+
+ va_end(args);
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+
+static apr_hash_t *replicate_zend_hash_to_apr_hash(zval *arr, apr_pool_t *pool
TSRMLS_DC)
+{
+ apr_hash_t *hash;
+
+ if (!arr) return NULL;
+
+ hash = apr_hash_make(pool);
+
+ zend_hash_apply_with_arguments(Z_ARRVAL_P(arr), replicate_hash, 1,
hash);
+
+ return hash;
+}
+
+/* {{{ proto bool svn_repos_create(string path [, array config [, array
fsconfig]])
+ Create a new subversion repository at path */
+PHP_FUNCTION(svn_repos_create)
+{
+ char *path;
+ int pathlen;
+ zval *config = NULL;
+ zval *fsconfig = NULL;
+ apr_hash_t *config_hash = NULL;
+ apr_hash_t *fsconfig_hash = NULL;
+ apr_pool_t *subpool;
+ svn_error_t *err;
+ svn_repos_t *repos = NULL;
+
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"s|a!a!",
+ &path, &pathlen, &config, &fsconfig)) {
+ return;
+ }
+
+ init_svn_client(TSRMLS_C);
+ subpool = svn_pool_create(SVN_G(pool));
+ if (!subpool) {
+ RETURN_FALSE;
+ }
+
+ config_hash = replicate_zend_hash_to_apr_hash(config, subpool
TSRMLS_CC);
+ fsconfig_hash = replicate_zend_hash_to_apr_hash(fsconfig, subpool
TSRMLS_CC);
+
+ err = svn_repos_create(&repos, path, NULL, NULL, config_hash,
fsconfig_hash, subpool);
+
+ if (err) {
+ php_svn_handle_error(err TSRMLS_CC);
+ }
+
+ if (repos) {
+ RETVAL_TRUE;
+ } else {
+ RETVAL_FALSE;
+ }
+
+ svn_pool_destroy(subpool);
+}
+/* }}} */
+
+
static void php_svn_get_version(char *buf, int buflen)
{
const svn_version_t *vers;
http://cvs.php.net/diff.php/pecl/svn/svn.php?r1=1.1&r2=1.2&ty=u
Index: pecl/svn/svn.php
diff -u pecl/svn/svn.php:1.1 pecl/svn/svn.php:1.2
--- pecl/svn/svn.php:1.1 Mon Apr 25 23:05:08 2005
+++ pecl/svn/svn.php Tue Apr 26 17:42:16 2005
@@ -2,6 +2,11 @@
if(!extension_loaded('svn')) {
dl('svn.' . PHP_SHLIB_SUFFIX);
}
+
+$x = svn_repos_create('/tmp/wez-svn-foo', null, array(SVN_FS_CONFIG_FS_TYPE =>
SVN_FS_TYPE_FSFS));
+debug_zval_dump($x);
+exit;
+
//svn_checkout("http://www.akbkhome.com/svn/ext_svn","/tmp/ext_svn");
//print_r(svn_cat("http://www.akbkhome.com/svn/ext_svn/svn.c"));
//print_r(svn_ls("http://www.akbkhome.com/svn/ext_svn/"));
Next Message by Thread:
click to view message preview
cvs: pecl /svn svn.c svn.php
wez Tue Apr 26 23:30:22 2005 EDT
Modified files:
/pecl/svn svn.c svn.php
Log:
implement svn_update
http://cvs.php.net/diff.php/pecl/svn/svn.c?r1=1.9&r2=1.10&ty=u
Index: pecl/svn/svn.c
diff -u pecl/svn/svn.c:1.9 pecl/svn/svn.c:1.10
--- pecl/svn/svn.c:1.9 Tue Apr 26 22:47:52 2005
+++ pecl/svn/svn.c Tue Apr 26 23:30:22 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: svn.c,v 1.9 2005/04/27 02:47:52 wez Exp $ */
+/* $Id: svn.c,v 1.10 2005/04/27 03:30:22 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -60,7 +60,7 @@
PHP_FE(svn_commit, NULL)
PHP_FE(svn_add, NULL)
PHP_FE(svn_status, NULL)
-/* PHP_FE(svn_update, NULL) */
+ PHP_FE(svn_update, NULL)
PHP_FE(svn_repos_create, NULL)
PHP_FE(svn_repos_recover, NULL)
PHP_FE(svn_repos_hotcopy, NULL)
@@ -167,8 +167,6 @@
return SVN_NO_ERROR;
}
-
-
static void init_svn_client(TSRMLS_D)
{
svn_error_t *err;
@@ -1219,6 +1217,50 @@
}
/* }}} */
+/* {{{ proto array svn_update(string path [, int revno [, bool recurse]])
+ Update working copy at path to revno */
+PHP_FUNCTION(svn_update)
+{
+ char *path;
+ int pathlen;
+ zend_bool recurse = 1;
+ apr_pool_t *subpool;
+ svn_error_t *err;
+ svn_revnum_t result_rev;
+ svn_opt_revision_t rev;
+ long revno = -1;
+
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lb",
+ &path, &pathlen, &revno, &recurse)) {
+ return;
+ }
+
+ init_svn_client(TSRMLS_C);
+ subpool = svn_pool_create(SVN_G(pool));
+ if (!subpool) {
+ RETURN_FALSE;
+ }
+
+ if (revno > 0) {
+ rev.kind = svn_opt_revision_number;
+ rev.value.number = revno;
+ } else {
+ rev.kind = svn_opt_revision_head;
+ }
+ err = svn_client_update(&result_rev, path, &rev, recurse,
+ SVN_G(ctx), subpool);
+
+ if (err) {
+ php_svn_handle_error(err TSRMLS_CC);
+ RETVAL_FALSE;
+ } else {
+ RETVAL_LONG(result_rev);
+ }
+
+ svn_pool_destroy(subpool);
+}
+/* }}} */
+
static void php_svn_get_version(char *buf, int buflen)
{
http://cvs.php.net/diff.php/pecl/svn/svn.php?r1=1.4&r2=1.5&ty=u
Index: pecl/svn/svn.php
diff -u pecl/svn/svn.php:1.4 pecl/svn/svn.php:1.5
--- pecl/svn/svn.php:1.4 Tue Apr 26 22:31:26 2005
+++ pecl/svn/svn.php Tue Apr 26 23:30:22 2005
@@ -22,6 +22,7 @@
print_r(svn_commit("testing the commit thingy\nyeeha\n",
array('/tmp/wez-svn-wd/foobar.txt')));
print_r(svn_status('/tmp/wez-svn-wd'));
print_r(svn_log("file:///tmp/wez-svn-foo"));
+ debug_zval_dump(svn_update('/tmp/wez-svn-wd'));
}
svn_repos_recover('/tmp/wez-svn-foo');
}
|
|