class GitProc::NewFeatureBranch

Public Class Methods

new(dir, opts) click to toggle source
Calls superclass method GitProc::Process::new
# File lib/git-process/new_fb.rb, line 19
def initialize(dir, opts)
  @branch_name = opts[:branch_name]
  @local_only = opts[:local]
  super
end

Public Instance Methods

runner() click to toggle source
# File lib/git-process/new_fb.rb, line 26
def runner
  mybranches = gitlib.branches()
  on_parking = (mybranches.parking == mybranches.current)

  base_branch = if on_parking and not mybranches[config.integration_branch].contains_all_of(mybranches.parking.name)
                  '_parking_'
                else
                  config.integration_branch
                end

  gitlib.fetch if gitlib.has_a_remote? and not @local_only

  logger.info { "Creating #{@branch_name} off of #{base_branch}" }
  new_branch = gitlib.checkout(@branch_name, :new_branch => base_branch)

  branches = gitlib.branches()
  branches[@branch_name].upstream(config.integration_branch)
  branches.parking.delete! if on_parking
  new_branch
end