You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/06/07 20:39:26 UTC

[whimsy] branch master updated: use svn_ where possible

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 ebabeba  use svn_ where possible
ebabeba is described below

commit ebabebaa7d11bd0c89dd059a3ae3fe1bfc0020da
Author: Sebb <se...@apache.org>
AuthorDate: Sun Jun 7 21:39:03 2020 +0100

    use svn_ where possible
---
 lib/whimsy/asf/svn.rb | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 06afab4..3650ff2 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -559,7 +559,7 @@ module ASF
     #   commands - array of commands
     #   msg - commit message
     #   env - environment (username/password)
-    #   _ - Wunderbar
+    #   _ - Wunderbar context
     #   revision - if defined, supply the --revision svnmucc parameter
     #   temp - use this temporary directory (and don't remove it)
     # The commands must themselves be arrays to ensure correct processing of white-space
@@ -568,8 +568,8 @@ module ASF
     #     url1 = 'https://svn.../' # etc
     #     commands << ['mv',url1,url2]
     #     commands << ['rm',url3]
-    #   ASF::SVN.svnmucc(commands,message,env,_)
-    def self.svnmucc(commands, msg, env, _, revision=nil, temp=nil)
+    #   ASF::SVN.svnmucc_(commands,message,env,_)
+    def self.svnmucc_(commands, msg, env, _, revision=nil, temp=nil)
       require 'tempfile'
       tmpdir = temp ? temp : Dir.mktmpdir.untaint
 
@@ -650,20 +650,12 @@ module ASF
       begin
 
         # create an empty checkout
-        _.system ['svn', 'checkout', '--depth', 'empty',
-          '--non-interactive',
-          ['--username', env.user, '--password', env.password],
-          '--no-auth-cache',
-          parenturl, tmpdir
-          ]
+        rc = self.svn_('checkout', parenturl, _, {args: ['--depth', 'empty', tmpdir], env: env})
+        raise "svn failure #{rc} checkout #{parenturl}" unless rc == 0
 
         # checkout the file
-        _.system ['svn', 'update',
-          '--non-interactive',
-          ['--username', env.user, '--password', env.password],
-          '--no-auth-cache',
-          outputfile
-          ]
+        rc = self.svn_('update', outputfile, _, {env: env})
+        raise "svn failure #{rc} update #{outputfile}" unless rc == 0
 
         # N.B. the revision is required for the svnmucc put to prevent overriding a previous update
         # this is why the file is checked out rather than just extracted
@@ -688,7 +680,8 @@ module ASF
         if options[:dryrun]
           puts cmds # TODO: not sure this is correct for Wunderbar
         else
-          ASF::SVN.svnmucc(cmds,msg,env,_,filerev,tmpdir)
+          rc = ASF::SVN.svnmucc_(cmds,msg,env,_,filerev,tmpdir)
+          raise "svnmucc failure #{rc} committing" unless rc == 0
         end
       ensure
         FileUtils.rm_rf tmpdir