php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60293 svn_import need log message
Submitted: 2011-11-14 11:55 UTC Modified: 2021-09-17 10:37 UTC
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: alan_k (profile)
Status: Closed Package: svn (PECL)
PHP Version: Irrelevant OS: Unix
Private report: No CVE-ID: None
 [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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-16 10:16 UTC] cmb@php.net
If this is still unresolved, consider to submit a pull request[1]
for better visibility.

[1] <https://github.com/php/pecl-tools-svn/pulls>
 [2021-09-17 08:18 UTC] alan_k@php.net
I've done a pull request for this - my @php access is revoked as It's not practical to use 2FA on my personal account.

Can we find someone just to merge the two outstanding pull requests?
 [2021-09-17 10:34 UTC] git@php.net
Automatic comment on behalf of roojs (author) and web-flow (committer)
Revision: https://github.com/php/pecl-tools-svn/commit/46c0732c806107ae6a0dc109b7034979a645b832
Log: Fix #60293: svn_import need log message
 [2021-09-17 10:34 UTC] git@php.net
-Status: Open +Status: Closed
 [2021-09-17 10:36 UTC] cmb@php.net
-Assigned To: +Assigned To: alan_k
 [2021-09-17 10:36 UTC] cmb@php.net
> Can we find someone just to merge the two outstanding pull
> requests?

Done.  You can ping me on Github (@cmb69) if there are other
pull requests to merge.
 [2021-09-17 10:37 UTC] cmb@php.net
-Summary: svn_import need log meesage +Summary: svn_import need log message
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC