Class: Basketcase::UncheckoutCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/basketcase.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#comment, #listener, #targets

Instance Method Summary collapse

Methods inherited from Command

#accept_args, #effective_targets, #option_comment, #option_graphical, #option_recurse, #report, #specified_targets

Methods included from Utils

#mkpath

Constructor Details

#initialize(*args) ⇒ UncheckoutCommand

Returns a new instance of UncheckoutCommand.



591
592
593
594
# File 'lib/basketcase.rb', line 591

def initialize(*args)
  super(*args)
  @action = '-keep'
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



602
603
604
# File 'lib/basketcase.rb', line 602

def action
  @action
end

Instance Method Details

#executeObject



604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/basketcase.rb', line 604

def execute
  cleartool_unsafe("uncheckout #{@action} #{specified_targets}") do |line|
    case line
    when /^Loading /
      # ignore
    when /^Making dir /
      # ignore
    when /^Checkout cancelled for "(.+)"\./
      report(:UNCO, mkpath($1))
    when /^Private version .* saved in "(.+)"\./
      report(:KEPT, mkpath($1))
    else
      cannot_deal_with line
    end
  end
end

#helpObject



583
584
585
586
587
588
589
# File 'lib/basketcase.rb', line 583

def help
  <<EOF
Undo a checkout, reverting to the checked-in version.

-r(emove)   Don\'t retain the existing version in a '.keep' file.
EOF
end

#option_removeObject Also known as: option_r



596
597
598
# File 'lib/basketcase.rb', line 596

def option_remove
  @action = '-rm'
end

#synopsisObject



579
580
581
# File 'lib/basketcase.rb', line 579

def synopsis
  "[-r] <element> ..."
end