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/05 10:59:59 UTC

[whimsy] branch master updated (694e96b -> 505e7d4)

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

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


    from 694e96b  Add emeritus rescinded and reinstated
     new 8e1a8ae  Rename: flags: => args:
     new 505e7d4  Check for valid options

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lib/whimsy/asf/svn.rb | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)


[whimsy] 01/02: Rename: flags: => args:

Posted by se...@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

commit 8e1a8ae7e5a480985f10577d2ba4d0c274bc8a89
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 5 11:21:57 2020 +0100

    Rename: flags: => args:
---
 lib/whimsy/asf/svn.rb | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 92db8a9..480bda6 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -243,7 +243,7 @@ module ASF
     # Note: Path, Schedule and Depth are not currently supported
     #
     def self.getInfoItem(path, item, user=nil, password=nil)
-      out, err = self.svn('info', path, {flags: ['--show-item', item],
+      out, err = self.svn('info', path, {args: ['--show-item', item],
         user: user, password: password})
       if out
         if item.end_with? 'revision' # svn version 1.9.3 appends trailing spaces to *revision items
@@ -266,7 +266,7 @@ module ASF
     # command - info, list etc
     # path - the path to be used
     # options - hash of:
-    #  :flags - string or array of strings, e.g. '-v', ['--depth','empty']
+    #  :args - string or array of strings, e.g. '-v', ['--depth','empty']
     #  :user, :password - auth
     #  :verbose - show command
     # Returns either:
@@ -279,14 +279,14 @@ module ASF
       # build svn command
       cmd = ['svn', command, path, '--non-interactive']
 
-      flags = options[:flags]
-      if flags
-        if flags.is_a? String
-          cmd << flags
-        elsif flags.is_a? Array
-          cmd += flags
+      args = options[:args]
+      if args
+        if args.is_a? String
+          cmd << args
+        elsif args.is_a? Array
+          cmd += args
         else
-          return nil, "flags '#{flags.inspect}' must be string or array"
+          return nil, "args '#{args.inspect}' must be string or array"
         end
       end
 
@@ -373,7 +373,7 @@ module ASF
         pass = env.password.dup.untaint
         # checkout committers/board (this does not have many files currently)
         out, err = self.svn('checkout', ciURL,
-          {flags: [tmpdir.untaint, '--quiet', '--depth', 'files'],
+          {args: [tmpdir.untaint, '--quiet', '--depth', 'files'],
            user: user, password: pass})
 
         raise Exception.new("Checkout of board folder failed: #{err}") unless out
@@ -389,7 +389,7 @@ module ASF
 
         # commit the updated file
         out, err = self.svn('commit', file,
-          {flags: [tmpdir.untaint,'--quiet', '--message', msg],
+          {args: [tmpdir.untaint,'--quiet', '--message', msg],
            user: user, password: pass})
 
         raise Exception.new("Update of committee-info.txt failed: #{err}") unless out


[whimsy] 02/02: Check for valid options

Posted by se...@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

commit 505e7d465ec189dce056af5dcc26cf2cc4ec9805
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 5 11:59:42 2020 +0100

    Check for valid options
---
 lib/whimsy/asf/svn.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 480bda6..5d3ec31 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -261,6 +261,7 @@ module ASF
       return self.svn('list', path, {user: user, password: password})
     end
 
+    VALID_KEYS=[:args, :user, :password, :verbose]
     # low level SVN command
     # params:
     # command - info, list etc
@@ -275,6 +276,11 @@ module ASF
     def self.svn(command, path , options = {})
       return nil, 'command must not be nil' unless command
       return nil, 'path must not be nil' unless path
+      
+      bad_keys = options.keys - VALID_KEYS
+      if bad_keys.size > 0
+        return nil, "Following options not recognised: #{bad_keys.inspect}"
+      end
 
       # build svn command
       cmd = ['svn', command, path, '--non-interactive']