gitsflow 0.7.4.alfa → 0.8.2.alfa

Sign up to get free protection for your applications and to get access to all the features.
data/lib/sflow.rb DELETED
@@ -1,655 +0,0 @@
1
-
2
- #!/usr/bin/ruby
3
- begin
4
- require 'pry'
5
- rescue LoadError
6
- # Gem loads as it should
7
- end
8
-
9
- require 'net/http'
10
-
11
- require "open3"
12
- require "date"
13
- require 'uri'
14
- load 'config.rb'
15
- load 'string.rb'
16
- load 'GitLab/gitlab.rb'
17
- load 'Git/git.rb'
18
-
19
- # require './lib/gitlab/issue.rb'
20
- # require './lib/gitlab/merge_request.rb'
21
- class SFlow
22
- Encoding.default_external = 'utf-8'
23
- Encoding.default_internal = Encoding::UTF_8
24
- VERSION = "0.7.4.alfa"
25
- $TYPE = ARGV[0]&.encode("UTF-8")
26
- $ACTION = ARGV[1]&.encode("UTF-8")
27
-
28
- $PARAM1 = ARGV[2]&.encode("UTF-8")
29
- $PARAM2 = ARGV[3..-1]&.join(' ')&.encode("UTF-8")
30
-
31
- def self.call
32
- begin
33
- print "GitSflow #{VERSION}\n".green
34
- print "Loading...\n".yellow
35
- git_branch = Git.execute { "git branch --show-current" }
36
- print "\nYou are on branch:".yellow
37
- print " #{git_branch}\n".green
38
- validates if !['config_', 'help_'].include? ("#{$TYPE}_#{$ACTION}")
39
- #
40
- send("#{$TYPE}_#{$ACTION}")
41
- rescue => e
42
- set_error e
43
-
44
- end
45
- end
46
- def self.feature_start
47
- title = $PARAM2 == "" ? $PARAM1 : $PARAM2
48
- issue = GitLab::Issue.new(title: title, labels: ['feature'])
49
- issue.create
50
- branch = "#{issue.iid}-feature/#{$PARAM1}"
51
- self.start(branch, issue)
52
- end
53
-
54
-
55
- def self.bugfix_start
56
- title = $PARAM2 == "" ? $PARAM1 : $PARAM2
57
- issue = GitLab::Issue.new(title: title, labels: ['bugfix'])
58
- issue.create
59
- branch = "#{issue.iid}-bugfix/#{$PARAM1}"
60
- self.start(branch, issue)
61
- end
62
-
63
- def self.hotfix_start
64
- title = $PARAM2 == "" ? $PARAM1 : $PARAM2
65
- issue = GitLab::Issue.new(title: title, labels: ['hotfix', 'production'])
66
- issue.create
67
- branch = "#{issue.iid}-hotfix/#{$PARAM1}"
68
- self.start(branch, issue, $GIT_BRANCH_MASTER)
69
- end
70
-
71
- def self.feature_finish
72
- self.feature_reintegration
73
- end
74
-
75
- def self.feature_reintegration
76
- if (!$PARAM1.match(/\-feature\//))
77
- raise "This branch is not a feature"
78
- end
79
- self.reintegration 'feature'
80
- end
81
-
82
- def self.bugfix_reintegration
83
- if (!$PARAM1.match(/\-bugfix\//))
84
- raise "This branch is not a bugfix"
85
- end
86
- self.reintegration 'bugfix'
87
- end
88
-
89
- def self.bugfix_finish
90
- self.bugfix_reintegration
91
- end
92
-
93
- def self.hotfix_reintegration
94
- if (!$PARAM1.match(/\-hotfix\//))
95
- raise "This branch is not a hotfix"
96
- end
97
- self.reintegration 'hotfix'
98
- end
99
-
100
- def self.hotfix_finish
101
- self.hotfix_reintegration
102
- end
103
-
104
- def self.feature_codereview
105
- if (!$PARAM1.match(/\-feature\//))
106
- raise "This branch is not a feature"
107
- end
108
- self.codereview()
109
- end
110
-
111
- def self.bugfix_codereview
112
- if (!$PARAM1.match(/\-bugfix\//))
113
- raise "This branch is not a bugfix"
114
- end
115
- self.codereview()
116
- end
117
-
118
- def self.hotfix_staging
119
- if (!$PARAM1.match(/\-hotfix\//))
120
- raise "This branch is not a hotfix"
121
- end
122
- self.staging
123
- end
124
-
125
- def self.bugfix_staging
126
- if (!$PARAM1.match(/\-bugfix\//))
127
- raise "This branch is not a bugfix"
128
- end
129
- self.staging
130
- end
131
-
132
- def self.feature_staging
133
- if (!$PARAM1.match(/\-feature\//))
134
- raise "This branch is not a feature"
135
- end
136
- self.staging
137
- end
138
-
139
- def self.release_start
140
- version = $PARAM1
141
- if !version
142
- raise "param 'VERSION' not found"
143
- end
144
- issues = GitLab::Issue.from_list($GITLAB_NEXT_RELEASE_LIST).select{|i| !i.labels.include? 'ready_to_deploy'}
145
- issues_total = issues.size
146
-
147
- if issues_total == 0
148
- raise "Not exist ready issues for start release"
149
- end
150
-
151
- issues_urgent = issues.select{|i| i.labels.include? 'urgent'}
152
- issues_urgent_total = issues_urgent.size
153
- issue_title = "Release version #{version}\n"
154
-
155
- issue_release = GitLab::Issue.find_by(title: issue_title) rescue nil
156
-
157
- if issue_release
158
- print "This card was created previously. Do you want to continue using it? (y/n):".yellow.bg_red
159
-
160
- print"\n If you choose 'n', a new issue will be created!\n"
161
- print "\n"
162
- option = STDIN.gets.chomp
163
- else
164
- option = 'n'
165
- end
166
-
167
- if option == 'n'
168
- issue_release = GitLab::Issue.new(title: issue_title)
169
- issue_release.create
170
- end
171
-
172
- new_labels = []
173
- changelogs = []
174
-
175
- release_branch = "#{issue_release.iid}-release/#{version}"
176
- print "Creating release version #{version}\n"
177
-
178
- begin
179
-
180
- Git.delete_branch(release_branch)
181
- Git.checkout $GIT_BRANCH_DEVELOP
182
- Git.new_branch release_branch
183
-
184
- print "Issue(s) title(s): \n".yellow
185
- issues.each do |issue|
186
- print " -> #{issue.title}\n"
187
- end
188
- print "\n"
189
-
190
- # if issues_urgent_total > 0
191
- print "Attention!".yellow.bg_red
192
- print "\n\nChoose an option for merge:\n".yellow
193
- print "----------------------------\n".blue
194
- print "#{"0".ljust(10)} - Only #{issues_urgent_total} hotfix/urgent issues\n".blue if issues_urgent_total > 0
195
- print "#{"1".ljust(10)} - All #{issues_total} issues\n".blue
196
- print "----------------------------\n".blue
197
- print "Choice a number:\n".yellow
198
- option = STDIN.gets.chomp
199
- # else
200
- # option = "1"
201
- # end
202
-
203
- case option
204
- when "0"
205
- print "Issue(s) title(s): \n"
206
- issues_urgent.each do |issue|
207
- print " -> #{issue.title}\n"
208
- end
209
- issues_urgent.each do |issue|
210
- Git.merge(issue.branch, release_branch)
211
- changelogs << "* ~changelog #{issue.msg_changelog} \n"
212
- new_labels << 'hotfix'
213
- end
214
- issues = issues_urgent
215
- when "1"
216
- type = 'other'
217
- print "Next release has total (#{issues_total}) issues.\n\n".yellow
218
- print "Issue(s) title(s): \n".yellow
219
- issues.each do |issue|
220
- print " -> #{issue.title}\n"
221
- end
222
- issues.each do |issue|
223
- Git.merge(issue.branch, release_branch)
224
- changelogs << "* ~changelog #{issue.msg_changelog} \n"
225
- end
226
- else
227
- raise "option invalid!"
228
- end
229
- print "Changelog messages:\n\n".yellow
230
- d_split = $SFLOW_TEMPLATE_RELEASE_DATE_FORMAT.split('/')
231
- date = Date.today.strftime("%#{d_split[0]}/%#{d_split[1]}/%#{d_split[2]}")
232
- version_header = "#{$SFLOW_TEMPLATE_RELEASE.gsub("{version}", version).gsub("{date}",date)}\n"
233
-
234
- print version_header.blue
235
- msgs_changelog = []
236
- changelogs.each do |clog|
237
- msg_changelog = "#{clog.strip.chomp.gsub('* ~changelog ', ' - ')}\n"
238
- msgs_changelog << msg_changelog
239
- print msg_changelog.light_blue
240
- end
241
- msgs_changelog << "\n"
242
- print "\nSetting changelog message in CHANGELOG\n".yellow
243
- sleep 2
244
-
245
- system('touch CHANGELOG')
246
-
247
- line = version_header + " " + msgs_changelog.join('')
248
- File.write("CHANGELOG",line + File.open('CHANGELOG').read.encode('UTF-8') , mode: "w")
249
-
250
- system('git add CHANGELOG')
251
- system(%{git commit -m "update CHANGELOG version #{version}"})
252
- Git.push release_branch
253
-
254
- issue_release.description = "#{changelogs.join("")}\n"
255
-
256
- issue_release.labels = ['ready_to_deploy', 'Next Release']
257
- issue_release.set_default_branch(release_branch)
258
-
259
-
260
-
261
- print "\n\nTasks list:\n\n".yellow
262
-
263
- tasks = []
264
- issues.each do |issue|
265
- if issue.description.match(/(\* \~tasks .*)+/)
266
- tasks << "* ~tasks #{issue.list_tasks} \n"
267
- end
268
- end
269
-
270
- if tasks.size > 0
271
- new_labels << 'tasks'
272
-
273
- tasks.each do |task|
274
- task = "#{task.strip.chomp.gsub('* ~tasks ', ' - ')}\n"
275
- print task.light_blue
276
- end
277
- issue_release.description += "#{tasks.join("")}\n"
278
- end
279
-
280
- issues.each do |issue|
281
- issue.labels = (issue.labels + new_labels).uniq
282
- issue.close
283
- end
284
-
285
- print "\nYou are on branch: #{release_branch}\n".yellow
286
- print "\nRelease #{version} created with success!\n\n".yellow
287
-
288
- issue_release.description += "* #{issues.map{|i| "##{i.iid},"}.join(' ')}"
289
-
290
- issue_release.update
291
-
292
-
293
- rescue => exception
294
- Git.delete_branch(release_branch)
295
-
296
- raise exception.message
297
- end
298
-
299
- end
300
-
301
- def self.release_finish
302
- version = $PARAM1
303
- if !version
304
- raise "param 'VERSION' not found"
305
- end
306
- new_labels = []
307
-
308
- release_branch = "-release/#{version}"
309
- issue_release = GitLab::Issue.find_by_branch(release_branch)
310
-
311
- Git.merge issue_release.branch, $GIT_BRANCH_DEVELOP
312
- Git.push $GIT_BRANCH_DEVELOP
313
-
314
- type = issue_release.labels.include?('hotfix') ? 'hotfix' : nil
315
- mr_master = GitLab::MergeRequest.new(
316
- source_branch: issue_release.branch,
317
- target_branch: $GIT_BRANCH_MASTER,
318
- issue_iid: issue_release.iid,
319
- title: "Reintegration release #{version}: #{issue_release.branch} into #{$GIT_BRANCH_MASTER}",
320
- description: "Closes ##{issue_release.iid}",
321
- type: type
322
- )
323
- mr_master.create
324
-
325
- # end
326
- # mr_develop = GitLab::MergeRequest.new(
327
- # source_branch: issue_release.branch,
328
- # target_branch: $GIT_BRANCH_DEVELOP,
329
- # issue_iid: issue_release.iid,
330
- # title: "##{issue_release.iid} - #{version} - Reintegration #{issue_release.branch} into develop",
331
- # type: 'hotfix'
332
- # )
333
- # mr_develop.create
334
-
335
-
336
-
337
- # remove_labels = [$GITLAB_NEXT_RELEASE_LIST]
338
- remove_labels = []
339
- old_labels = issue_release.obj_gitlab["labels"] + ['merge_request']
340
- old_labels.delete_if{|label| remove_labels.include? label}
341
- issue_release.labels = (old_labels + new_labels).uniq
342
- issue_release.update
343
- print "\nRelease #{version} finished with success!\n\n".yellow
344
-
345
-
346
- end
347
-
348
-
349
- def self.uninstall_
350
- puts "\n\Uninstall git alias\n\n".yellow
351
- print " \u{1F611} git sflow alias"
352
- print " (removing...) \r".yellow
353
- sleep 2
354
- system('git config --local --unset alias.sflow')
355
- print " \u{1F601}\ git sflow alias"
356
- print " (removed) \u{2714} ".green
357
- print "\n\n"
358
- print "Bye Bye"
359
- print "\n\n"
360
-
361
- end
362
-
363
- def self.install_
364
- puts "\n\nInstalling git alias\n\n".yellow
365
- print " \u{1F611} git sflow alias"
366
- print " (instaling...) \r".yellow
367
- GitLab.create_labels
368
- sleep 2
369
- system(%{git config --local alias.sflow \'!sh -c " sflow $1 $2 $3 $4" - \'})
370
- print " \u{1F601}\ git sflow alias"
371
- print " (instaled) \u{2714} ".green
372
- print "\n\n"
373
- print "git sflow help\n\n"
374
- print "git sflow config\n\n"
375
- print "GitSFlow installed with success!\n\n".green
376
- # self.help_
377
- # self.config_
378
-
379
- end
380
-
381
- def self.push_
382
- self.push_origin
383
- end
384
-
385
- def self.push_origin
386
- branch = !$PARAM1 ? Git.execute { 'git branch --show-current' } : $PARAM1
387
- branch.delete!("\n")
388
- log_messages = Git.log_last_changes branch
389
- issue = GitLab::Issue.find_by_branch branch
390
- Git.push branch
391
- if (log_messages != "")
392
- print "Send messages commit for issue\n".yellow
393
- issue.add_comment(log_messages)
394
- end
395
-
396
- remove_labels = $GIT_BRANCHES_STAGING + ['Staging', $GITLAB_NEXT_RELEASE_LIST]
397
- old_labels = issue.obj_gitlab["labels"]
398
- old_labels.delete_if{|label| remove_labels.include? label}
399
-
400
- issue.labels = old_labels + ['Doing']
401
- issue.update
402
- print "Success!\n\n".yellow
403
- end
404
-
405
- private
406
-
407
- def self.config_
408
- print "\n\---------- Configuration ---------- \n".light_blue
409
- print "\nsflow config \nor\ngit sflow config \n\n".light_blue
410
-
411
- print "\In your project create or update file .env with variables below:\n\n"
412
- print "GITLAB_PROJECT_ID=\n".pink
413
- print "GITLAB_TOKEN=\n".pink
414
- print "GITLAB_URL_API=\n".pink
415
- print "GITLAB_EMAIL=\n".pink
416
- print "GITLAB_LISTS=To Do,Doing,Next Release,Staging\n".pink
417
- print "GITLAB_NEXT_RELEASE_LIST=Next Release\n".pink
418
- print "GIT_BRANCH_MASTER=master\n".pink
419
- print "GIT_BRANCH_DEVELOP=develop\n".pink
420
- print "GIT_BRANCHES_STAGING=staging_1,staging_2\n".pink
421
- print "SFLOW_TEMPLATE_RELEASE=Version {version} - {date}\n".pink
422
- print "SFLOW_TEMPLATE_RELEASE_DATE_FORMAT=d/m/Y\n".pink
423
-
424
- end
425
-
426
- def self.set_error(e)
427
- print "\n\n"
428
- print "Error!".yellow.bg_red
429
- print "\n"
430
- print "#{e.message}".yellow.bg_red
431
- print "\n\n"
432
- e.backtrace.each { |line| print "#{line}\n" }
433
-
434
- print "\n\n"
435
- end
436
-
437
- def self.validates
438
- print "Running validations... \n\n".yellow
439
- if !$GITLAB_PROJECT_ID || !$GITLAB_TOKEN || !$GITLAB_URL_API ||
440
- !$GIT_BRANCH_MASTER || !$GIT_BRANCH_DEVELOP || !$GITLAB_LISTS || !$GITLAB_NEXT_RELEASE_LIST
441
- print "Variables not configured\n".yellow
442
- raise "Run `sflow config` for help"
443
- end
444
-
445
- if !$TYPE && !$ACTION
446
- print "Command invalid!\n".yellow
447
- raise "Run `sflow help` for help"
448
- end
449
- branchs_validations = $GIT_BRANCHES_STAGING + [$GIT_BRANCH_MASTER, $GIT_BRANCH_DEVELOP]
450
- Git.exist_branch?(branchs_validations.join(' ')) rescue raise "You need to create branches #{branchs_validations.join(', ')}"
451
-
452
- GitLab::Issue.ping
453
-
454
-
455
- end
456
-
457
- def self.help_
458
- print "\n\n---------- Help ---------- \n".light_blue
459
- print "\nsflow help\nor\ngit sflow help\n\n".light_blue
460
- print "1 - git sflow feature start FEATURE DESCRIPTION \n".yellow
461
- print "2 - git sflow feature [reintegration|finish] FEATURE_BRANCH\n".yellow
462
- print "3 - git sflow feature codereview BRANCH\n".yellow
463
- print "4 - git sflow feature staging SOURCE_BRANCH\n".yellow
464
- print "5 - git sflow bugfix start BUGFIX DESCRIPTION\n".yellow
465
- print "6 - git sflow bugfix [reintegration|finish] BUGFIX_BRANCH\n".yellow
466
- print "7 - git sflow bugfix codereview BUGFIX_BRANCH\n".yellow
467
- print "8 - git sflow bugfix staging BUGFIX_BRANCH\n".yellow
468
- print "9 - git sflow hotfix start HOTFIX DESCRIPTION\n".yellow
469
- print "10 - git sflow hotfix [reintegration|finish] HOTFIX_BRANCH\n".yellow
470
- print "11 - git sflow hotfix staging HOTFIX_BRANCH\n".yellow
471
- print "12 - git sflow release start RELEASE\n".yellow
472
- print "13 - git sflow release finish RELEASE\n".yellow
473
- print "14 - git sflow push origin BRANCH or git sflow push\n".yellow
474
-
475
- choice = -1
476
- question = "Choice a number for show a example or 0 for exit:\n\n".light_blue
477
- print question
478
- choice = STDIN.gets.chomp
479
- print ""
480
- case choice
481
- when '1'
482
- print "-> git sflow feature start Ticket#9999 'Ticket#9999 - Create new...'\n\n"
483
- when '2'
484
- print "-> git sflow feature reintegration 11-feature/Ticket#9999\n\n"
485
- when '3'
486
- print "-> git sflow feature codereview 11-feature/Ticket#9999\n\n"
487
- when '4'
488
- print "-> git sflow feature staging 11-feature/Ticket#9999\n\n"
489
- when '5'
490
- print "-> git sflow bugfix start Ticket#9999 'Ticket#9999 Bug ...'\n\n"
491
- when '6'
492
- print "-> git sflow bugfix finish 12-bugfix/Ticket#9999'\n\n"
493
- when '7'
494
- print "-> git sflow bugfix codereview 12-bugfix/Ticket#9999\n"
495
- when '8'
496
- print "-> git sflow bugfix staging 12-bugfix/Ticket#9999\n"
497
- when '9'
498
- print "-> git sflow hotfix start Ticket#9999 'Ticket#9999 Bug at production ...'\n\n"
499
- when '10'
500
- print "-> git sflow hotfix reintegration 11-hotfix/Ticket#9999'\n\n"
501
- when '11'
502
- print "-> git sflow hotfix staging 11-hotfix/Ticket#9999'\n\n"
503
- when '12'
504
- print "-> git sflow release start v9.9.99'\n\n"
505
- when '13'
506
- print "-> git sflow release finish v9.9.99'\n\n"
507
- when '14'
508
- print "-> git sflow push BRANCH\n\n"
509
- when '0'
510
- else
511
- end
512
- print "See you soon!".green
513
- print "\n\n"
514
-
515
-
516
- end
517
-
518
- def self.reintegration type = "feature"
519
- # Git.fetch ref_branch
520
- # Git.checkout ref_branch
521
- # Git.pull ref_branch
522
- source_branch = $PARAM1
523
- issue = GitLab::Issue.find_by_branch(source_branch)
524
-
525
- # Setting Changelog
526
- print "Title: #{issue.title}\n\n"
527
- print "CHANGELOG message:\n--> ".yellow
528
- message_changelog = STDIN.gets.chomp.to_s.encode('UTF-8')
529
- print "\n ok!\n\n".green
530
- new_labels = []
531
- if (type == 'hotfix')
532
- !source_branch.match('hotfix') rescue raise "invalid branch!"
533
- new_labels << 'hotfix'
534
- new_labels << 'urgent'
535
- else
536
- (!source_branch.match('feature') && !source_branch.match('bugfix')) rescue raise "invalid branch!"
537
- end
538
- remove_labels = $GIT_BRANCHES_STAGING + $GITLAB_LISTS + ['Staging']
539
- new_labels << 'changelog'
540
- new_labels << $GITLAB_NEXT_RELEASE_LIST
541
- old_labels = issue.obj_gitlab["labels"]
542
- old_labels.delete_if{|label| remove_labels.include? label}
543
- issue.labels = (old_labels + new_labels).uniq
544
- issue.description.gsub!(/\* \~changelog .*\n?/,'')
545
- issue.description = "#{issue.description} \n* ~changelog #{message_changelog}"
546
- print "Setting changelog: ".yellow
547
- print "#{message_changelog}\n".green
548
- print "Moving issue to list: ".yellow
549
- print "#{$GITLAB_NEXT_RELEASE_LIST}\n".green
550
-
551
- # Setting Tasks
552
- print "\n\nIf there are any tasks to be run, list them below separated by spaces, otherwise press Enter:\n"
553
- print "\n Tasks:\n--> ".yellow
554
- tasks = STDIN.gets.chomp
555
- print "\n ok!\n\n".green
556
- if tasks != "" and tasks != nil
557
- issue.description.gsub!(/\* \~tasks .*\n?/,'')
558
- issue.description = "#{issue.description} \n* ~tasks #{tasks}"
559
- print "Setting tasks: ".yellow
560
- end
561
- print "#{tasks}\n".green
562
-
563
-
564
- issue.update
565
-
566
- end
567
-
568
- def self.start branch, issue, ref_branch = $GIT_BRANCH_DEVELOP
569
- Git.checkout ref_branch
570
- description = "* ~default_branch #{branch}"
571
- issue.description = description
572
- issue.update
573
-
574
- Git.new_branch branch
575
- Git.push branch
576
-
577
- print "\nYou are on branch: #{branch}\n\n".yellow
578
- end
579
-
580
- def self.codereview
581
- Git.checkout $GIT_BRANCH_DEVELOP
582
- source_branch = $PARAM1
583
- issue = GitLab::Issue.find_by_branch(source_branch)
584
- # issue.move
585
- mr = GitLab::MergeRequest.new(
586
- source_branch: source_branch,
587
- target_branch: $GIT_BRANCH_DEVELOP,
588
- issue_iid: issue.iid
589
- )
590
- mr.create_code_review
591
- issue.labels = (issue.obj_gitlab["labels"] + ['code_review']).uniq
592
- issue.update
593
- end
594
-
595
- def self.staging
596
- branch = $PARAM1
597
- issue = GitLab::Issue.find_by_branch(branch)
598
-
599
- print "Staging branches list:\n\n".yellow
600
- print "----------------------------\n".blue
601
- $GIT_BRANCHES_STAGING.each_with_index do |staging, index|
602
- print "#{index} - #{staging}\n".blue
603
- end
604
- print "----------------------------\n".blue
605
- print "Choice number of target branch:\n".yellow
606
- target_branch_id = STDIN.gets.chomp
607
-
608
- print "\n#{target_branch_id}, "
609
- target_branch = $GIT_BRANCHES_STAGING[target_branch_id.to_i]
610
- if !$GIT_BRANCHES_STAGING.include?(target_branch)
611
- raise "option invalid!"
612
- end
613
- print "ok!\n".green
614
-
615
- print "\nAttention: \n".yellow.bg_red
616
- print "Do you want clean first the target branch or only merge?\n\n".yellow
617
- print "----------------------------\n".blue
618
- print "0 - Clean it first, then do merge #{branch} into #{target_branch}\n".blue
619
- print "1 - Only Merge: Merge #{branch} into #{target_branch}\n".blue
620
- print "----------------------------\n".blue
621
- print "Choice number of target branch:\n".yellow
622
- option_merge = STDIN.gets.chomp
623
- print "\n#{option_merge}, "
624
- print "ok!\n".green
625
-
626
- if option_merge == '0'
627
- issues_staging = GitLab::Issue.from_list(target_branch).select{|i| i.branch != branch}
628
- issues_staging.each do |i|
629
- i.labels.delete(target_branch)
630
- i.labels.delete('Staging')
631
- i.labels.push('Doing')
632
- i.update
633
- end
634
- Git.reset_hard branch, target_branch
635
- Git.push_force target_branch
636
- elsif option_merge == '1'
637
- Git.reset_hard target_branch, target_branch
638
- Git.merge branch, target_branch
639
- Git.push target_branch
640
- else
641
- raise 'Wrong choice'
642
- end
643
-
644
- new_labels = [target_branch, 'Staging']
645
- remove_labels = $GITLAB_LISTS
646
- old_labels = issue.obj_gitlab["labels"]
647
- old_labels.delete_if{|label| remove_labels.include? label}
648
- issue.labels = (old_labels + new_labels).uniq
649
- issue.update
650
-
651
- self.codereview
652
- Git.checkout(branch)
653
- end
654
- end
655
-