mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* tool/file2lastrev.rb: get rid of global variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd83230726
commit
99c8ded878
2 changed files with 17 additions and 13 deletions
|
@ -1,4 +1,6 @@
|
|||
Tue Jun 30 16:48:49 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Tue Jun 30 16:53:17 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* tool/file2lastrev.rb: get rid of global variables.
|
||||
|
||||
* tool/compile_prelude.rb: use US-ASCII name.
|
||||
|
||||
|
|
|
@ -48,25 +48,27 @@ def get_revisions(path)
|
|||
return last, changed
|
||||
end
|
||||
|
||||
def raise_if_conflict
|
||||
raise "you can specify only one of --changed, --revision.h and --doxygen" if $output
|
||||
@output = nil
|
||||
def self.output=(output)
|
||||
if @output and @output != output
|
||||
raise "you can specify only one of --changed, --revision.h and --doxygen"
|
||||
end
|
||||
@output = output
|
||||
end
|
||||
@suppress_not_found = false
|
||||
|
||||
parser = OptionParser.new {|opts|
|
||||
opts.on("--changed", "changed rev") do
|
||||
raise_if_conflict
|
||||
$output = :changed
|
||||
self.output = :changed
|
||||
end
|
||||
opts.on("--revision.h") do
|
||||
raise_if_conflict
|
||||
$output = :revision_h
|
||||
self.output = :revision_h
|
||||
end
|
||||
opts.on("--doxygen") do
|
||||
raise_if_conflict
|
||||
$output = :doxygen
|
||||
self.output = :doxygen
|
||||
end
|
||||
opts.on("-q", "--suppress_not_found") do
|
||||
$suppress_not_found = true
|
||||
@suppress_not_found = true
|
||||
end
|
||||
}
|
||||
parser.parse!
|
||||
|
@ -75,10 +77,10 @@ parser.parse!
|
|||
begin
|
||||
last, changed = get_revisions(ARGV.shift)
|
||||
rescue VCSNotFoundError
|
||||
raise unless $suppress_not_found
|
||||
raise unless @suppress_not_found
|
||||
end
|
||||
|
||||
case $output
|
||||
case @output
|
||||
when :changed, nil
|
||||
puts changed
|
||||
when :revision_h
|
||||
|
@ -86,5 +88,5 @@ when :revision_h
|
|||
when :doxygen
|
||||
puts "r#{changed}/r#{last}"
|
||||
else
|
||||
raise "unknown output format `#{$output}'"
|
||||
raise "unknown output format `#{@output}'"
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue