summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-07 11:56:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-07 11:56:23 +0900
commit8b290448e3233e03b01288c179eb49bee63d1302 (patch)
treec3f4b00914ad9833e12eed35b8b221199b23a779
parent59e29389a8c3501e71444fed2c10ba6821e63625 (diff)
Assign to vcs in new_vcs block not to use rescue result
-rwxr-xr-xtool/file2lastrev.rb7
1 files changed, 4 insertions, 3 deletions
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
}