void Client::copy(const Path & srcPath, const Revision & srcRevision, const Path & destPath) throw(ClientException) { Pool pool; svn_client_commit_info_t *commit_info = NULL; svn_error_t * error = svn_client_copy(&commit_info, srcPath.c_str(), srcRevision.revision(), destPath.c_str(), *m_context, pool); if (error != NULL) throw ClientException(error); }
Py::Object pysvn_client::cmd_copy( const Py::Tuple &a_args, const Py::Dict &a_kws ) { static argument_description args_desc[] = { { true, name_src_url_or_path }, { true, name_dest_url_or_path }, { false, name_src_revision }, { false, NULL } }; FunctionArguments args( "copy", args_desc, a_args, a_kws ); args.check(); SvnPool pool( m_context ); pysvn_commit_info_t *commit_info = NULL; std::string type_error_message; try { type_error_message = "expecting string for src_path (arg 1)"; Py::String src_path( args.getUtf8String( name_src_url_or_path ) ); type_error_message = "expecting string for dest_path (arg 2)"; Py::String dest_path( args.getUtf8String( name_dest_url_or_path ) ); type_error_message = "expecting revision for keyword src_revision"; svn_opt_revision_t revision; if( is_svn_url( src_path ) ) revision = args.getRevision( name_src_revision, svn_opt_revision_head ); else revision = args.getRevision( name_src_revision, svn_opt_revision_working ); try { std::string norm_src_path( svnNormalisedIfPath( src_path, pool ) ); std::string norm_dest_path( svnNormalisedIfPath( dest_path, pool ) ); checkThreadPermission(); PythonAllowThreads permission( m_context ); #if defined( PYSVN_HAS_CLIENT_COPY3 ) // behavior changed svn_error_t *error = svn_client_copy3 ( &commit_info, norm_src_path.c_str(), &revision, norm_dest_path.c_str(), m_context, pool ); #elif defined( PYSVN_HAS_CLIENT_COPY2 ) svn_error_t *error = svn_client_copy2 ( &commit_info, // commit info type changed norm_src_path.c_str(), &revision, norm_dest_path.c_str(), m_context, pool ); #else svn_error_t *error = svn_client_copy ( &commit_info, norm_src_path.c_str(), &revision, norm_dest_path.c_str(), 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 ); } } catch( Py::TypeError & ) { throw Py::TypeError( type_error_message ); } return toObject( commit_info ); }