php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60293 svn_import need log meesage
Submitted: 2011-11-14 11:55 UTC Modified: -
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: slungo at 9online dot fr Assigned:
Status: Open Package: svn (PECL)
PHP Version: Irrelevant OS: Unix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: slungo at 9online dot fr
New email:
PHP Version: OS:

 

 [2011-11-14 11:55 UTC] slungo at 9online dot fr
Description:
------------
The svn_import do nothing when I use it. I saw a bugfix on svn_make that needed 
also a log message to work, so I try to use the same fix on svn_import, 
recompiling the source and it worked.
I also had to correct the type of the variable nonrecursive from svn_boolean_t 
to zend_bool to make the recursion work.

This is my corrected source code:

/* {{{ proto bool svn_import(string path, string url, bool nonrecursive [, 
string message ])
	Imports unversioned path into repository at url */
PHP_FUNCTION(svn_import)
{
	svn_client_commit_info_t *commit_info_p = NULL;
	const char *path = NULL, *logmsg = NULL;
	const char *utf8_path = NULL;
	int pathlen, logmsg_len;
	char *url;
	int urllen;
	zend_bool nonrecursive;
	svn_error_t *err;
	apr_pool_t *subpool;

	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssb|s",
				&path, &pathlen, &url, &urllen, &nonrecursive, 
&logmsg, &logmsg_len)) {
		RETURN_FALSE;
	}

	PHP_SVN_INIT_CLIENT();

	subpool = svn_pool_create(SVN_G(pool));
	if (!subpool) {
		RETURN_FALSE;
	}

	svn_utf_cstring_to_utf8 (&utf8_path, path, subpool);
	path = svn_path_canonicalize(utf8_path, subpool);

	SVN_G(ctx)->log_msg_baton = logmsg;

	err = svn_client_import(&commit_info_p, path, url, nonrecursive,
			SVN_G(ctx), subpool);

	SVN_G(ctx)->log_msg_baton = NULL;

	if (err) {
		php_svn_handle_error (err TSRMLS_CC);
		RETVAL_FALSE;
	} else {
		RETVAL_TRUE;
	}

	svn_pool_destroy(subpool);

}

Test script:
---------------
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME,             $login);
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD,             $passwd);
svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, true);
svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE,              true);
svn_auth_set_parameter(SVN_AUTH_PARAM_NO_AUTH_CACHE,                true);

try
{
    if (false === svn_ls($repo_dest))
    {
        // Import recursively a folder containing files & sub-folders
	if (false === svn_import($path_src, $repo_dest, false))
	    throw new Exception("Can't import...");
    }
}
catch (Exception $e)
{

}

Expected result:
----------------
I expect to have the source directory recursively imported to the SVN.

Actual result:
--------------
Nothing is done.

With my first fix (i.e. adding new parameter for log message) only the first 
level of the source directory content is imported (the recursivity does not 
work).

With my second fix (i.e. changing the type of the variable "nonrecursive") the 
source directory is completly imported (the recursivity now works).

Patches

pach-svn_import (last revision 2011-11-14 11:56 UTC) by slungo at 9online dot fr)

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC