Class: KCommercial::KCPipeline::BranchTool
- Inherits:
-
Object
- Object
- KCommercial::KCPipeline::BranchTool
- Defined in:
- lib/KCommercialPipeline/core/version_pipeline/release_branches.rb
Class Method Summary collapse
- .all_release_branchs_sorted ⇒ Object
- .bigger_release_branchs(source_branch) ⇒ Object
- .last_commit_on_current_branch ⇒ Object
- .sort_all_release_branchs(branchs) ⇒ Object
Class Method Details
.all_release_branchs_sorted ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/KCommercialPipeline/core/version_pipeline/release_branches.rb', line 10 def all_release_branchs_sorted reg = /#{KimConfig.configs["common_regulars"]["release_branch_regular"]}/ reg = Regexp.new('(origin/)?release/RB_\d(\.\d+)+$') unless reg all_b = KCGit::git.lib.branches_all.find_all { |b| b[0] =~ reg } all_releases= all_b.map do |b| if b.is_a?Array ReleaseBranch.new(b[0]) elsif b.is_a?String ReleaseBranch.new(b) end end sort_all_release_branchs all_releases end |
.bigger_release_branchs(source_branch) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/KCommercialPipeline/core/version_pipeline/release_branches.rb', line 32 def bigger_release_branchs(source_branch) source_rb = ReleaseBranch.new(source_branch) unless !source_rb.is_release bigger_rb = all_release_branchs_sorted.find_all {|v| v.code > source_rb.code}.map { |v| v.name.sub("remotes/","").sub("origin/","") } bigger_rb.each do |b| KCommercial::UI.info("高于当前分支的有:#{b}\n") end bigger_rb else KCommercial::UI.info "非release分支,不需要自动cherry-pick" raise "非release分支,不需要自动cherry-pick" exit! -1 end end |
.last_commit_on_current_branch ⇒ Object
28 29 30 31 |
# File 'lib/KCommercialPipeline/core/version_pipeline/release_branches.rb', line 28 def last_commit_on_current_branch git = KCGit.git commit = git.branches[git.current_branch].gcommit end |
.sort_all_release_branchs(branchs) ⇒ Object
24 25 26 |
# File 'lib/KCommercialPipeline/core/version_pipeline/release_branches.rb', line 24 def sort_all_release_branchs(branchs) rs = branchs.sort_by { |v1| v1.code} end |