Sha256: bb91bb8d4ad0fcfc7ed713e278d1318a4982790fbbfbc44b622107ccb483b3a2

Contents?: true

Size: 1.41 KB

Versions: 22

Compression:

Stored size: 1.41 KB

Contents

require 'pivotal-github/command'
require 'pivotal-github/finished_command'

class StoryMerge < FinishedCommand

  def parser
    OptionParser.new do |opts|
      opts.banner = "Usage: git story-merge [branch] [options]"
      opts.on("-o", "--override", "override unfinished story warning") do |opt|
        self.options.override = opt
      end
      opts.on("-f", "--finish", "mark story as finished") do |opt|
        self.options.finish = opt
        self.options.override = opt
      end
      opts.on("-d", "--deliver", "mark story as delivered") do |opt|
        self.options.deliver = opt
        self.options.override = opt
      end
      opts.on_tail("-h", "--help", "this usage guide") do
        puts opts.to_s; exit 0
      end
    end
  end

  # Returns a command appropriate for executing at the command line
  # For example:
  #   git checkout master
  #   git merge --no-ff <story branch>
  def cmd
    lines = ["git checkout #{target_branch}"]
    c = ["git merge --no-ff --log"]
    c << %(-m "#{message}")
    c << argument_string(unknown_options) unless unknown_options.empty?
    c << story_branch
    lines << c.join(' ')
    lines.join("\n")
  end

  private

    # Returns the name of the branch to be merged into.
    # If there is anything left in the known options after parsing,
    # that's the merge branch. Otherwise, it's master.
    def target_branch
      self.known_options.first || 'master'
    end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pivotal-github-1.1.6 lib/pivotal-github/story_merge.rb
pivotal-github-1.1.5 lib/pivotal-github/story_merge.rb
pivotal-github-1.1.4 lib/pivotal-github/story_merge.rb
pivotal-github-1.1.3 lib/pivotal-github/story_merge.rb
pivotal-github-1.1.2 lib/pivotal-github/story_merge.rb
pivotal-github-1.1.1 lib/pivotal-github/story_merge.rb
pivotal-github-1.1.0 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.12 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.11 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.10 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.9 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.8 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.7 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.6 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.5 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.4 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.3 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.2 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.1 lib/pivotal-github/story_merge.rb
pivotal-github-1.0.0 lib/pivotal-github/story_merge.rb