Class: Basketcase::UpdateCommand
Instance Attribute Summary
Attributes inherited from Command
#comment, #listener, #targets
Instance Method Summary
collapse
Methods inherited from Command
#accept_args, #effective_targets, #initialize, #option_comment, #option_graphical, #option_recurse, #report, #specified_targets
Methods included from Utils
#mkpath
Instance Method Details
#execute ⇒ Object
472
473
474
475
|
# File 'lib/basketcase.rb', line 472
def execute
execute_update
execute_merge unless @nomerge
end
|
#execute_merge ⇒ Object
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
|
# File 'lib/basketcase.rb', line 455
def execute_merge
args = '-log nul -flatest '
if just_testing?
args += "-print"
elsif @graphical
args += "-gmerge"
else
args += "-merge -gmerge"
end
cleartool("findmerge #{effective_targets} #{args}") do |line|
case line
when /^Needs Merge "(.+)" \[to \S+ from (\S+) base (\S+)\]/
report(:MERGE, mkpath($1), $2)
end
end
end
|
#execute_update ⇒ Object
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
|
# File 'lib/basketcase.rb', line 426
def execute_update
args = '-log nul -force'
args += ' -print' if just_testing?
cleartool("update #{args} #{effective_targets}") do |line|
case line
when /^Processing dir "(.*)"/
when /^\.*$/
when /^Making dir "(.*)"/
report(:NEW, relative_path($1))
when /^Loading "(.*)"/
report(:UPDATED, relative_path($1))
when /^Unloaded "(.*)"/
report(:REMOVED, relative_path($1))
when /^Keeping hijacked object "(.*)" - base "(.*)"/
report(:HIJACK, relative_path($1), $2)
when /^Keeping "(.*)"/
when /^End dir/
when /^Done loading/
else
cannot_deal_with line
end
end
end
|
#help ⇒ Object
408
409
410
411
412
413
414
415
|
# File 'lib/basketcase.rb', line 408
def help
<<EOF
Update your (snapshot) view.
-nomerge Don\'t attempt to merge in changes to checked-out files.
EOF
end
|
#option_nomerge ⇒ Object
417
418
419
|
# File 'lib/basketcase.rb', line 417
def option_nomerge
@nomerge = true
end
|
#relative_path(s) ⇒ Object
421
422
423
424
|
# File 'lib/basketcase.rb', line 421
def relative_path(s)
full_path = view_root + mkpath(s)
full_path.relative_path_from(Pathname.pwd)
end
|
#synopsis ⇒ Object
404
405
406
|
# File 'lib/basketcase.rb', line 404
def synopsis
"[-nomerge] [<element> ...]"
end
|