missue 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/missue.rb +188 -70
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b2ec8acf467f19715d13193a9986bb5221778cd19db958f7da423d168d6da98
|
4
|
+
data.tar.gz: acffcef03b1bd44b4b91752f3dd0d0116e35a8119aeb4537146845c1cfb38948
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52e492915bb06229ae9509f9ccdb21ea9e9f1855cacb15d3b836d241a67e01e9ff2978a31e86a3b8d270043572ca76d2711c6c0cf4330d667fbefda8ccd19b31
|
7
|
+
data.tar.gz: 7fba29daba1050327b8e9155413d59e0c959321b8ae127f49ae330b3be3142cb704b9b65a18422a408c85a8d7dc10dcfffa2eeacb50d76fcfda8133337e176ac
|
data/bin/missue.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
#==================================================================================================
|
4
4
|
# Author: E:V:A
|
5
5
|
# Date: 2018-04-10
|
6
|
-
# Change: 2022-01-
|
7
|
-
# Version: 1.0.
|
6
|
+
# Change: 2022-01-28
|
7
|
+
# Version: 1.0.3
|
8
8
|
# License: ISC
|
9
9
|
# Formatting UTF-8 with 4-space TAB stops and no TAB chars.
|
10
10
|
# URL: https://github.com/E3V3A/gh-missue
|
@@ -17,91 +17,117 @@
|
|
17
17
|
# [1] docopt https://github.com/docopt/docopt.rb/ # option parser
|
18
18
|
# [2] octokit https://github.com/octokit/octokit.rb/ # GitHubs API library
|
19
19
|
#
|
20
|
-
#
|
20
|
+
# Development Notes:
|
21
21
|
#
|
22
|
+
# - To print new lines, you have to use "\n", not '\n'.
|
23
|
+
# - Ruby function options template:
|
24
|
+
# def testing(a, b = 1, *c, d: 1, **x) { p a,b,c,d,x }
|
25
|
+
# testing('a', 'b', 'c', 'd', 'e', d: 2, x: 1)
|
26
|
+
# # => ["a", "b", ["c", "d", "e"], 2, {:x=>1}]
|
27
|
+
#
|
28
|
+
# Installation:
|
29
|
+
#
|
22
30
|
# 1. To make this run, you need to install Ruby with:
|
23
31
|
# (a) winget install ruby
|
24
32
|
# (b) gem install octokit
|
25
33
|
# (c) gem install docopt
|
34
|
+
# (d) gem install missue
|
26
35
|
#
|
27
|
-
# 2.
|
28
|
-
#
|
29
|
-
# 3. You should also consider creating a personal authentication token on GitHub,
|
30
|
-
# to avoid getting rate-limited by a large number of requests in short time.
|
36
|
+
# 2. You also have to create a personal authentication token on GitHub, in order
|
37
|
+
# to copy and avoid getting rate-limited by a large number of requests in short time.
|
31
38
|
#
|
32
39
|
# ToDo:
|
33
40
|
#
|
34
|
-
# [ ] Add
|
35
|
-
#
|
36
|
-
# [ ]
|
37
|
-
#
|
38
|
-
# [ ]
|
41
|
+
# [ ] Add pagination handling in repo_access():
|
42
|
+
# https://github.com/octokit/octokit.rb/issues/732
|
43
|
+
# [ ] Write a more efficient pull_source_issues() (Now using ~6 requests per moved issue?)
|
44
|
+
# [ ] Switch meaning of (itype vs. istat): "itype" should be [issue, pr] and "istat" should be [open,closed,all].
|
45
|
+
# [ ] Add -o option to NOT copy original author & URL into migrated issue
|
46
|
+
# [ ] Add -k option to copy previously 'closed' issues as 'open' [keep, open, closed]
|
47
|
+
# [ ] Add -a put this as a CLI option for showing repo_access()
|
48
|
+
# [ ] Add -p <itype> option to select only pr vs issue. <itype> = [issue, pr]
|
49
|
+
# [x] Fix inclusion of CLI options: -d, -n
|
39
50
|
# -d - show debug info with full option list, raw requests & responses etc.
|
40
51
|
# -n <1,3-6,9> - only migrate issues given by the list. Can be a range.
|
41
|
-
# [
|
52
|
+
# [x] Fix new Authentication issues
|
53
|
+
# [ ] Fix username/password authentication ?? (Maybe Deprecated?)
|
54
|
+
# [x] Check environment variable for OAUTH token:
|
55
|
+
# access_token = "#{ENV['GITHUB_OAUTH_TOKEN']}"
|
42
56
|
# [ ] Make the issue vs PR selection smarter!
|
43
57
|
# - Now it just takes ALL and filters using list_source_issues()
|
44
|
-
# [ ] ? Add <type> option to selec pr, vs issue: '-p <type>' where <type> = [issue, pr]
|
45
58
|
#
|
46
59
|
# References:
|
47
60
|
#
|
48
61
|
# [1] https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/
|
49
62
|
# [2] https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#web-application-flow
|
50
|
-
# [3]
|
63
|
+
# [3] https://stackoverflow.com/questions/3219229/why-does-array-slice-behave-differently-for-length-n
|
51
64
|
#
|
52
65
|
#==================================================================================================
|
66
|
+
require 'pathname'
|
53
67
|
require 'docopt'
|
54
68
|
require 'octokit'
|
55
69
|
require 'net/http'
|
56
70
|
require 'json'
|
57
71
|
|
58
|
-
VERSION = '1.0.
|
72
|
+
VERSION = '1.0.3'
|
59
73
|
options = {}
|
60
74
|
|
75
|
+
# Remap __FILE__ to avoid long path on '-h' help page
|
76
|
+
# NOTE: We could also use: $0 - The name of the ruby script file currently executing
|
77
|
+
# puts "File: #{$0}" # Same problem!
|
78
|
+
pn = Pathname.new(__FILE__)
|
79
|
+
__BASE__ = pn.basename
|
80
|
+
|
61
81
|
#--------------------------------------------------------------------------------------------------
|
62
82
|
# The cli options parser
|
63
83
|
#--------------------------------------------------------------------------------------------------
|
84
|
+
# Usage: http://docopt.org/
|
64
85
|
doc = <<DOCOPT
|
65
|
-
|
86
|
+
.
|
66
87
|
Description:
|
67
88
|
|
68
|
-
gh-missue is a Ruby program that migrate issues from one github repository to another.
|
89
|
+
gh-missue is a Ruby program that bulk migrate issues from one github repository to another.
|
69
90
|
Please note that you can only migrate issues to your own repo, unless you have an OAuth2
|
70
|
-
authentication token.
|
91
|
+
authentication token. You can also list all the open or closed issues and PR's along with
|
92
|
+
the colored labels. It also include the original author's name and URL of the issues copied.
|
93
|
+
The <oauth2_token> can be omitted if it is defined in the 'GITHUB_OAUTH_TOKEN' environmental
|
94
|
+
variable.
|
71
95
|
|
72
96
|
Usage:
|
73
|
-
#{
|
74
|
-
#{
|
75
|
-
#{
|
76
|
-
#{
|
77
|
-
#{
|
78
|
-
#{
|
79
|
-
#{
|
80
|
-
#{
|
81
|
-
#{__FILE__} -v
|
82
|
-
#{__FILE__} -h
|
97
|
+
#{__BASE__} -c [<oauth2_token>] <source_repo> <target_repo>
|
98
|
+
#{__BASE__} [-d] -n <ilist> [<oauth2_token>] <source_repo> <target_repo>
|
99
|
+
#{__BASE__} [-d] -t <itype> [<oauth2_token>] <source_repo> <target_repo>
|
100
|
+
#{__BASE__} [-d] -l <itype> [<oauth2_token>] <repo>
|
101
|
+
#{__BASE__} [-d] -r [<oauth2_token>]
|
102
|
+
#{__BASE__} -a [<oauth2_token>]
|
103
|
+
#{__BASE__} -v
|
104
|
+
#{__BASE__} -h
|
83
105
|
|
84
106
|
Options:
|
85
107
|
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
108
|
+
-a - show your Read/Write accees status on all your repositories.
|
109
|
+
-c - copy (only) the issue labels from <source> to <target> repos, including name, color and description.
|
110
|
+
-l <itype> <repo> - list all issues of type <itype> (all, open, closed) and all labels in repository <repo>
|
111
|
+
-n <ilist> - only migrate specific issues given by a comma separated list of numbers, including ranges.
|
112
|
+
-t <itype> - specify the type of issues to migrate. [default: open]
|
89
113
|
-r - show current rate limit and authentication method for your IP
|
90
114
|
-d - show debug info with full option list, raw requests & responses etc.
|
91
|
-
-n <ilist> - only migrate issues with comma separated numbers given by the list. Can include a range.
|
92
115
|
-h, --help - show this help message and exit
|
93
116
|
-v, --version - show version and exit
|
94
117
|
|
95
118
|
Examples:
|
96
119
|
|
97
|
-
#{
|
98
|
-
#{
|
99
|
-
#{
|
100
|
-
#{
|
120
|
+
#{__BASE__} -r
|
121
|
+
#{__BASE__} -l open E3V3A/gh-missue
|
122
|
+
#{__BASE__} -t closed "E3V3A/TESTO" "USERNAME/REPO"
|
123
|
+
#{__BASE__} -n 1,4-5 "E3V3A/TESTO" "USERNAME/REPO"
|
101
124
|
|
102
125
|
Dependencies:
|
103
|
-
#{
|
126
|
+
#{__BASE__} depends on the following gem packages: octokit, docopt.
|
104
127
|
|
128
|
+
Bugs or Issues?
|
129
|
+
Please report bugs or issues here:
|
130
|
+
https://github.com/E3V3A/gh-missue
|
105
131
|
DOCOPT
|
106
132
|
|
107
133
|
#--------------------------------------------------------------------------------------------------
|
@@ -118,13 +144,17 @@ class IssueMigrator
|
|
118
144
|
s = "\e[48;2;#{r};#{g};#{b}m \e[0m"
|
119
145
|
end
|
120
146
|
|
147
|
+
def getToken
|
148
|
+
access_token = "#{ENV['GITHUB_OAUTH_TOKEN']}" # @access_token ???
|
149
|
+
end
|
150
|
+
|
121
151
|
# curl -v -H "Authorization: token <MY-40-CHAR-TOKEN>" \
|
122
152
|
# -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/E3V3A/gh-missue/issues
|
123
153
|
def initialize(access_token, source_repo, target_repo)
|
124
154
|
@client = Octokit::Client.new(
|
125
155
|
:access_token => access_token,
|
126
|
-
:accept
|
127
|
-
:headers
|
156
|
+
:accept => 'application/vnd.github.v3+json',
|
157
|
+
:headers => { "Authorization" => "token " + access_token },
|
128
158
|
# :headers => { "X-GitHub-OTP" => "<your 2FA token>" }
|
129
159
|
|
130
160
|
# // Personal OAuth2 Access Token
|
@@ -143,19 +173,49 @@ class IssueMigrator
|
|
143
173
|
@source_repo = source_repo
|
144
174
|
@target_repo = target_repo
|
145
175
|
@itype = itype
|
176
|
+
@ilist = ilist # 2022-01-27 18:48:35
|
146
177
|
end
|
147
178
|
|
148
|
-
def pull_source_issues(itype
|
179
|
+
def pull_source_issues(itype, ilist = nil)
|
149
180
|
@client.auto_paginate = true
|
150
|
-
|
151
|
-
|
152
|
-
puts "
|
181
|
+
|
182
|
+
puts "\n <itype>: #{itype}"
|
183
|
+
puts " <ilist>: #{ilist}\n"
|
184
|
+
|
185
|
+
# itype is a constant, while ilist is a list, so we need to iterate
|
186
|
+
# The issue list: <ilist>: "1,2,5-7,19"
|
187
|
+
if itype
|
188
|
+
@issues = @client.issues(@source_repo, :state => itype) # The issue type: <itype>: [open/closed/all]
|
189
|
+
elsif ilist
|
190
|
+
#@issues = @client.issues(@source_repo, :state => 'all')
|
191
|
+
|
192
|
+
#@issues.each do |source_issue|
|
193
|
+
# print "Processing issue: #{source_issue.number} (#{n}/#{issues.size})\r"
|
194
|
+
# if !source_issue.key?(:pull_request) || source_issue.pull_request.empty?
|
195
|
+
# #
|
196
|
+
# end
|
197
|
+
#end
|
198
|
+
|
199
|
+
puts
|
200
|
+
my_array = []
|
201
|
+
ilist.each do |i|
|
202
|
+
puts "Adding issue [#]: #{i} \t from: #{@source_repo}\n"
|
203
|
+
my_array.push(@client.issue(@source_repo.freeze, "#{i}", accept: 'application/vnd.github.v3+json', :state => 'all'))
|
204
|
+
#@issues.push(@client.issue(@source_repo.freeze, "#{i}", accept: 'application/vnd.github.v3+json', :state => 'all'))
|
205
|
+
end
|
206
|
+
@issues = my_array
|
207
|
+
end
|
208
|
+
|
209
|
+
opa = "#{@issues}".split(',').join(",\n")
|
210
|
+
puts "\n\n#{opa}\n\n" if $debug
|
211
|
+
|
212
|
+
# ToDo: "itype" should be [issue, pr] and "istat" should be [open,closed,all].
|
213
|
+
puts "\nFound #{issues.size} issues of status: #{itype}\n"
|
153
214
|
end
|
154
215
|
|
155
216
|
def list_source_issues(itype)
|
156
217
|
pull_source_issues(itype)
|
157
218
|
@issues.each do |source_issue|
|
158
|
-
#puts "[#{source_issue.number}]\t #{source_issue.title}"
|
159
219
|
puts "[#{source_issue.number}]".ljust(10) + "#{source_issue.title}"
|
160
220
|
end
|
161
221
|
puts
|
@@ -167,9 +227,7 @@ class IssueMigrator
|
|
167
227
|
puts "Found #{@labels.size} issue labels:"
|
168
228
|
# ToDo: check and handle length (in case > 20)
|
169
229
|
@labels.each do |label|
|
170
|
-
# ToDo: Add " " colored "boxes" using the color of the tag.
|
171
230
|
color_box = hex2rgb("#{label.color}") + " "
|
172
|
-
#puts "[#{label.color}] " + "#{label.name}".ljust(20) + ": #{label.description}"
|
173
231
|
puts "[#{label.color}] " + color_box + "#{label.name}".ljust(20) + ": #{label.description}"
|
174
232
|
end
|
175
233
|
puts
|
@@ -183,9 +241,8 @@ class IssueMigrator
|
|
183
241
|
puts "Copying labels..."
|
184
242
|
tlabel = "" # nil
|
185
243
|
@source_labels.each do |lbl|
|
186
|
-
#
|
187
|
-
|
188
|
-
puts "[#{lbl.color}] " + "#{lbl.name}".ljust(20) + ": #{lbl.description}"
|
244
|
+
#puts "[#{lbl.color}] " + "#{lbl.name}".ljust(20) + ": #{lbl.description}"
|
245
|
+
puts "[#{label.color}] " + color_box + "#{label.name}".ljust(20) + ": #{label.description}"
|
189
246
|
#tlabel = {"name": lbl.name, "description": lbl.description, "color": lbl.color}
|
190
247
|
#tlabel = {lbl.name, lbl.color, description: lbl.description}
|
191
248
|
#lab = client.add_label(@target_repo.freeze, accept: 'application/vnd.github.symmetra-preview+json', tlabel)
|
@@ -200,27 +257,29 @@ class IssueMigrator
|
|
200
257
|
n = 0
|
201
258
|
@issues.each do |source_issue|
|
202
259
|
n += 1
|
203
|
-
print "
|
260
|
+
print "Pushing issue: #{source_issue.number} (#{n}/#{issues.size})\r"
|
204
261
|
source_labels = get_source_labels(source_issue)
|
205
262
|
source_comments = get_source_comments(source_issue)
|
263
|
+
|
264
|
+
# Only push if not a PR || empy ??? 2022-01-27 19:42:37
|
206
265
|
if !source_issue.key?(:pull_request) || source_issue.pull_request.empty?
|
207
266
|
|
208
267
|
# PR#2
|
209
268
|
issue_body = "*Originally created by @#{source_issue.user[:login]} (#{source_issue.html_url}):*\n\n#{source_issue.body}"
|
210
269
|
target_issue = @client.create_issue(@target_repo, source_issue.title, issue_body, {labels: source_labels})
|
211
270
|
|
212
|
-
#target_issue = @client.create_issue(@target_repo, source_issue.title, source_issue.body, {labels: source_labels})
|
213
|
-
|
214
271
|
push_comments(target_issue, source_comments) unless source_comments.empty?
|
272
|
+
|
273
|
+
# Close target issue IF it was already closed!
|
274
|
+
# ToDo: -k switch!
|
215
275
|
@client.close_issue(@target_repo, target_issue.number) if source_issue.state === 'closed'
|
216
276
|
end
|
217
277
|
# We need to set a rate limit, even for OA2, it is 0.5 [req/sec]
|
218
|
-
sleep(
|
278
|
+
sleep(5) if ( issues.size > 1 ) # [sec]
|
219
279
|
end
|
220
280
|
puts "\n"
|
221
281
|
end
|
222
282
|
|
223
|
-
# API bug: missing color/description
|
224
283
|
def get_source_labels(source_issue)
|
225
284
|
labels = []
|
226
285
|
source_issue.labels.each do |lbl|
|
@@ -249,8 +308,6 @@ end
|
|
249
308
|
#--------------------------------------------------------------------------------------------------
|
250
309
|
# MAIN
|
251
310
|
#--------------------------------------------------------------------------------------------------
|
252
|
-
|
253
|
-
#if __FILE__ == $0
|
254
311
|
begin
|
255
312
|
|
256
313
|
hLine = "-"*72
|
@@ -261,18 +318,53 @@ begin
|
|
261
318
|
ilist.gsub(/(\d+)-(\d+)/) { ($1..$2).to_a.join(',') }.split(',').map(&:to_i).sort.uniq
|
262
319
|
end
|
263
320
|
|
321
|
+
# ToDo: Add pagination handling!
|
322
|
+
def repo_access
|
323
|
+
hLine = "-"*72
|
324
|
+
redW = "\e[1;49;31mW\e[0m" # red W
|
325
|
+
yelR = "\e[1;49;33mR\e[0m" # yel R
|
326
|
+
grnR = "\e[1;49;32mR\e[0m" # grn R
|
327
|
+
client = Octokit::Client.new(access_token: ENV['GITHUB_OAUTH_TOKEN'], accept: 'application/vnd.github.v3+json')
|
328
|
+
puts "\n" + hLine + "\n Repo Access\n" + hLine
|
329
|
+
client.repositories.each do |repository|
|
330
|
+
full_name = repository[:full_name]
|
331
|
+
has_push_access = repository[:permissions][:push]
|
332
|
+
access_type = has_push_access ? redW : grnR
|
333
|
+
puts " #{access_type} : #{full_name}"
|
334
|
+
end
|
335
|
+
|
336
|
+
puts "\n" + hLine + "\n Organizations\n" + hLine
|
337
|
+
client.organizations.each do |organization|
|
338
|
+
puts " #{organization[:login]}"
|
339
|
+
end
|
340
|
+
puts hLine
|
341
|
+
end
|
342
|
+
|
264
343
|
#----------------------------------------------------------------------
|
265
344
|
# CLI Options
|
266
345
|
#----------------------------------------------------------------------
|
267
346
|
options = Docopt::docopt(doc, version: VERSION) # help: true
|
268
347
|
|
348
|
+
# Should never get here if docopt is set correcly
|
349
|
+
#if ( options['-n'] && options['-t'] )
|
350
|
+
# puts "\n ERROR: You cannot use both '-n' and '-t' options at the same time!\n"
|
351
|
+
# exit
|
352
|
+
#end
|
353
|
+
|
354
|
+
if options['-a']
|
355
|
+
repo_access
|
356
|
+
end
|
357
|
+
|
269
358
|
if options['-d']
|
270
359
|
debug = true
|
271
|
-
#
|
272
|
-
puts "\nAvailable options are:\n#{options.inspect}\n"
|
360
|
+
opa = "#{options.inspect}".split(',').join("\n")
|
361
|
+
#puts "\nAvailable options are:\n#{options.inspect}\n"
|
362
|
+
puts "\nAvailable options are:\n#{opa}\n"
|
273
363
|
puts "\nThe supplied CLI options were:\n#{ARGV.inspect}\n\n"
|
274
364
|
end
|
275
365
|
|
366
|
+
# This is possibly fucking up things, since it doesn't have an option flag.
|
367
|
+
# Perhaps add '-u' <token> as a new flag?
|
276
368
|
if options['<oauth2_token>']
|
277
369
|
access_token = options['<oauth2_token>']
|
278
370
|
if access_token.size != 40
|
@@ -293,6 +385,7 @@ begin
|
|
293
385
|
itype = options['-l']
|
294
386
|
source_repo = options['<repo>']
|
295
387
|
target_repo = "E3V3A/TESTT" # a dummy repo
|
388
|
+
|
296
389
|
im = IssueMigrator.new("#{access_token}", "#{source_repo}", "#{target_repo}")
|
297
390
|
im.list_source_issues(itype)
|
298
391
|
im.list_source_labels
|
@@ -301,11 +394,11 @@ begin
|
|
301
394
|
# -n <ilist>
|
302
395
|
if ( options['-n'] )
|
303
396
|
ilist = options['-n']
|
304
|
-
puts "The \"-n\" option has not yet been implemented!"
|
305
|
-
puts "The supplied issue list: #{ilist}"
|
306
|
-
#sorted = ilist.split(",").sort_by(&:to_i)
|
397
|
+
#puts "The \"-n\" option has not yet been implemented!"
|
398
|
+
#puts "The supplied issue list: #{ilist}"
|
307
399
|
sorted = sort_list(ilist)
|
308
400
|
puts "The sorted issue list : #{sorted}"
|
401
|
+
@ilist = sorted
|
309
402
|
end
|
310
403
|
|
311
404
|
# -r
|
@@ -316,9 +409,6 @@ begin
|
|
316
409
|
|
317
410
|
if ( options['-r'] )
|
318
411
|
|
319
|
-
#access_token = "#{ENV['GITHUB_OAUTH_TOKEN']}"
|
320
|
-
#access_token = "<MY-40-CHAR-TOKEN>"
|
321
|
-
|
322
412
|
url = URI("https://api.github.com/rate_limit")
|
323
413
|
http = Net::HTTP.new(url.host, url.port)
|
324
414
|
http.use_ssl = true
|
@@ -327,6 +417,15 @@ begin
|
|
327
417
|
req["User-Agent"] = "gh-missue"
|
328
418
|
req["Accept"] = "application/vnd.github.v3+json"
|
329
419
|
|
420
|
+
# Try to get token from ENV
|
421
|
+
if not (access_token)
|
422
|
+
access_token = "#{ENV['GITHUB_OAUTH_TOKEN']}"
|
423
|
+
if (access_token == "")
|
424
|
+
access_token = nil
|
425
|
+
puts "No token found: using basic access"
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
330
429
|
if (access_token)
|
331
430
|
puts "Using access_token: #{access_token}"
|
332
431
|
req["Authorization"] = "token #{access_token}"
|
@@ -371,24 +470,43 @@ begin
|
|
371
470
|
puts " Search limit : #{rbs['limit']}"
|
372
471
|
puts " Remaining : #{rbs['remaining']}"
|
373
472
|
puts " Refresh at : #{RTs}"
|
473
|
+
|
474
|
+
# ToDo: put this as a CLI option
|
475
|
+
#repo_access # This is using 1 request to complete!
|
476
|
+
|
374
477
|
end
|
375
478
|
end
|
376
479
|
|
377
|
-
|
480
|
+
#------------------------------------------------------------
|
481
|
+
# MAIN - Do the migration
|
482
|
+
#------------------------------------------------------------
|
483
|
+
# "and" or && ?? 2022-01-27 17:26:14
|
378
484
|
if ( options['<source_repo>'] and options['<target_repo>'] )
|
379
485
|
itype = options['-t']
|
380
486
|
#ilist = options['-n']
|
381
|
-
|
487
|
+
|
488
|
+
puts "\n<itype>: #{itype}" if debug
|
489
|
+
puts "<ilist>: #{ilist}\n" if debug
|
490
|
+
|
382
491
|
source_repo = options['<source_repo>']
|
383
492
|
target_repo = options['<target_repo>']
|
384
493
|
im = IssueMigrator.new("#{access_token}", "#{source_repo}", "#{target_repo}")
|
494
|
+
|
385
495
|
if options['-c']
|
386
496
|
im.create_target_labels
|
387
497
|
exit
|
388
498
|
end
|
389
|
-
|
390
|
-
|
391
|
-
|
499
|
+
|
500
|
+
if ilist
|
501
|
+
itype = nil
|
502
|
+
ilist = sort_list(ilist)
|
503
|
+
im.pull_source_issues(itype, ilist)
|
504
|
+
else
|
505
|
+
im.pull_source_issues(itype)
|
506
|
+
end
|
507
|
+
|
508
|
+
#im.pull_source_issues(itype) # add ilist
|
509
|
+
##im.list_source_issues(itype) #
|
392
510
|
im.push_issues
|
393
511
|
end
|
394
512
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: missue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E3V3A
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
original authors and
|
13
|
+
description: List, migrate and batch copy issues and labels across github repos with
|
14
|
+
links to original authors and issues.
|
15
15
|
email: xdae3v3a@gmail.com
|
16
16
|
executables:
|
17
17
|
- missue.rb
|