Sha256: eaf0a2b06386bd2bc2c26ae29c7063bc407e4c3a0ca4082458cd2b7228999671

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 Bytes

Contents

command :push do |c|
  c.workflow :hg
  c.desc "Pushes the latest revisions to the remote repository."
  c.opt :remote, "The remote repository's URL", :short => "-R"
  c.opt :revs, "The revisions to push", :short => "-r", :type => :string
  c.opt :force, "Ignore remote heads", :short => "-f"
  
  c.on_run do |opts, args|
    repo                 = opts[:repository]
    dest                 = opts[:remote] || repo.config["paths","default-push"] || repo.config["paths","default"]
    opts[:revs]        ||= nil
    remote               = Amp::Support.parse_hg_url(dest, opts[:revs])
    dest, revs, checkout = remote[:url], remote[:revs], remote[:head]
    remote_repo          = Amp::Repositories.pick(repo.config, dest, false)
    revs                 = revs.map {|rev| repo.lookup rev } if revs
    
    result = repo.push remote_repo, :force => opts[:force], :revs => revs
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp-0.5.3 lib/amp/commands/commands/workflows/hg/push.rb