Esempio n. 1
0
  void
  Client::import(const Path & path,
                 const char * url,
                 const char * message,
                 bool recurse) throw(ClientException)
  {
    Pool pool;
    svn_client_commit_info_t *commit_info = NULL;

    m_context->setLogMessage(message);

    svn_error_t * error =
      svn_client_import(&commit_info,
                        path.c_str(),
                        url,
                        !recurse,
                        *m_context,
                        pool);

    if (error != NULL)
      throw ClientException(error);
  }
Esempio n. 2
0
Py::Object pysvn_client::cmd_import( const Py::Tuple &a_args, const Py::Dict &a_kws )
{
    static argument_description args_desc[] =
    {
    { true,  name_path },
    { true,  name_url },
    { true,  name_log_message },
    { false, name_recurse },
#if defined( PYSVN_HAS_CLIENT_IMPORT2 )
    { false, name_ignore },
#endif
#if defined( PYSVN_HAS_CLIENT_IMPORT3 )
    { false, name_depth },
    { false, name_ignore_unknown_node_types },
    { false, name_revprops },
#endif
    { false, NULL }
    };
    FunctionArguments args( "import_", args_desc, a_args, a_kws );
    args.check();

    std::string path( args.getUtf8String( name_path ) );
    std::string url( args.getUtf8String( name_url ) );
    std::string message( args.getUtf8String( name_log_message ) );

    SvnPool pool( m_context );

#if defined( PYSVN_HAS_CLIENT_IMPORT3 )
    svn_depth_t depth = args.getDepth( name_depth, name_recurse, svn_depth_infinity, svn_depth_infinity, svn_depth_files );
    bool ignore_unknown_node_types = args.getBoolean( name_ignore_unknown_node_types, false );

    apr_hash_t *revprops = NULL;
    if( args.hasArg( name_revprops ) )
    {
        Py::Object py_revprop = args.getArg( name_revprops );
        if( !py_revprop.isNone() )
        {
            revprops = hashOfStringsFromDistOfStrings( py_revprop, pool );
        }
    }
#else
    bool recurse = args.getBoolean( name_recurse, true );
#endif
#if defined( PYSVN_HAS_CLIENT_IMPORT2 )
    bool ignore = args.getBoolean( name_ignore, false );
#endif

    pysvn_commit_info_t *commit_info = NULL;

    try
    {
        std::string norm_path( svnNormalisedIfPath( path, pool ) );

        checkThreadPermission();

        PythonAllowThreads permission( m_context );

        m_context.setLogMessage( message.c_str() );

#if defined( PYSVN_HAS_CLIENT_IMPORT3 )
        svn_error_t *error = svn_client_import3
            (
            &commit_info,       // changed type
            norm_path.c_str(),
            url.c_str(),
            depth,
            !ignore,
            ignore_unknown_node_types,
            revprops,
            m_context,
            pool
            );
#elif defined( PYSVN_HAS_CLIENT_IMPORT2 )
        svn_error_t *error = svn_client_import2
            (
            &commit_info,       // changed type
            norm_path.c_str(),
            url.c_str(),
            !recurse,           // non_recursive
            !ignore,
            m_context,
            pool
            );
#else
        svn_error_t *error = svn_client_import
            (
            &commit_info,
            norm_path.c_str(),
            url.c_str(),
            !recurse,           // non_recursive
            m_context,
            pool
            );
#endif
        permission.allowThisThread();
        if( error != NULL )
            throw SvnException( error );
    }
    catch( SvnException &e )
    {
        // use callback error over ClientException
        m_context.checkForError( m_module.client_error );

        throw_client_error( e );
    }

    return toObject( commit_info, m_commit_info_style );
}