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/09 22:46:01 UTC
[whimsy] branch master updated: Add [paths] support to svn_
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 8e8ecb9 Add [paths] support to svn_
8e8ecb9 is described below
commit 8e8ecb9ed2a305946a524f85972ce4a3d53ea694
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jun 9 23:45:51 2020 +0100
Add [paths] support to svn_
---
lib/spec/lib/svn_wunderbar_spec.rb | 2 +-
lib/whimsy/asf/svn.rb | 24 ++++++++++++++++--------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/lib/spec/lib/svn_wunderbar_spec.rb b/lib/spec/lib/svn_wunderbar_spec.rb
index 276bfba..0f0de19 100644
--- a/lib/spec/lib/svn_wunderbar_spec.rb
+++ b/lib/spec/lib/svn_wunderbar_spec.rb
@@ -26,7 +26,7 @@ describe "ASF::SVN.svn_" do
expect(rc).to be(0)
expect(out['transcript'].class).to equal(Array)
- exp = ["svn", "info", "https://svn.apache.org/repos/asf/attic/site/xdocs/projects/_template.xml", "--non-interactive"]
+ exp = ["svn", "info", "--non-interactive", "--", "https://svn.apache.org/repos/asf/attic/site/xdocs/projects/_template.xml"]
expect(out['transcript'][1]).to eq(exp.inspect)
end
end
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 52e3b65..d7cda25 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -340,7 +340,7 @@ module ASF
# low level SVN command for use in Wunderbar context (_json, _text etc)
# params:
# command - info, list etc
- # path - the path to be used
+ # path - the path(s) to be used - String or Array of Strings
# _ - wunderbar context
# options - hash of:
# :args - string or array of strings, e.g. '-v', ['--depth','empty']
@@ -362,7 +362,7 @@ module ASF
end
# build svn command
- cmd = ['svn', command, path, '--non-interactive']
+ cmd = ['svn', command, '--non-interactive']
args = options[:args]
if args
@@ -375,11 +375,6 @@ module ASF
end
end
- if options[:dryrun] # before creds added
- # TODO: improve this
- return _.system ['echo', cmd.inspect]
- end
-
# add credentials if required
open_opts = {}
env = options[:env]
@@ -391,7 +386,7 @@ module ASF
user = options[:user] if password
end
# password was supplied, add credentials
- if password
+ if password and not options[:verbose]
creds = ['--no-auth-cache', '--username', user]
if self.passwordStdinOK?() && false # not sure how to support this
open_opts[:stdin_data] = password
@@ -402,8 +397,21 @@ module ASF
cmd << creds
end
+ cmd << '--' # ensure paths cannot be mistaken for options
+
+ if path.is_a? Array
+ cmd += path
+ else
+ cmd << path
+ end
+
p cmd if options[:verbose] # includes auth
+ if options[:dryrun] # before creds added
+ # TODO: improve this
+ return _.system ['echo', cmd.inspect]
+ end
+
_.system cmd
end