From:             
Operating system: Unix
PHP version:      Irrelevant
Package:          svn
Bug Type:         Bug
Bug description:svn_import need log meesage

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).

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60293&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60293&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60293&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60293&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60293&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60293&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60293&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60293&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60293&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60293&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60293&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60293&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60293&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60293&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60293&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60293&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60293&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60293&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60293&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60293&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60293&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60293&r=mysqlcfg

Reply via email to