Sha256: a623cffd8fa580113dfb73058f95d45d37291f90637cfbcbeb8d6150bca3cfe0

Contents?: true

Size: 809 Bytes

Versions: 5

Compression:

Stored size: 809 Bytes

Contents

command :update do |c|
  c.workflow :hg
  
  c.desc "Updates the current repository to the specified (or tip-most) revision"
  c.opt :rev, "The revision # to use for updating.", { :short => "-r", :type => :string }
  c.opt :node, "The node ID to use for updating.", { :short => "-n", :type => :string }
  c.opt :clean, "Remove uncommitted changes from the working directory.", { :short => "-C" }
  
  c.on_run do |opts, args|
    repo = opts[:repository]
    
    if opts[:rev] && opts[:node]
      raise ArgumentError.new("Please only specify either --rev or --node.")
    end
    
    rev = opts[:rev] ? opts[:rev] : opts[:node]
    
    # TODO: add --date option
    if opts[:clean]
      stats = repo.clean(rev)
    else
      stats = repo.update(rev)
    end
    
    c.print_update_stats stats
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
amp-0.5.3 lib/amp/commands/commands/workflows/hg/update.rb
amp-0.5.2 lib/amp/commands/commands/workflows/hg/update.rb
amp-0.5.1 lib/amp/commands/commands/workflows/hg/update.rb
amp-pure-0.5.0 lib/amp/commands/commands/workflows/hg/update.rb
amp-0.5.0 lib/amp/commands/commands/workflows/hg/update.rb