You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2018/04/30 19:03:11 UTC

[whimsy] branch master updated: enable finding svn repositories by name listed in repository.yml

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 15cec46  enable finding svn repositories by name listed in repository.yml
15cec46 is described below

commit 15cec4670d9f9f8e1a78be752504cbb735ac0192
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon Apr 30 15:02:23 2018 -0400

    enable finding svn repositories by name listed in repository.yml
    
    based on a suggestion by sebb
---
 lib/whimsy/asf/svn.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index c74370d..05a112a 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -75,16 +75,22 @@ module ASF
       result = repos[(@mock+name.sub('private/','')).to_s.sub(/\/*$/, '')] ||
         repos[(@base+name).to_s.sub(/\/*$/, '')] # lose trailing slash
 
-      return result if result
+      # if name is a simple identifier, try to match name in repository.yml
+      if not result and name =~ /^\w+$/
+        entry = YAML.load_file(REPOSITORY)[:svn][name]
+        result = find((@base+entry['url']).to_s) if entry
+      end
 
       # recursively try parent directory
-      if name.include? '/'
+      if not result and name.include? '/'
         base = File.basename(name).untaint
         result = find(File.dirname(name))
         if result and File.exist?(File.join(result, base))
           File.join(result, base)
         end
       end
+
+      result
     end
 
     # find a local directory corresponding to a path in Subversion.  Throws

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.

Re: [whimsy] branch master updated: enable finding svn repositories by name listed in repository.yml

Posted by sebb <se...@gmail.com>.
On 30 April 2018 at 20:03,  <ru...@apache.org> wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> rubys pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/whimsy.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
>      new 15cec46  enable finding svn repositories by name listed in repository.yml
> 15cec46 is described below
>
> commit 15cec4670d9f9f8e1a78be752504cbb735ac0192
> Author: Sam Ruby <ru...@intertwingly.net>
> AuthorDate: Mon Apr 30 15:02:23 2018 -0400
>
>     enable finding svn repositories by name listed in repository.yml
>
>     based on a suggestion by sebb
> ---
>  lib/whimsy/asf/svn.rb | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
> index c74370d..05a112a 100644
> --- a/lib/whimsy/asf/svn.rb
> +++ b/lib/whimsy/asf/svn.rb
> @@ -75,16 +75,22 @@ module ASF
>        result = repos[(@mock+name.sub('private/','')).to_s.sub(/\/*$/, '')] ||
>          repos[(@base+name).to_s.sub(/\/*$/, '')] # lose trailing slash
>
> -      return result if result
> +      # if name is a simple identifier, try to match name in repository.yml
> +      if not result and name =~ /^\w+$/
> +        entry = YAML.load_file(REPOSITORY)[:svn][name]

Does the YAML load need to be cached?

> +        result = find((@base+entry['url']).to_s) if entry
> +      end
>
>        # recursively try parent directory
> -      if name.include? '/'
> +      if not result and name.include? '/'
>          base = File.basename(name).untaint
>          result = find(File.dirname(name))
>          if result and File.exist?(File.join(result, base))
>            File.join(result, base)
>          end
>        end
> +
> +      result
>      end
>
>      # find a local directory corresponding to a path in Subversion.  Throws
>
> --
> To stop receiving notification emails like this one, please contact
> rubys@apache.org.