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