diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-31 02:52:41 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-31 10:55:37 +0900 |
commit | d180e405703b36c3f3a84334779c56bf9a3ea6a8 (patch) | |
tree | d8406264dcd17cf9b303d4ba8ea4268a306e283b | |
parent | 1e9057b54a53e7bc1fa3d0e3eaef1dd33707d044 (diff) | |
download | ruby-d180e405703b36c3f3a84334779c56bf9a3ea6a8.tar.gz |
Add --limit option and default it to 20
-rwxr-xr-x | tool/file2lastrev.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 1e2a6fc440..8a72bd3786 100755 --- a/tool/file2lastrev.rb +++ b/tool/file2lastrev.rb @@ -19,6 +19,7 @@ def self.output=(output) @output = output end @suppress_not_found = false +@limit = 20 format = '%Y-%m-%dT%H:%M:%S%z' srcdir = nil @@ -39,6 +40,9 @@ parser = OptionParser.new {|opts| self.output = :modified format = fmt if fmt end + opts.on("--limit=NUM", "limit branch name length (#@limit)", Integer) do |n| + @limit = n + end opts.on("-q", "--suppress_not_found") do @suppress_not_found = true end @@ -60,7 +64,7 @@ vcs = nil ("#define RUBY_FULL_REVISION #{last.inspect}" unless short == last), if branch e = '..' - limit = 16 + limit = @limit name = branch.sub(/\A(.{#{limit-e.size}}).{#{e.size+1},}/o) {$1+e} "#define RUBY_BRANCH_NAME #{name.dump}" end, |