Sha256: ec5e0d3410913a4746b35c99eae6e7bbaf2f1cdc3ae97b8cc05c178883581708
Contents?: true
Size: 954 Bytes
Versions: 4
Compression:
Stored size: 954 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
4 entries across 4 versions & 2 rubygems