git-maintain 0.2.2.pre.25.gb2af5c1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1 -10
- data/README.md +1 -3
- data/git-maintain-completion.sh +0 -7
- data/lib/branch.rb +22 -44
- data/lib/repo.rb +39 -47
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bde61f3ac980a295c32bbb076a99176d6d93cd82972d7ce8da69954958bfc056
|
4
|
+
data.tar.gz: 266b8df2a5de8795850c70a9b89dbac008d613ac688ee4e3cfd41c4a90895d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f62502f4308c146bbb87411e3fdb9c397b38f23b5c8e206e836b971e518d0670173af4682d17f4fd96bdac2aa02875c63fb9cf8ae093782bc114712d6cc2f764
|
7
|
+
data.tar.gz: 63e7f063e94f6586dbb5d2c1d747ba16851b58a17c7c095e132e520c8a56b439ac9a857731a0e6d3c22c8c0fe8db472f830fa3ea09df9cb569a07e293c5a6bf3
|
data/CHANGELOG
CHANGED
@@ -1,16 +1,7 @@
|
|
1
1
|
------------------
|
2
|
-
0.3
|
2
|
+
0.2.3
|
3
3
|
------------------
|
4
4
|
|
5
|
-
* Fix support for commit messages containing double quotes
|
6
|
-
* Fix --base-version and --branch-suffix
|
7
|
-
* Add completion support for --version
|
8
|
-
* Fix --no-travis
|
9
|
-
* Customizable behaviour for travis/emails in Addons
|
10
|
-
* Allow branch action to be run on user-specified branches (instead of the stable pattern)
|
11
|
-
* Add hpc-testing addon
|
12
|
-
* Add git-maintain addon
|
13
|
-
|
14
5
|
------------------
|
15
6
|
0.2.2 (2018-07-13)
|
16
7
|
------------------
|
data/README.md
CHANGED
@@ -27,11 +27,9 @@ The idea is to script most of the maintenance tasks so the maintainer can focus
|
|
27
27
|
- Load git-maintain-completion.sh for shell completion
|
28
28
|
|
29
29
|
## Remote setup
|
30
|
-
- the 'github' remote should be your own WIP github to test out branches before submitting to the official repo
|
31
|
-
Also know as the 'Validation' repo. It can be switched to another remote by setting maintain.valid-repo=xxx in your gitconfig
|
30
|
+
- the 'github' remote should be your own WIP github to test out branches before submitting to the official repo
|
32
31
|
- the 'origin' remote should be the official repo in read-only mode to avoid any accidental pushes
|
33
32
|
- the 'stable' remote should be the official repo in RW mode
|
34
|
-
Also know as the 'Stable' repo. It can be switched to another remote by setting maintain.stable-repo=xxx in your gitconfig
|
35
33
|
|
36
34
|
## Stealing commits
|
37
35
|
|
data/git-maintain-completion.sh
CHANGED
@@ -22,10 +22,6 @@ _complete_git_maintain_branch(){
|
|
22
22
|
BRANCHES=
|
23
23
|
__gitcomp_nl "$(git maintain list_branches)"
|
24
24
|
;;
|
25
|
-
-V|--version)
|
26
|
-
# Extra arg expected but not completable
|
27
|
-
__gitcomp_nl ""
|
28
|
-
;;
|
29
25
|
esac
|
30
26
|
}
|
31
27
|
|
@@ -92,9 +88,6 @@ _git_maintain(){
|
|
92
88
|
case "$prev" in
|
93
89
|
*)
|
94
90
|
__gitcomp_nl "$OPT_LIST"
|
95
|
-
# Override default completion with specific branch completion (if it matches)
|
96
|
-
_complete_git_maintain_branch
|
97
|
-
|
98
91
|
esac
|
99
92
|
fi
|
100
93
|
fi
|
data/lib/branch.rb
CHANGED
@@ -52,10 +52,6 @@ module GitMaintain
|
|
52
52
|
optsParser.on("-V", "--version [regexp]", Regexp, "Regexp to filter versions.") {
|
53
53
|
|val| opts[:version] = val}
|
54
54
|
|
55
|
-
if action != :merge
|
56
|
-
optsParser.on("-B", "--manual-branch <branch name>", "Work on a specific (non-stable) branch.") {
|
57
|
-
|val| opts[:manual_branch] = val}
|
58
|
-
end
|
59
55
|
case action
|
60
56
|
when :cp
|
61
57
|
optsParser.banner += "-c <sha1> [-c <sha1> ...]"
|
@@ -72,7 +68,7 @@ module GitMaintain
|
|
72
68
|
when :push_stable
|
73
69
|
optsParser.banner += "[-T]"
|
74
70
|
optsParser.on("-T", "--no-travis", "Ignore Travis build status and push anyway.") {
|
75
|
-
|val| opts[:no_travis] =
|
71
|
+
|val| opts[:no_travis] = val}
|
76
72
|
end
|
77
73
|
end
|
78
74
|
|
@@ -93,26 +89,19 @@ module GitMaintain
|
|
93
89
|
repo.stableUpdate()
|
94
90
|
end
|
95
91
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
108
|
-
branch
|
109
|
-
}.compact()
|
110
|
-
else
|
111
|
-
branchList = [ Branch::load(repo, opts[:manual_branch], travis, opts[:br_suff]) ]
|
112
|
-
end
|
113
|
-
branchList.each(){|branch|
|
92
|
+
repo.getStableList(opts[:br_suff]).each(){|br|
|
93
|
+
branch = Branch::load(repo, br, travis, opts[:br_suff])
|
94
|
+
case branch.is_targetted?(opts)
|
95
|
+
when :too_old
|
96
|
+
puts "# Skipping older v#{branch.version}"
|
97
|
+
next
|
98
|
+
when :no_match
|
99
|
+
puts "# Skipping v#{branch.version} not matching #{opts[:version].to_s()}"
|
100
|
+
next
|
101
|
+
end
|
102
|
+
|
114
103
|
puts "###############################"
|
115
|
-
puts "# Working on #{branch.
|
104
|
+
puts "# Working on v#{branch.version}"
|
116
105
|
puts "###############################"
|
117
106
|
|
118
107
|
if NO_CHECKOUT_ACTIONS.index(action) == nil then
|
@@ -126,31 +115,21 @@ module GitMaintain
|
|
126
115
|
GitMaintain::checkDirectConstructor(self.class)
|
127
116
|
|
128
117
|
@repo = repo
|
129
|
-
@travis = travis
|
130
118
|
@version = version
|
119
|
+
@travis = travis
|
131
120
|
@branch_suff = branch_suff
|
132
121
|
|
133
|
-
|
134
|
-
@local_branch = "dev/stable-v#{@version}/#{@branch_suff}"
|
135
|
-
@remote_branch ="stable-v#{@version}"
|
136
|
-
@branch_type = :std
|
137
|
-
@verbose_name = "v"+version
|
138
|
-
else
|
139
|
-
@remote_branch = @local_branch = version
|
140
|
-
@branch_type = :user_specified
|
141
|
-
@verbose_name = version
|
142
|
-
end
|
143
|
-
|
122
|
+
@local_branch = "dev/stable-v#{@version}/#{@branch_suff}"
|
144
123
|
@head = @repo.runGit("rev-parse #{@local_branch}")
|
145
|
-
|
124
|
+
|
125
|
+
@remote_branch ="stable-v#{@version}"
|
126
|
+
@remote_ref = "#{Repo::STABLE_REPO}/#{@remote_branch}"
|
146
127
|
@stable_head = @repo.runGit("rev-parse #{@remote_ref}")
|
147
128
|
@stable_base = @repo.findStableBase(@local_branch)
|
148
|
-
|
149
129
|
end
|
150
|
-
attr_reader :version, :local_branch, :head, :remote_branch, :remote_ref, :stable_head
|
130
|
+
attr_reader :version, :local_branch, :head, :remote_branch, :remote_ref, :stable_head
|
151
131
|
|
152
132
|
def is_targetted?(opts)
|
153
|
-
return true if @branch_type == :user_specified
|
154
133
|
if @version.to_i < opts[:base_ver] then
|
155
134
|
return :too_old
|
156
135
|
end
|
@@ -209,7 +188,7 @@ module GitMaintain
|
|
209
188
|
|
210
189
|
# Push the branch to the validation repo
|
211
190
|
def push(opts)
|
212
|
-
@repo.runGit("push #{opts[:push_force] == true ? "-f" : ""} #{
|
191
|
+
@repo.runGit("push #{opts[:push_force] == true ? "-f" : ""} #{Repo::VALID_REPO} #{@local_branch}")
|
213
192
|
end
|
214
193
|
|
215
194
|
# Monitor the build status on Travis
|
@@ -237,14 +216,14 @@ module GitMaintain
|
|
237
216
|
|
238
217
|
# Push branch to the stable repo
|
239
218
|
def push_stable(opts)
|
240
|
-
if
|
219
|
+
if opts[:no_travis] != true &&
|
241
220
|
@travis.checkValidState(@head) != true then
|
242
221
|
puts "Build is not passed on travis. Skipping push to stable"
|
243
222
|
return
|
244
223
|
end
|
245
224
|
rep = GitMaintain::checkLog(opts, @local_branch, @remote_ref, "submit")
|
246
225
|
if rep == "y" then
|
247
|
-
@repo.runGit("push #{
|
226
|
+
@repo.runGit("push #{Repo::STABLE_REPO} #{@local_branch}:#{@remote_branch}")
|
248
227
|
else
|
249
228
|
puts "Skipping push to stable"
|
250
229
|
return
|
@@ -425,7 +404,6 @@ module GitMaintain
|
|
425
404
|
|
426
405
|
def steal_one(opts, commit)
|
427
406
|
subj=@repo.runGit("log -1 --format=\"%s\" #{commit}")
|
428
|
-
subj.gsub!(/"/, '\"')
|
429
407
|
msg=''
|
430
408
|
|
431
409
|
# Let's grab the mainline commit id, this is useful if the version tag
|
data/lib/repo.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module GitMaintain
|
2
2
|
class Repo
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
VALID_REPO = "github"
|
4
|
+
STABLE_REPO = "stable"
|
5
|
+
SUBMIT_BINARY="git-release"
|
6
6
|
|
7
7
|
ACTION_LIST = [
|
8
8
|
:list_branches,
|
@@ -47,16 +47,10 @@ module GitMaintain
|
|
47
47
|
if path == nil
|
48
48
|
@path = Dir.pwd()
|
49
49
|
end
|
50
|
-
|
51
|
-
|
52
|
-
@
|
53
|
-
|
54
|
-
@stable_repo = @@STABLE_REPO if @stable_repo == ""
|
55
|
-
|
56
|
-
@remote_valid=runGit("remote -v | egrep '^#{@valid_repo}' | grep fetch |
|
57
|
-
awk '{ print $2}' | sed -e 's/.*://' -e 's/\\.git//'")
|
58
|
-
@remote_stable=runGit("remote -v | egrep '^#{@stable_repo}' | grep fetch |
|
59
|
-
awk '{ print $2}' | sed -e 's/.*://' -e 's/\\.git//'")
|
50
|
+
@remote_valid=runGit("remote -v | egrep '^#{VALID_REPO}' | grep fetch |
|
51
|
+
awk '{ print $2}' | sed -e 's/.*://' -e 's/\.git//'")
|
52
|
+
@remote_stable=runGit("remote -v | egrep '^#{STABLE_REPO}' | grep fetch |
|
53
|
+
awk '{ print $2}' | sed -e 's/.*://' -e 's/\.git//'")
|
60
54
|
@stable_base_patterns=
|
61
55
|
runGit("config --get-regexp stable-base | egrep '^stable-base\.' | "+
|
62
56
|
"sed -e 's/stable-base\.//' -e 's/---/\\//g'").split("\n").inject({}){ |m, x|
|
@@ -65,7 +59,7 @@ module GitMaintain
|
|
65
59
|
m
|
66
60
|
}
|
67
61
|
end
|
68
|
-
attr_reader :path, :remote_valid, :remote_stable
|
62
|
+
attr_reader :path, :remote_valid, :remote_stable
|
69
63
|
|
70
64
|
def run(cmd)
|
71
65
|
return `cd #{@path} && #{cmd}`
|
@@ -92,7 +86,7 @@ module GitMaintain
|
|
92
86
|
|
93
87
|
def stableUpdate()
|
94
88
|
puts "# Fetching stable updates..."
|
95
|
-
runGit("fetch #{
|
89
|
+
runGit("fetch #{STABLE_REPO}")
|
96
90
|
end
|
97
91
|
def getStableList(br_suff)
|
98
92
|
return @stable_list if @stable_list != nil
|
@@ -116,8 +110,8 @@ module GitMaintain
|
|
116
110
|
return @suffix_list
|
117
111
|
end
|
118
112
|
|
119
|
-
def submitReleases(
|
120
|
-
remote_tags=runGit("ls-remote --tags #{
|
113
|
+
def submitReleases()
|
114
|
+
remote_tags=runGit("ls-remote --tags #{STABLE_REPO} |
|
121
115
|
egrep 'refs/tags/v[0-9.]*$'").split("\n").map(){
|
122
116
|
|x| x.gsub(/.*refs\/tags\//, '')
|
123
117
|
}
|
@@ -130,49 +124,47 @@ module GitMaintain
|
|
130
124
|
end
|
131
125
|
|
132
126
|
puts "This will officially release these tags: #{new_tags.join(", ")}"
|
133
|
-
rep = GitMaintain::confirm(
|
127
|
+
rep = GitMaintain::confirm("release them")
|
134
128
|
if rep != 'y' then
|
135
129
|
raise "Aborting.."
|
136
130
|
end
|
137
131
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
mail.puts `git show #{tag} --no-decorate -q | awk '!p;/^-----END PGP SIGNATURE-----/{p=1}'`
|
155
|
-
mail.puts ""
|
156
|
-
}
|
157
|
-
mail.puts "It's available at the normal places:"
|
132
|
+
mail_path=`mktemp`.chomp()
|
133
|
+
mail = File.open(mail_path, "w+")
|
134
|
+
mail.puts "From " + runGit("rev-parse HEAD") + " " + `date`.chomp()
|
135
|
+
mail.puts "From: " + runGit("config user.name") +
|
136
|
+
" <" + runGit("config user.email") +">"
|
137
|
+
mail.puts "To: " + runGit("config patch.target")
|
138
|
+
mail.puts "Date: " + `date -R`.chomp()
|
139
|
+
mail.puts "Subject: [ANNOUNCE] " + File.basename(@path) + " " +
|
140
|
+
(new_tags.length > 1 ?
|
141
|
+
(new_tags[0 .. -2].join(", ") + " and " + new_tags[-1]) :
|
142
|
+
new_tags.join(" ")) +
|
143
|
+
" has been tagged/released"
|
144
|
+
mail.puts ""
|
145
|
+
mail.puts "Here's the information from the tags:"
|
146
|
+
new_tags.sort().each(){|tag|
|
147
|
+
mail.puts `git show #{tag} --no-decorate -q | awk '!p;/^-----END PGP SIGNATURE-----/{p=1}'`
|
158
148
|
mail.puts ""
|
159
|
-
|
160
|
-
|
161
|
-
|
149
|
+
}
|
150
|
+
mail.puts "It's available at the normal places:"
|
151
|
+
mail.puts ""
|
152
|
+
mail.puts "git://github.com/#{@remote_stable}"
|
153
|
+
mail.puts "https://github.com/#{@remote_stable}/releases"
|
154
|
+
mail.close()
|
162
155
|
|
163
|
-
|
164
|
-
end
|
156
|
+
puts runGitImap("< #{mail_path}; rm -f #{mail_path}")
|
165
157
|
|
166
158
|
puts "Last chance to cancel before submitting"
|
167
|
-
rep= GitMaintain::confirm(
|
159
|
+
rep= GitMaintain::confirm("submit these releases")
|
168
160
|
if rep != 'y' then
|
169
161
|
raise "Aborting.."
|
170
162
|
end
|
171
|
-
puts `#{
|
163
|
+
puts `#{SUBMIT_BINARY}`
|
172
164
|
end
|
173
165
|
def findStableBase(branch)
|
174
166
|
@stable_base_patterns.each(){|pattern, base|
|
175
|
-
return base if branch =~ /#{pattern}\//
|
167
|
+
return base if branch =~ /#{pattern}\//
|
176
168
|
}
|
177
169
|
raise("Could not a find a stable base for branch #{branch}")
|
178
170
|
end
|
@@ -184,7 +176,7 @@ module GitMaintain
|
|
184
176
|
puts getSuffixList()
|
185
177
|
end
|
186
178
|
def submit_release(opts)
|
187
|
-
submitReleases(
|
179
|
+
submitReleases()
|
188
180
|
end
|
189
181
|
end
|
190
182
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-maintain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.2
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Morey-Chaisemartin
|
@@ -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
|
rubyforge_project:
|
66
66
|
rubygems_version: 2.7.7
|