Class: RIM::Command::Status
- Inherits:
-
RIM::Command
- Object
- RIM::Command
- RIM::Command::Status
- Defined in:
- lib/rim/command/status.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ Status
constructor
A new instance of Status.
- #invoke ⇒ Object
Constructor Details
#initialize(opts) ⇒ Status
Returns a new instance of Status.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rim/command/status.rb', line 8 def initialize(opts) opts. = "Usage: rim status [<options>] [<to-rev>|<from-rev>..<to-rev>]" opts.description = "Prints commits and their RIM status" opts.separator "" opts.separator "Without revision arguments checks the current branch and all local ancestors." opts.separator "With a single <to-rev> checks that revision and all local ancestors." opts.separator "Otherwise checks <to-rev> and ancestors without <from-rev> and ancestors." opts.separator "With the --gerrit option, assumes all yet unknown commits to be 'local'." opts.separator "" opts.on("-d", "--detailed", "print detailed status") do @detailed = true end opts.on("-w", "--working-copy", "print working copy status") do @wc_status = true end opts.on("-f", "--fast", "fast status assuming remote is clean") do @fast = true end opts.on("--verify-clean", "exit with error code 1 if commits are dirty") do @verify_clean = true end opts.on("--gerrit", "special gerrit mode which stops on all known commits") do @gerrit_mode = true end end |
Instance Method Details
#invoke ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rim/command/status.rb', line 34 def invoke() root = project_git_dir rev_arg = ARGV.shift stat = nil RIM.git_session(root) do |gs| sb = RIM::StatusBuilder.new if @wc_status stat = sb.fs_status(root) print_status(gs, stat) end if rev_arg if rev_arg =~ /\.\./ from_rev, to_rev = rev_arg.split("..") else from_rev, to_rev = nil, rev_arg end stat = sb.rev_history_status(gs, to_rev, :stop_rev => from_rev, :fast => @fast, :gerrit => @gerrit_mode) print_status(gs, stat) else branch = gs.current_branch_name stat = sb.rev_history_status(gs, branch, :fast => @fast) print_status(gs, stat) end end if @verify_clean && any_dirty?(stat) exit(1) end end |