1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Assign to vcs in new_vcs block not to use rescue result

This commit is contained in:
Nobuyoshi Nakada 2019-09-07 11:56:23 +09:00
parent 59e29389a8
commit 8b290448e3
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -28,16 +28,17 @@ OptionParser.new {|opts|
vcs_options = VCS.define_options(opts)
new_vcs = proc do |path|
begin
VCS.detect(path, vcs_options, opts.new)
vcs = VCS.detect(path, vcs_options, opts.new)
rescue VCS::NotFoundError => e
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
opts.remove
end
nil
end
opts.new
opts.on("--srcdir=PATH", "use PATH as source directory") do |path|
abort "#{File.basename(Program)}: srcdir is already set" if vcs
vcs = new_vcs[path]
new_vcs[path]
end
opts.on("--changed", "changed rev") do
self.output = :changed
@ -62,7 +63,7 @@ OptionParser.new {|opts|
if vcs
vcs.set_options(vcs_options) # options after --srcdir
else
vcs = new_vcs["."]
new_vcs["."]
end
}