Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CCF67984B for ; Tue, 7 Feb 2012 19:04:28 +0000 (UTC) Received: (qmail 80423 invoked by uid 500); 7 Feb 2012 19:04:28 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 80389 invoked by uid 500); 7 Feb 2012 19:04:28 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 80382 invoked by uid 99); 7 Feb 2012 19:04:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2012 19:04:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2012 19:04:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BE4F4238889B for ; Tue, 7 Feb 2012 19:04:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1241553 - in /subversion/trunk: subversion/bindings/swig/include/ subversion/bindings/swig/ruby/libsvn_swig_ruby/ subversion/bindings/swig/ruby/svn/ tools/examples/ Date: Tue, 07 Feb 2012 19:04:02 -0000 To: commits@subversion.apache.org From: stsp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120207190402.BE4F4238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stsp Date: Tue Feb 7 19:04:02 2012 New Revision: 1241553 URL: http://svn.apache.org/viewvc?rev=1241553&view=rev Log: Fix the ruby bindings for svn_auth_get_platform_specific_client_providers. The bindings were present, but due to a missing argout typemap for apr_array_header_t **providers, they threw a not implemented error. This was fixed for perl in r1035745 and for python in r1241530, but was still broken for ruby. [in subversion/bindings/swig] * include/svn_containers.swg (apr_array_header_t **providers): New SWIGRUBY typemap. * ruby/libsvn_swig_ruby/swigutil_rb.c, ruby/libsvn_swig_ruby/swigutil_rb.h (svn_swig_rb_apr_array_to_array_auth_provider_object): Add function. * ruby/svn/core.rb (add_platform_specific_client_providers, add_providers): Add functions. [in tools/examples] * info.rb Add a new example that shows how to do remote access instead of working on an existing working copy (like the existing examples do). This example also shows how to call svn_auth_get_platform_specific_client_providers. Patch by: Matthijs Kooijman Added: subversion/trunk/tools/examples/info.rb (with props) Modified: subversion/trunk/subversion/bindings/swig/include/svn_containers.swg subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb Modified: subversion/trunk/subversion/bindings/swig/include/svn_containers.swg URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_containers.swg?rev=1241553&r1=1241552&r2=1241553&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/swig/include/svn_containers.swg (original) +++ subversion/trunk/subversion/bindings/swig/include/svn_containers.swg Tue Feb 7 19:04:02 2012 @@ -884,3 +884,9 @@ } } #endif + +#ifdef SWIGRUBY +%typemap(argout) apr_array_header_t **providers { + %append_output(svn_swig_rb_apr_array_to_array_auth_provider_object(*$1)); +} +#endif Modified: subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c?rev=1241553&r1=1241552&r2=1241553&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c (original) +++ subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c Tue Feb 7 19:04:02 2012 @@ -1313,6 +1313,9 @@ DEFINE_APR_ARRAY_TO_ARRAY(VALUE, svn_swi DEFINE_APR_ARRAY_TO_ARRAY(VALUE, svn_swig_rb_apr_array_to_array_merge_range, c2r_merge_range_dup, EMPTY_CPP_ARGUMENT, svn_merge_range_t *, NULL) +DEFINE_APR_ARRAY_TO_ARRAY(VALUE, svn_swig_rb_apr_array_to_array_auth_provider_object, + c2r_swig_type, EMPTY_CPP_ARGUMENT, + svn_auth_provider_object_t *, "svn_auth_provider_object_t*") static VALUE c2r_merge_range_array(void *value, void *ctx) Modified: subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h?rev=1241553&r1=1241552&r2=1241553&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h (original) +++ subversion/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h Tue Feb 7 19:04:02 2012 @@ -154,6 +154,8 @@ SVN_RB_SWIG_SWIGUTIL_EXPORT VALUE svn_swig_rb_apr_array_to_array_external_item2(const apr_array_header_t *ary); SVN_RB_SWIG_SWIGUTIL_EXPORT VALUE svn_swig_rb_apr_array_to_array_merge_range(const apr_array_header_t *ary); +SVN_RB_SWIG_SWIGUTIL_EXPORT +VALUE svn_swig_rb_apr_array_to_array_auth_provider_object(const apr_array_header_t *ary); SVN_RB_SWIG_SWIGUTIL_EXPORT VALUE svn_swig_rb_prop_apr_array_to_hash_prop(const apr_array_header_t *ary); Modified: subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb?rev=1241553&r1=1241552&r2=1241553&view=diff ============================================================================== --- subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb (original) +++ subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb Tue Feb 7 19:04:02 2012 @@ -279,6 +279,10 @@ module Svn add_prompt_provider("ssl_client_cert_pw", args, prompt, klass) end + def add_platform_specific_client_providers(config=nil) + add_providers(Core.auth_get_platform_specific_client_providers(config)) + end + private def add_prompt_provider(name, args, prompt, credential_class) real_prompt = Proc.new do |*prompt_args| @@ -294,6 +298,10 @@ module Svn end def add_provider(provider) + add_providers([provider]) + end + + def add_providers(new_providers) if auth_baton providers = auth_baton.providers parameters = auth_baton.parameters @@ -301,7 +309,7 @@ module Svn providers = [] parameters = {} end - self.auth_baton = AuthBaton.new(providers + [provider], parameters) + self.auth_baton = AuthBaton.new(providers + new_providers, parameters) end end Added: subversion/trunk/tools/examples/info.rb URL: http://svn.apache.org/viewvc/subversion/trunk/tools/examples/info.rb?rev=1241553&view=auto ============================================================================== --- subversion/trunk/tools/examples/info.rb (added) +++ subversion/trunk/tools/examples/info.rb Tue Feb 7 19:04:02 2012 @@ -0,0 +1,78 @@ +#!/usr/bin/env ruby +# +# info.rb : output some info about a subversion url +# +# Example based on a blogpost by Mark Deepwell +# http://www.markdeepwell.com/2010/06/ruby-subversion-bindings/ +# +###################################################################### +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +###################################################################### +# + +require "svn/core" +require "svn/client" +require "svn/wc" +require "svn/repos" + +# Prompt function mimicking svn's own prompt +simple_prompt = Proc.new do + |result, realm, username, default, may_save, pool| + + puts "Authentication realm: #{realm}" + if username != nil + result.username = username + else + print "Username: " + result.username = STDIN.gets.strip + end + print "Password for '#{result.username}': " + result.password = STDIN.gets.strip +end + + +if ARGV.length != 1 + puts "Usage: info.rb URL[@REV]" +else + ctx = Svn::Client::Context.new() + ctx.add_platform_specific_client_providers + ctx.add_simple_provider + ctx.add_simple_prompt_provider(2, simple_prompt) + ctx.add_username_provider + ctx.add_ssl_server_trust_file_provider + ctx.add_ssl_client_cert_file_provider + ctx.add_ssl_client_cert_pw_file_provider + + repos_uri, revision = ARGV[0].split("@", 2) + if revision + revision = Integer(revision) + end + + begin + ctx.info(repos_uri, revision) do |path, info| + puts("Url: #{info.url}") + puts("Last changed rev: #{info.last_changed_rev}") + puts("Last changed author: #{info.last_changed_author}") + puts("Last changed date: #{info.last_changed_date}") + puts("Kind: #{info.kind}") + end + rescue Svn::Error => e + # catch a generic svn error + raise "Failed to retrieve SVN info at revision " + revision.to_s + end +end Propchange: subversion/trunk/tools/examples/info.rb ------------------------------------------------------------------------------ svn:eol-style = native