git-maintain 0.5.0.pre.14.g8a5f0b3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1 -9
- data/bin/git-maintain +0 -2
- data/lib/branch.rb +40 -85
- data/lib/common.rb +2 -66
- data/lib/repo.rb +13 -45
- data/lib/travis.rb +4 -22
- 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: 356c77a387c232c07fd214617a107f32853d3425e1468f25c4f8594d8e5dedc8
|
4
|
+
data.tar.gz: a791a193557d15988872bef9ef3937591477491cfeb663b2fe4580c8cae8204e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0194ca3ad74a99f24e1910df00dc320d1a277ba9a9bfab48142f176d4a23428fb275e37a2ac932d456ce26690ededa924b5bc15459b5bd348840d4ea7c13174d'
|
7
|
+
data.tar.gz: d604791372bfa3988518cb5b4216815236885e37e8c7716bc1cc9672306582b4d3a43b7c3c880bc88809e91d1d0441bf3d8312ddc59692daf2ae731f15be737e
|
data/CHANGELOG
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
-
* Speed up push_stable
|
2
|
-
* Add --check option for push_stable
|
3
|
-
* Add --no-fetch option
|
4
|
-
* Cleanup release email
|
5
|
-
* Add build timestamp for running build in monitor
|
6
|
-
* Add --watch for monitor and monitor_stable
|
7
|
-
* Fix bad output ot git maintain steal
|
8
|
-
* Rewrite log system and handle colors
|
9
|
-
|
10
1
|
------------------
|
11
2
|
0.5.0 (2019-02-05)
|
12
3
|
------------------
|
13
4
|
|
5
|
+
|
14
6
|
* Handle bad Fixes tag
|
15
7
|
* Speed up steal feature by remembering last point checked
|
16
8
|
* Add Upstream commit tag when cherry picking commits
|
data/bin/git-maintain
CHANGED
@@ -45,8 +45,6 @@ optsParser.on("-b", "--branch-suffix [SUFFIX]", "Branch suffix. Default is 'mast
|
|
45
45
|
|val| opts[:br_suff] = val}
|
46
46
|
optsParser.on("-n", "--no", "Assume no to all questions.") {
|
47
47
|
|val| opts[:no] = true}
|
48
|
-
optsParser.on("--verbose", "Displays more informations.") {
|
49
|
-
|val| GitMaintain::setVerbose(true)}
|
50
48
|
GitMaintain::setOpts(action, optsParser, opts)
|
51
49
|
|
52
50
|
rest = optsParser.order!(ARGV);
|
data/lib/branch.rb
CHANGED
@@ -46,10 +46,6 @@ module GitMaintain
|
|
46
46
|
opts[:do_merge] = false
|
47
47
|
opts[:push_force] = false
|
48
48
|
opts[:no_travis] = false
|
49
|
-
opts[:all] = false
|
50
|
-
opts[:check_only] = false
|
51
|
-
opts[:no_fetch] = false
|
52
|
-
opts[:watch] = false
|
53
49
|
|
54
50
|
optsParser.on("-v", "--base-version [MIN_VER]", Integer, "Older release to consider.") {
|
55
51
|
|val| opts[:base_ver] = val}
|
@@ -60,12 +56,6 @@ module GitMaintain
|
|
60
56
|
optsParser.on("-B", "--manual-branch <branch name>", "Work on a specific (non-stable) branch.") {
|
61
57
|
|val| opts[:manual_branch] = val}
|
62
58
|
end
|
63
|
-
|
64
|
-
if NO_FETCH_ACTIONS.index(action) == nil
|
65
|
-
optsParser.on("--no-fetch", "Skip fetch of stable repo.") {
|
66
|
-
|val| opts[:no_fetch] = true}
|
67
|
-
end
|
68
|
-
|
69
59
|
case action
|
70
60
|
when :cp
|
71
61
|
optsParser.banner += "-c <sha1> [-c <sha1> ...]"
|
@@ -75,10 +65,6 @@ module GitMaintain
|
|
75
65
|
optsParser.banner += "-m <suffix>"
|
76
66
|
optsParser.on("-m", "--merge [SUFFIX]", "Merge branch with suffix.") {
|
77
67
|
|val| opts[:do_merge] = val}
|
78
|
-
when :monitor, :monitor_stable
|
79
|
-
optsParser.on("-w", "--watch [PERIOD]", Integer,
|
80
|
-
"Watch and refresh travis status every <PERIOD>.") {
|
81
|
-
|val| opts[:watch] = val}
|
82
68
|
when :push
|
83
69
|
optsParser.banner += "[-f]"
|
84
70
|
optsParser.on("-f", "--force", "Add --force to git push (for 'push' action).") {
|
@@ -87,8 +73,6 @@ module GitMaintain
|
|
87
73
|
optsParser.banner += "[-T]"
|
88
74
|
optsParser.on("-T", "--no-travis", "Ignore Travis build status and push anyway.") {
|
89
75
|
|val| opts[:no_travis] = true}
|
90
|
-
optsParser.on("-c", "--check", "Check if there is something to be pushed.") {
|
91
|
-
|val| opts[:check_only] = true}
|
92
76
|
when :steal
|
93
77
|
optsParser.banner += "[-a]"
|
94
78
|
optsParser.on("-a", "--all", "Check all commits from master. "+
|
@@ -110,7 +94,7 @@ module GitMaintain
|
|
110
94
|
repo = Repo::load()
|
111
95
|
travis = TravisChecker::load(repo)
|
112
96
|
|
113
|
-
if NO_FETCH_ACTIONS.index(action) == nil
|
97
|
+
if NO_FETCH_ACTIONS.index(action) == nil then
|
114
98
|
repo.stableUpdate()
|
115
99
|
end
|
116
100
|
|
@@ -120,10 +104,10 @@ module GitMaintain
|
|
120
104
|
branch = Branch::load(repo, br, travis, opts[:br_suff])
|
121
105
|
case branch.is_targetted?(opts)
|
122
106
|
when :too_old
|
123
|
-
|
107
|
+
puts "# Skipping older v#{branch.version}"
|
124
108
|
next
|
125
109
|
when :no_match
|
126
|
-
|
110
|
+
puts "# Skipping v#{branch.version} not matching #{opts[:version].to_s()}"
|
127
111
|
next
|
128
112
|
end
|
129
113
|
branch
|
@@ -131,20 +115,16 @@ module GitMaintain
|
|
131
115
|
else
|
132
116
|
branchList = [ Branch::load(repo, opts[:manual_branch], travis, opts[:br_suff]) ]
|
133
117
|
end
|
118
|
+
branchList.each(){|branch|
|
119
|
+
puts "###############################"
|
120
|
+
puts "# Working on #{branch.verbose_name}"
|
121
|
+
puts "###############################"
|
134
122
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
branch.checkout()
|
141
|
-
end
|
142
|
-
branch.send(action, opts)
|
143
|
-
}
|
144
|
-
break if opts[:watch] == false
|
145
|
-
sleep(opts[:watch])
|
146
|
-
travis.emptyCache()
|
147
|
-
end
|
123
|
+
if NO_CHECKOUT_ACTIONS.index(action) == nil then
|
124
|
+
branch.checkout()
|
125
|
+
end
|
126
|
+
branch.send(action, opts)
|
127
|
+
}
|
148
128
|
end
|
149
129
|
|
150
130
|
def initialize(repo, version, travis, branch_suff)
|
@@ -174,10 +154,6 @@ module GitMaintain
|
|
174
154
|
end
|
175
155
|
attr_reader :version, :local_branch, :head, :remote_branch, :remote_ref, :stable_head, :verbose_name
|
176
156
|
|
177
|
-
def log(lvl, str)
|
178
|
-
GitMaintain::log(lvl, str)
|
179
|
-
end
|
180
|
-
|
181
157
|
def is_targetted?(opts)
|
182
158
|
return true if @branch_type == :user_specified
|
183
159
|
if @version.to_i < opts[:base_ver] then
|
@@ -202,8 +178,9 @@ module GitMaintain
|
|
202
178
|
opts[:commits].each(){|commit|
|
203
179
|
@repo.runGit("cherry-pick #{commit}")
|
204
180
|
if $? != 0 then
|
205
|
-
|
206
|
-
@repo.
|
181
|
+
puts "Cherry pick failure. Starting bash for manual fixes. Exit shell to continue"
|
182
|
+
@repo.runSystem("bash")
|
183
|
+
puts "Continuing..."
|
207
184
|
end
|
208
185
|
make_pretty(commit)
|
209
186
|
}
|
@@ -219,8 +196,8 @@ module GitMaintain
|
|
219
196
|
sha = @repo.runGit("rev-parse 'git-maintain/steal/last/#{@stable_base}' 2>&1")
|
220
197
|
if $? == 0 then
|
221
198
|
base_ref=sha
|
222
|
-
|
223
|
-
|
199
|
+
puts "# INFO: Starting from last successfull run:"
|
200
|
+
puts "# INFO: " + @repo.runGit("show --format=oneline #{base_ref}")
|
224
201
|
end
|
225
202
|
end
|
226
203
|
|
@@ -232,9 +209,9 @@ module GitMaintain
|
|
232
209
|
# can just steal from this point on the next run
|
233
210
|
if res == true then
|
234
211
|
@repo.runGit("tag -f 'git-maintain/steal/last/#{@stable_base}' origin/master")
|
235
|
-
|
236
|
-
|
237
|
-
|
212
|
+
puts "# INFO: Marking new last successfull run at:"
|
213
|
+
puts "# INFO: " + @repo.runGit("show --format=oneline #{master_sha}")
|
214
|
+
end
|
238
215
|
end
|
239
216
|
|
240
217
|
# List commits in the branch that are no in the stable branch
|
@@ -249,11 +226,12 @@ module GitMaintain
|
|
249
226
|
if rep == "y" then
|
250
227
|
@repo.runGit("merge #{merge_branch}")
|
251
228
|
if $? != 0 then
|
252
|
-
|
253
|
-
@repo.
|
229
|
+
puts "Merge failure. Starting bash for manual fixes. Exit shell to continue"
|
230
|
+
@repo.runSystem("bash")
|
231
|
+
puts "Continuing..."
|
254
232
|
end
|
255
233
|
else
|
256
|
-
|
234
|
+
puts "Skipping merge"
|
257
235
|
return
|
258
236
|
end
|
259
237
|
end
|
@@ -266,12 +244,7 @@ module GitMaintain
|
|
266
244
|
# Monitor the build status on Travis
|
267
245
|
def monitor(opts)
|
268
246
|
st = @travis.getValidState(head)
|
269
|
-
|
270
|
-
case st
|
271
|
-
when "started"
|
272
|
-
suff= " started at #{@travis.getValidTS(head)}"
|
273
|
-
end
|
274
|
-
log(:INFO, "Status for v#{@version}: " + st + suff)
|
247
|
+
puts "Status for v#{@version}: " + st
|
275
248
|
if st == "failed"
|
276
249
|
rep = "y"
|
277
250
|
suff=""
|
@@ -295,39 +268,21 @@ module GitMaintain
|
|
295
268
|
def push_stable(opts)
|
296
269
|
if (opts[:no_travis] != true && @NO_TRAVIS != true) &&
|
297
270
|
@travis.checkValidState(@head) != true then
|
298
|
-
|
271
|
+
puts "Build is not passed on travis. Skipping push to stable"
|
299
272
|
return
|
300
273
|
end
|
301
|
-
c1=@repo.runGit("rev-parse --verify --quiet #{@local_branch}")
|
302
|
-
c2=@repo.runGit("rev-parse --verify --quiet #{@remote_ref}")
|
303
|
-
if c1 == c2 then
|
304
|
-
log(:INFO, "Stable is already up-to-date")
|
305
|
-
return
|
306
|
-
end
|
307
|
-
|
308
|
-
if opts[:check_only] == true then
|
309
|
-
GitMaintain::checkLog(opts, @local_branch, @remote_ref, "")
|
310
|
-
return
|
311
|
-
end
|
312
|
-
|
313
274
|
rep = GitMaintain::checkLog(opts, @local_branch, @remote_ref, "submit")
|
314
275
|
if rep == "y" then
|
315
276
|
@repo.runGit("push #{@repo.stable_repo} #{@local_branch}:#{@remote_branch}")
|
316
277
|
else
|
317
|
-
|
278
|
+
puts "Skipping push to stable"
|
318
279
|
return
|
319
280
|
end
|
320
281
|
end
|
321
282
|
|
322
283
|
# Monitor the build status of the stable branch on Travis
|
323
284
|
def monitor_stable(opts)
|
324
|
-
|
325
|
-
suff=""
|
326
|
-
case st
|
327
|
-
when "started"
|
328
|
-
suff= " started at #{@travis.getStableTS(@stable_head)}"
|
329
|
-
end
|
330
|
-
log(:INFO, "Status for v#{@version}: " + st + suff)
|
285
|
+
puts "Status for v#{@version}: " + @travis.getStableState(@stable_head)
|
331
286
|
end
|
332
287
|
|
333
288
|
# Reset the branch to the upstream stable one
|
@@ -336,13 +291,13 @@ module GitMaintain
|
|
336
291
|
if rep == "y" then
|
337
292
|
@repo.runGit("reset --hard #{@remote_ref}")
|
338
293
|
else
|
339
|
-
|
294
|
+
puts "Skipping reset"
|
340
295
|
return
|
341
296
|
end
|
342
297
|
end
|
343
298
|
|
344
299
|
def release(opts)
|
345
|
-
|
300
|
+
puts "#No release command available for this repo"
|
346
301
|
end
|
347
302
|
|
348
303
|
private
|
@@ -374,7 +329,7 @@ module GitMaintain
|
|
374
329
|
# This might happen if someone pointed to a commit that doesn't exist in our
|
375
330
|
# tree.
|
376
331
|
if $? != 0 then
|
377
|
-
|
332
|
+
puts "# WARNING: Commit #{src_commit} points to a SHA #{commit} not in tree"
|
378
333
|
return false
|
379
334
|
end
|
380
335
|
|
@@ -466,11 +421,11 @@ module GitMaintain
|
|
466
421
|
def confirm_one(opts, commit)
|
467
422
|
rep=""
|
468
423
|
do_cp=false
|
469
|
-
puts @repo.
|
424
|
+
puts @repo.runGit("show --format=oneline --no-patch --no-decorate #{commit}")
|
470
425
|
while rep != "y" do
|
471
426
|
puts "Do you want to steal this commit ? (y/n/b/?)"
|
472
427
|
if opts[:no] == true then
|
473
|
-
|
428
|
+
puts "Auto-replying no due to --no option"
|
474
429
|
rep = 'n'
|
475
430
|
break
|
476
431
|
else
|
@@ -478,10 +433,10 @@ module GitMaintain
|
|
478
433
|
end
|
479
434
|
case rep
|
480
435
|
when "n"
|
481
|
-
|
436
|
+
puts "Skip this commit"
|
482
437
|
break
|
483
438
|
when "b"
|
484
|
-
|
439
|
+
puts "Blacklisting this commit for the current branch"
|
485
440
|
add_blacklist(commit)
|
486
441
|
break
|
487
442
|
when "y"
|
@@ -491,7 +446,7 @@ module GitMaintain
|
|
491
446
|
when "?"
|
492
447
|
puts @repo.runGit("show #{commit}")
|
493
448
|
else
|
494
|
-
|
449
|
+
STDERR.puts "Invalid answer $rep"
|
495
450
|
puts @repo.runGit("show --format=oneline --no-patch --no-decorate #{commit}")
|
496
451
|
end
|
497
452
|
end
|
@@ -521,8 +476,8 @@ module GitMaintain
|
|
521
476
|
# Check if it's not blacklisted by a git-notes
|
522
477
|
if is_blacklisted?(orig_cmt) == true then
|
523
478
|
# Commit is blacklisted
|
524
|
-
|
525
|
-
@repo.runGit("
|
479
|
+
puts "Skipping 'blacklisted' commit " +
|
480
|
+
@repo.runGit("show --format=oneline --no-patch --no-decorate #{orig_cmt}")
|
526
481
|
return true
|
527
482
|
end
|
528
483
|
|
@@ -532,7 +487,7 @@ module GitMaintain
|
|
532
487
|
begin
|
533
488
|
pick_one(commit)
|
534
489
|
rescue CherryPickErrorException => e
|
535
|
-
|
490
|
+
puts "Cherry pick failed. Fix, commit (or reset) and exit."
|
536
491
|
@repo.runSystem("/bin/bash")
|
537
492
|
return false
|
538
493
|
end
|
@@ -542,7 +497,7 @@ module GitMaintain
|
|
542
497
|
if orig_cmt == "" then
|
543
498
|
msg="Custom"
|
544
499
|
orig_cmt=@repo.runGit("rev-parse HEAD")
|
545
|
-
|
500
|
+
puts "Custom commit, please double-check!"
|
546
501
|
@repo.runSystem("/bin/bash")
|
547
502
|
end
|
548
503
|
make_pretty(orig_cmt, msg)
|
data/lib/common.rb
CHANGED
@@ -6,39 +6,6 @@ require 'branch'
|
|
6
6
|
|
7
7
|
$LOAD_PATH.pop()
|
8
8
|
|
9
|
-
class String
|
10
|
-
# colorization
|
11
|
-
@@is_a_tty = nil
|
12
|
-
def colorize(color_code)
|
13
|
-
@@is_a_tty = STDOUT.isatty() if @@is_a_tty == nil
|
14
|
-
if @@is_a_tty then
|
15
|
-
return "\e[#{color_code}m#{self}\e[0m"
|
16
|
-
else
|
17
|
-
return self
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def red
|
22
|
-
colorize(31)
|
23
|
-
end
|
24
|
-
|
25
|
-
def green
|
26
|
-
colorize(32)
|
27
|
-
end
|
28
|
-
|
29
|
-
def brown
|
30
|
-
colorize(33)
|
31
|
-
end
|
32
|
-
|
33
|
-
def blue
|
34
|
-
colorize(34)
|
35
|
-
end
|
36
|
-
|
37
|
-
def magenta
|
38
|
-
colorize(35)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
9
|
module GitMaintain
|
43
10
|
class Common
|
44
11
|
ACTION_LIST = [ :list_actions ]
|
@@ -51,8 +18,6 @@ module GitMaintain
|
|
51
18
|
ACTION_CLASS = [ Common, Branch, Repo ]
|
52
19
|
@@custom_classes = {}
|
53
20
|
|
54
|
-
@@verbose_log = false
|
55
|
-
|
56
21
|
def registerCustom(repo_name, classes)
|
57
22
|
raise("Multiple class for repo #{repo_name}") if @@custom_classes[repo_name] != nil
|
58
23
|
@@custom_classes[repo_name] = classes
|
@@ -67,10 +32,10 @@ module GitMaintain
|
|
67
32
|
def loadClass(default_class, repo_name, *more)
|
68
33
|
custom = @@custom_classes[repo_name]
|
69
34
|
if custom != nil && custom[default_class] != nil then
|
70
|
-
|
35
|
+
puts "# Detected custom #{default_class} class for repo '#{repo_name}'" if ENV['DEBUG'] == "1"
|
71
36
|
return custom[default_class].new(*more)
|
72
37
|
else
|
73
|
-
|
38
|
+
puts "# Detected NO custom #{default_class} classes for repo '#{repo_name}'" if ENV['DEBUG'] == "1"
|
74
39
|
return default_class.new(*more)
|
75
40
|
end
|
76
41
|
end
|
@@ -145,35 +110,6 @@ module GitMaintain
|
|
145
110
|
end
|
146
111
|
module_function :checkLog
|
147
112
|
|
148
|
-
def _log(lvl, str, out=STDOUT)
|
149
|
-
puts("# " + lvl.to_s() + ": " + str)
|
150
|
-
end
|
151
|
-
module_function :_log
|
152
|
-
|
153
|
-
def log(lvl, str)
|
154
|
-
case lvl
|
155
|
-
when :DEBUG
|
156
|
-
_log("DEBUG".magenta(), str) if ENV["DEBUG"].to_s() != ""
|
157
|
-
when :DEBUG_TRAVIS
|
158
|
-
_log("DEBUG_TRAVIS".magenta(), str) if ENV["DEBUG_TRAVIS"].to_s() != ""
|
159
|
-
when :VERBOSE
|
160
|
-
_log("INFO".blue(), str) if @@verbose_log == true
|
161
|
-
when :INFO
|
162
|
-
_log("INFO".green(), str)
|
163
|
-
when :WARNING
|
164
|
-
_log("WARNING".brown(), str)
|
165
|
-
when :ERROR
|
166
|
-
_log("ERROR".red(), str, STDERR)
|
167
|
-
else
|
168
|
-
_log(lvl, str)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
module_function :log
|
172
|
-
|
173
|
-
def setVerbose(val)
|
174
|
-
@@verbose_log = val
|
175
|
-
end
|
176
|
-
module_function :setVerbose
|
177
113
|
end
|
178
114
|
$LOAD_PATH.pop()
|
179
115
|
|
data/lib/repo.rb
CHANGED
@@ -67,10 +67,6 @@ module GitMaintain
|
|
67
67
|
end
|
68
68
|
attr_reader :path, :remote_valid, :remote_stable, :valid_repo, :stable_repo
|
69
69
|
|
70
|
-
def log(lvl, str)
|
71
|
-
GitMaintain::log(lvl, str)
|
72
|
-
end
|
73
|
-
|
74
70
|
def run(cmd)
|
75
71
|
return `cd #{@path} && #{cmd}`
|
76
72
|
end
|
@@ -78,8 +74,10 @@ module GitMaintain
|
|
78
74
|
return system("cd #{@path} && #{cmd}")
|
79
75
|
end
|
80
76
|
def runGit(cmd)
|
81
|
-
|
82
|
-
|
77
|
+
if ENV["DEBUG"].to_s() != "" then
|
78
|
+
puts "Called from #{caller[1]}"
|
79
|
+
puts "Running git command '#{cmd}'"
|
80
|
+
end
|
83
81
|
return `git --work-tree=#{@path} #{cmd}`.chomp()
|
84
82
|
end
|
85
83
|
def runGitImap(cmd)
|
@@ -92,22 +90,8 @@ module GitMaintain
|
|
92
90
|
fi; git --work-tree=#{@path} imap-send #{cmd}`
|
93
91
|
end
|
94
92
|
|
95
|
-
def runBash()
|
96
|
-
runSystem("bash")
|
97
|
-
if $? == 0 then
|
98
|
-
log(:INFO, "Continuing...")
|
99
|
-
else
|
100
|
-
log(:ERROR, "Shell exited with code #{$?}. Exiting")
|
101
|
-
raise("Cancelled by user")
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def getCommitHeadline(sha)
|
106
|
-
return runGit("show --format=oneline --no-patch --no-decorate #{sha}")
|
107
|
-
end
|
108
|
-
|
109
93
|
def stableUpdate()
|
110
|
-
|
94
|
+
puts "# Fetching stable updates..."
|
111
95
|
runGit("fetch #{@stable_repo}")
|
112
96
|
end
|
113
97
|
def getStableList(br_suff)
|
@@ -141,11 +125,11 @@ module GitMaintain
|
|
141
125
|
|
142
126
|
new_tags = local_tags - remote_tags
|
143
127
|
if new_tags.empty? then
|
144
|
-
|
128
|
+
puts "All tags are already submitted."
|
145
129
|
return
|
146
130
|
end
|
147
131
|
|
148
|
-
|
132
|
+
puts "This will officially release these tags: #{new_tags.join(", ")}"
|
149
133
|
rep = GitMaintain::confirm(opts, "release them")
|
150
134
|
if rep != 'y' then
|
151
135
|
raise "Aborting.."
|
@@ -159,27 +143,11 @@ module GitMaintain
|
|
159
143
|
" <" + runGit("config user.email") +">"
|
160
144
|
mail.puts "To: " + runGit("config patch.target")
|
161
145
|
mail.puts "Date: " + `date -R`.chomp()
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
new_tags.join("\n * ")
|
168
|
-
mail.puts ""
|
169
|
-
else
|
170
|
-
mail.puts "Subject: [ANNOUNCE] " + File.basename(@path) + " " +
|
171
|
-
(new_tags.length > 1 ?
|
172
|
-
(new_tags[0 .. -2].join(", ") + " and " + new_tags[-1] + " have ") :
|
173
|
-
(new_tags.join(" ") + " has ")) +
|
174
|
-
" been tagged/released"
|
175
|
-
mail.puts ""
|
176
|
-
end
|
177
|
-
mail.puts "It's available at the normal places:"
|
178
|
-
mail.puts ""
|
179
|
-
mail.puts "git://github.com/#{@remote_stable}"
|
180
|
-
mail.puts "https://github.com/#{@remote_stable}/releases"
|
181
|
-
mail.puts ""
|
182
|
-
mail.puts "---"
|
146
|
+
mail.puts "Subject: [ANNOUNCE] " + File.basename(@path) + " " +
|
147
|
+
(new_tags.length > 1 ?
|
148
|
+
(new_tags[0 .. -2].join(", ") + " and " + new_tags[-1]) :
|
149
|
+
new_tags.join(" ")) +
|
150
|
+
" has been tagged/released"
|
183
151
|
mail.puts ""
|
184
152
|
mail.puts "Here's the information from the tags:"
|
185
153
|
new_tags.sort().each(){|tag|
|
@@ -195,7 +163,7 @@ module GitMaintain
|
|
195
163
|
puts runGitImap("< #{mail_path}; rm -f #{mail_path}")
|
196
164
|
end
|
197
165
|
|
198
|
-
|
166
|
+
puts "Last chance to cancel before submitting"
|
199
167
|
rep= GitMaintain::confirm(opts, "submit these releases")
|
200
168
|
if rep != 'y' then
|
201
169
|
raise "Aborting.."
|
data/lib/travis.rb
CHANGED
@@ -15,10 +15,6 @@ module GitMaintain
|
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
|
-
def log(lvl, str)
|
19
|
-
GitMaintain::log(lvl, str)
|
20
|
-
end
|
21
|
-
|
22
18
|
def fetch(uri_str, limit = 10)
|
23
19
|
# You should choose a better exception.
|
24
20
|
raise ArgumentError, 'too many HTTP redirects' if limit == 0
|
@@ -39,8 +35,8 @@ module GitMaintain
|
|
39
35
|
return @cachedJson[query_label] if @cachedJson[query_label] != nil
|
40
36
|
url = TRAVIS_URL + query
|
41
37
|
uri = URI(url)
|
42
|
-
|
43
|
-
|
38
|
+
puts "# Querying travis..."
|
39
|
+
puts "# #{url}" if ENV["DEBUG_TRAVIS"].to_s() != ""
|
44
40
|
response = fetch(uri)
|
45
41
|
raise("Travis request failed '#{url}'") if response.code.to_s() != '200'
|
46
42
|
|
@@ -63,11 +59,6 @@ module GitMaintain
|
|
63
59
|
job_id = br["job_ids"].last().to_s()
|
64
60
|
return getJson("log_" + job_id, 'jobs/' + job_id + '/log', false)
|
65
61
|
end
|
66
|
-
def getTS(sha1, resp)
|
67
|
-
br = findBranch(sha1, resp)
|
68
|
-
raise("Travis build not found") if br == nil
|
69
|
-
return br["started_at"]
|
70
|
-
end
|
71
62
|
def checkState(sha1, resp)
|
72
63
|
return getState(sha1, resp) == "passed"
|
73
64
|
end
|
@@ -79,11 +70,11 @@ module GitMaintain
|
|
79
70
|
return getJson(:br_stable, 'repos/' + @repo.remote_stable + '/branches')
|
80
71
|
end
|
81
72
|
def findBranch(sha1, resp)
|
82
|
-
|
73
|
+
puts "# Looking for build for #{sha1}" if ENV["DEBUG_TRAVIS"].to_s() != ""
|
83
74
|
resp["branches"].each(){|br|
|
84
75
|
commit=resp["commits"].select(){|e| e["id"] == br["commit_id"]}.first()
|
85
76
|
raise("Incomplete JSON received from Travis") if commit == nil
|
86
|
-
|
77
|
+
puts "# Found entry for sha #{commit["sha"]}" if ENV["DEBUG_TRAVIS"].to_s() != ""
|
87
78
|
next if commit["sha"] != sha1
|
88
79
|
return br
|
89
80
|
}
|
@@ -100,9 +91,6 @@ module GitMaintain
|
|
100
91
|
def getValidLog(sha1)
|
101
92
|
return getLog(sha1, getBrValidJson())
|
102
93
|
end
|
103
|
-
def getValidTS(sha1)
|
104
|
-
return getTS(sha1, getBrValidJson())
|
105
|
-
end
|
106
94
|
|
107
95
|
def getStableState(sha1)
|
108
96
|
return getState(sha1, getBrStableJson())
|
@@ -113,11 +101,5 @@ module GitMaintain
|
|
113
101
|
def getStableLog(sha1)
|
114
102
|
return getLog(sha1, getBrStableJson())
|
115
103
|
end
|
116
|
-
def getStableTS(sha1)
|
117
|
-
return getTS(sha1, getBrStableJson())
|
118
|
-
end
|
119
|
-
def emptyCache()
|
120
|
-
@cachedJson={}
|
121
|
-
end
|
122
104
|
end
|
123
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-maintain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Morey-Chaisemartin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-release
|
@@ -58,9 +58,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '0'
|
59
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubygems_version: 3.0.2
|
66
66
|
signing_key:
|