Hi Sebb,

Is this ready for testing, or should I wait?

Thanks,
Craig

> Begin forwarded message:
> 
> From: s...@apache.org
> Subject: [whimsy] branch master updated: += create_ metthod
> Date: July 7, 2020 at 4:07:34 AM PDT
> To: "comm...@whimsical.apache.org" <comm...@whimsical.apache.org>
> Reply-To: dev@whimsical.apache.org
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> sebb 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 4d3e6fc  += create_ metthod
> 4d3e6fc is described below
> 
> commit 4d3e6fc5da801224cda3421041a86750984dc711
> Author: Sebb <s...@apache.org>
> AuthorDate: Tue Jul 7 12:07:23 2020 +0100
> 
>    += create_ metthod
> ---
> lib/whimsy/asf/svn.rb | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
> index 6c78056..0dfdb60 100644
> --- a/lib/whimsy/asf/svn.rb
> +++ b/lib/whimsy/asf/svn.rb
> @@ -717,7 +717,36 @@ module ASF
>         FileUtils.rm_rf tmpdir unless temp
>       end
>     end
> -      
> +
> +    # DRAFT DRAFT
> +    # create a new file and fail if it already exists
> +    # Parameters:
> +    #  directory - parent directory as an SVN URL
> +    #  filename - name of file to create
> +    #  source - file to upload
> +    #  msg - commit message
> +    #  env - user/pass
> +    #  _ - wunderbar context
> +    # Returns:
> +    # 0 on success
> +    # 1 if the file exists
> +    # RuntimeError on unexpected error
> +    def self.create_(directory, filename, source, msg, env, _)
> +      parentrev, err = self.getInfoItem(directory, 'revision', env.user, 
> env.password)
> +      unless parentrev
> +        throw RuntimeError.new("Failed to get revision for #{directory}: 
> #{err}")
> +      end
> +      target = File.join(directory, filename)
> +      out, err = self.svn('list', target, {env: env})
> +      return 1 if out # already exists
> +      # Need to check for unexpected errors; the error message does not 
> include the full repo URL
> +      unless err =~ %r{^svn: warning: W160013: Path '.+#{filename}' not 
> found}
> +        throw RuntimeError.new("#{filename} already exists! #{err}")
> +      end
> +      commands = [['put', source, target]]
> +      self.svnmucc_(commands, msg, env, _, parentrev)
> +    end
> +
>     # DRAFT DRAFT DRAFT
>     # checkout file and update it using svnmucc put
>     # the block can return additional info, which is used 
> 

Craig L Russell
c...@apache.org

Reply via email to