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/12 16:49:27 UTC
[whimsy] branch master updated: Add support for :chdir
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 f3edb3f Add support for :chdir
f3edb3f is described below
commit f3edb3ff2b1df2bb748abdfd83b38156310ca8fd
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 12 17:49:18 2020 +0100
Add support for :chdir
---
lib/spec/lib/svn_spec.rb | 9 +++++++++
lib/whimsy/asf/svn.rb | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb
index 7f80ead..43d0a96 100644
--- a/lib/spec/lib/svn_spec.rb
+++ b/lib/spec/lib/svn_spec.rb
@@ -266,5 +266,14 @@ describe ASF::SVN do
expect(err2).to eq(nil)
end
+ it "svn() should honour :chdir option" do
+ pods = ASF::SVN['incubator-podlings']
+ if pods
+ out, err = ASF::SVN.svn('info', '.', {chdir: pods})
+ expect(err).to eq(nil)
+ expect(out).to match(/^URL: /)
+ end
+ end
+
end
end
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 811d989..3f64b7d 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -260,7 +260,9 @@ module ASF
return self.svn('list', path, {user: user, password: password})
end
+ # These keys are common to svn_ and svn
VALID_KEYS=[:args, :user, :password, :verbose, :env, :dryrun, :msg, :depth]
+
# low level SVN command
# params:
# command - info, list etc
@@ -273,6 +275,7 @@ module ASF
# :user, :password - used if env is not present
# :verbose - show command on stdout
# :dryrun - return command array as [cmd] without executing it (excludes auth)
+ # :chdir - change directory for system call
# Returns:
# - stdout
# - nil, err
@@ -281,6 +284,8 @@ module ASF
return nil, 'command must not be nil' unless command
return nil, 'path must not be nil' unless path
+ chdir = options.delete(:chdir) # not currently supported for svn_
+
bad_keys = options.keys - VALID_KEYS
if bad_keys.size > 0
return nil, "Following options not recognised: #{bad_keys.inspect}"
@@ -307,6 +312,9 @@ module ASF
cmd += ['--depth', depth] if depth
open_opts = {}
+
+ open_opts[:chdir] = chdir if chdir
+
env = options[:env]
if env
password = env.password