Sha256: f91c3dcf48b2024a76a78d74c3bae860965746bcc3662f0d0bc4b96ee2c98df4
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
command :branch do |c| c.workflow :hg c.desc "Set/Show the current branch name" c.opt :force, "Forces the branch-name change", :short => "-f" c.opt :clean, "Resets the branch setting for this repository", :short => "-c" c.on_run do |opts, args| repo = opts[:repository] if opts[:clean] _label = repo[nil].parents[0].branch repo.dirstate.branch = _label Amp::UI.status("Reset working directory to branch #{_label}") elsif args.size > 0 _label = args.first if !opts[:force] && repo.branch_tags.include?(_label) if !repo.parents.map {|p| p.branch}.include?(_label) raise abort("a branch of the same name already exists!"+ " (use --force to override)") end end repo.dirstate.branch = _label Amp::UI.status("marked working directory as branch #{_label}") else Amp::UI.say repo.dirstate.branch end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amp-0.5.3 | lib/amp/commands/commands/workflows/hg/branch.rb |