Class: Piston::Commands::Update
- Defined in:
- lib/piston/commands/update.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#run(wcdir, to) ⇒ Object
wcdir
is the working copy we’re going to change.
Methods inherited from Base
#force, #guess_wc, #initialize, logger, #logger, #quiet, #verbose, #working_copy!
Constructor Details
This class inherits a constructor from Piston::Commands::Base
Instance Method Details
#run(wcdir, to) ⇒ Object
wcdir
is the working copy we’re going to change. to
is the new target revision we want to be at after update returns.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/piston/commands/update.rb', line 8 def run(wcdir, to) working_copy = working_copy!(wcdir) logger.debug {"Recalling previously saved values"} values = working_copy.recall repository_class = values["repository_class"] repository_url = values["repository_url"] repository = repository_class.constantize.new(repository_url) from_revision = repository.at(values["handler"]) to_revision = repository.at(to) logger.debug {"Validating that #{from_revision} exists and is capable of performing the update"} from_revision.validate! logger.info {"Updating from #{from_revision} to #{to_revision}"} working_copy.apply_differences(from_revision.differences_with(to_revision)) end |