Sha256: f7164c5636fd02a6888f02b67debc936148564a45d3e3f14d7c35d3ce4254802

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

#!/usr/bin/ruby
require 'big_stash/stash_operator'
require 'big_keeper/util/logger'
require 'big_keeper/util/pod_operator'
require 'big_keeper/util/xcode_operator'

require 'big_keeper/dependency/dep_service'

module BigKeeper
  def self.switch_to(path, version, user, full_name, type)
    begin
      # Parse Bigkeeper file
      p "1.switch_to #{version} 解析Bigkeeper"
      BigkeeperParser.parse("#{path}/Bigkeeper")

      version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
      branch_name = "#{GitflowType.name(type)}/#{full_name}"
      ModuleCacheOperator.new(path).cache_branch_name(branch_name)
      home_branch_name = "release/#{full_name}"
      GitService.new.verify_home_branch(path, home_branch_name, OperateType::SWITCH)

      stash_modules = ModuleCacheOperator.new(path).all_path_modules
      p "2.switch_to 暂存所有"
      # Stash current branch
      StashService.new.stash_all(path, branch_name, user, stash_modules,full_name)
      p "3.switch_to checkout #{home_branch_name}"
      # Switch to new feature
      GitOperator.new.checkout(path, home_branch_name)
      GitOperator.new.pull(path)
      p "4.switch_to"
      # Apply home stash
      StashService.new.pop_stash(path, home_branch_name, 'Home')

      #modules = ModuleCacheOperator.new(path).all_path_modules
      modules = ModuleCacheOperator.new(path).current_path_modules_path(path)
      modules.each do |module_name|
        ModuleService.new.switch_to(path, user, module_name, branch_name, type)
      end
      p "5.switch_to"
      # Install
      DepService.dep_operator(path, user).install(false)
      p "6.switch_to"
      # Open home workspace
      DepService.dep_operator(path, user).open
    ensure
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
shkeeper-1.0.0 lib/big_keeper/command/feature&hotfix/switch.rb
kookeeper-3.1.2 lib/big_keeper/command/feature&hotfix/switch.rb