git-maintain 0.3.0 → 0.4.0.pre.3.ge7030b9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -0
- data/lib/branch.rb +46 -14
- data/lib/repo.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42036590702a7e9e20d4a04c98ec5eec4acc5595abdb6828a676ec3a0ce235ee
|
4
|
+
data.tar.gz: c107094b1d94181c4f973e0f0e22ac4e28a98b3163222c48659f89ba623fc23d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c46eafa55c9264d8b0c519c060d2778d7f09551a885dc1afdb1b61ee53f48047900ac602f7b7c231bc93310b439bdd79d84540b75430c460777b6532f36c359
|
7
|
+
data.tar.gz: 4c0c3bdd430b6cadd0d430818326ff86606cb62469392f7b7af0bd1fd214fef6097050f76b8c14f51369a1e75530764c6103d90d2926a259e5f6648a5e2bf677
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
|
2
|
+
* Handle bad Fixes tag
|
3
|
+
* Speed up steal feature by remembering last point checked
|
4
|
+
* Add Upstream commit tag when cherry picking commits
|
5
|
+
|
6
|
+
------------------
|
7
|
+
0.4.0 (2018-10-15)
|
8
|
+
------------------
|
9
|
+
|
10
|
+
* Fix gemspec generation date
|
11
|
+
* Fix cp command
|
12
|
+
|
1
13
|
------------------
|
2
14
|
0.3.0 (2018-10-09)
|
3
15
|
------------------
|
data/lib/branch.rb
CHANGED
@@ -73,6 +73,11 @@ module GitMaintain
|
|
73
73
|
optsParser.banner += "[-T]"
|
74
74
|
optsParser.on("-T", "--no-travis", "Ignore Travis build status and push anyway.") {
|
75
75
|
|val| opts[:no_travis] = true}
|
76
|
+
when :steal
|
77
|
+
optsParser.banner += "[-a]"
|
78
|
+
optsParser.on("-a", "--all", "Check all commits from master. "+
|
79
|
+
"By default only new commits (since last successful run) are considered.") {
|
80
|
+
|val| opts[:all] = true}
|
76
81
|
end
|
77
82
|
end
|
78
83
|
|
@@ -169,20 +174,44 @@ module GitMaintain
|
|
169
174
|
end
|
170
175
|
|
171
176
|
# Cherry pick an array of commits
|
172
|
-
def
|
173
|
-
|
174
|
-
@repo.runGit("cherry-pick #{
|
177
|
+
def cp(opts)
|
178
|
+
opts[:commits].each(){|commit|
|
179
|
+
@repo.runGit("cherry-pick #{commit}")
|
175
180
|
if $? != 0 then
|
176
181
|
puts "Cherry pick failure. Starting bash for manual fixes. Exit shell to continue"
|
177
182
|
@repo.runSystem("bash")
|
178
183
|
puts "Continuing..."
|
179
184
|
end
|
180
|
-
|
185
|
+
make_pretty(commit)
|
186
|
+
}
|
181
187
|
end
|
182
188
|
|
183
189
|
# Steal upstream commits that are not in the branch
|
184
190
|
def steal(opts)
|
185
|
-
|
191
|
+
base_ref=@stable_base
|
192
|
+
|
193
|
+
# If we are not force checking everything,
|
194
|
+
# try to start from the last tag we steal upto
|
195
|
+
if opts[:all] != true then
|
196
|
+
sha = @repo.runGit("rev-parse 'git-maintain/steal/last/#{@stable_base}' 2>&1")
|
197
|
+
if $? == 0 then
|
198
|
+
base_ref=sha
|
199
|
+
puts "# INFO: Starting from last successfull run:"
|
200
|
+
puts "# INFO: " + @repo.runGit("show --format=oneline #{base_ref}")
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
master_sha=@repo.runGit("rev-parse origin/master")
|
205
|
+
res = steal_all(opts, "#{base_ref}..#{master_sha}")
|
206
|
+
|
207
|
+
# If we picked all the commits (or nothing happened)
|
208
|
+
# Mark the current master as the last checked point so we
|
209
|
+
# can just steal from this point on the next run
|
210
|
+
if res == true then
|
211
|
+
@repo.runGit("tag -f 'git-maintain/steal/last/#{@stable_base}' origin/master")
|
212
|
+
puts "# INFO: Marking new last successfull run at:"
|
213
|
+
puts "# INFO: " + @repo.runGit("show --format=oneline #{master_sha}")
|
214
|
+
end
|
186
215
|
end
|
187
216
|
|
188
217
|
# List commits in the branch that are no in the stable branch
|
@@ -295,11 +324,12 @@ module GitMaintain
|
|
295
324
|
`rm -f #{msg_path}`
|
296
325
|
end
|
297
326
|
|
298
|
-
def is_in_tree?(commit)
|
299
|
-
fullhash=@repo.runGit("rev-parse #{commit}")
|
327
|
+
def is_in_tree?(commit, src_commit=commit)
|
328
|
+
fullhash=@repo.runGit("rev-parse --verify --quiet #{commit}")
|
300
329
|
# This might happen if someone pointed to a commit that doesn't exist in our
|
301
330
|
# tree.
|
302
331
|
if $? != 0 then
|
332
|
+
puts "# WARNING: Commit #{src_commit} points to a SHA #{commit} not in tree"
|
303
333
|
return false
|
304
334
|
end
|
305
335
|
|
@@ -335,7 +365,7 @@ module GitMaintain
|
|
335
365
|
# If this commit fixes anything, but the broken commit isn't in our branch we don't
|
336
366
|
# need this commit either.
|
337
367
|
if fixescmt != "" then
|
338
|
-
if is_in_tree?(fixescmt) then
|
368
|
+
if is_in_tree?(fixescmt, commit) then
|
339
369
|
return true
|
340
370
|
else
|
341
371
|
return false
|
@@ -435,12 +465,12 @@ module GitMaintain
|
|
435
465
|
|
436
466
|
# If the commit doesn't apply for us, skip it
|
437
467
|
if is_relevant?(orig_cmt) != true
|
438
|
-
return
|
468
|
+
return true
|
439
469
|
end
|
440
470
|
|
441
471
|
if is_in_tree?(orig_cmt) == true
|
442
472
|
# Commit is already in the stable branch, skip
|
443
|
-
return
|
473
|
+
return true
|
444
474
|
end
|
445
475
|
|
446
476
|
# Check if it's not blacklisted by a git-notes
|
@@ -448,18 +478,18 @@ module GitMaintain
|
|
448
478
|
# Commit is blacklisted
|
449
479
|
puts "Skipping 'blacklisted' commit " +
|
450
480
|
@repo.runGit("show --format=oneline --no-patch --no-decorate #{orig_cmt}")
|
451
|
-
return
|
481
|
+
return true
|
452
482
|
end
|
453
483
|
|
454
484
|
do_cp = confirm_one(opts, orig_cmt)
|
455
|
-
return if do_cp != true
|
485
|
+
return false if do_cp != true
|
456
486
|
|
457
487
|
begin
|
458
488
|
pick_one(commit)
|
459
489
|
rescue CherryPickErrorException => e
|
460
490
|
puts "Cherry pick failed. Fix, commit (or reset) and exit."
|
461
491
|
@repo.runSystem("/bin/bash")
|
462
|
-
return
|
492
|
+
return false
|
463
493
|
end
|
464
494
|
|
465
495
|
# If we didn't find the commit upstream then this must be a custom commit
|
@@ -474,9 +504,11 @@ module GitMaintain
|
|
474
504
|
end
|
475
505
|
|
476
506
|
def steal_all(opts, range)
|
507
|
+
res = true
|
477
508
|
@repo.runGit("log --no-merges --format=\"%H\" #{range} | tac").split("\n").each(){|commit|
|
478
|
-
steal_one(opts, commit)
|
509
|
+
res &= steal_one(opts, commit)
|
479
510
|
}
|
511
|
+
return res
|
480
512
|
end
|
481
513
|
end
|
482
514
|
end
|
data/lib/repo.rb
CHANGED
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.3.
|
4
|
+
version: 0.4.0.pre.3.ge7030b9
|
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:
|
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,12 +58,11 @@ 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: 1.3.1
|
64
64
|
requirements: []
|
65
|
-
|
66
|
-
rubygems_version: 2.7.7
|
65
|
+
rubygems_version: 3.0.2
|
67
66
|
signing_key:
|
68
67
|
specification_version: 4
|
69
68
|
summary: Your ultimate script for maintaining stable branches.
|