From 8b290448e3233e03b01288c179eb49bee63d1302 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 7 Sep 2019 11:56:23 +0900 Subject: Assign to vcs in new_vcs block not to use rescue result --- tool/file2lastrev.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tool') diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 2721d4ab86..db66be6f70 100755 --- a/tool/file2lastrev.rb +++ b/tool/file2lastrev.rb @@ -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 } -- cgit v1.2.3