git-maintain 0.2.2 → 0.3.0.pre.1.g1a642bd

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bde61f3ac980a295c32bbb076a99176d6d93cd82972d7ce8da69954958bfc056
4
- data.tar.gz: 266b8df2a5de8795850c70a9b89dbac008d613ac688ee4e3cfd41c4a90895d01
3
+ metadata.gz: 3736d70d8ba754254761b261f65238c26320df32f499c971e62d5f7acd842a08
4
+ data.tar.gz: 207d7dee75515e33f0d037e07ddc201c79e5569c1b89ae9eae71ab0cb7a462f6
5
5
  SHA512:
6
- metadata.gz: f62502f4308c146bbb87411e3fdb9c397b38f23b5c8e206e836b971e518d0670173af4682d17f4fd96bdac2aa02875c63fb9cf8ae093782bc114712d6cc2f764
7
- data.tar.gz: 63e7f063e94f6586dbb5d2c1d747ba16851b58a17c7c095e132e520c8a56b439ac9a857731a0e6d3c22c8c0fe8db472f830fa3ea09df9cb569a07e293c5a6bf3
6
+ metadata.gz: 1a7470336d22ffa4d07fe1c7f11a2b4ff106a9998ace56651357ac668f8c1c7d841f35bf4677a22362b3c70e2b445f387a76329a40cf191a6c383bb329160e9a
7
+ data.tar.gz: ed6431e72b31d0a6853e8044db92d7380d59d1c088f83ec93eb622eab579c6092a46003c088559d45a2b0754bbd8e0522fca5e6f8525a478488168eb4815adf0
data/CHANGELOG CHANGED
@@ -1,7 +1,18 @@
1
+ * Fix gemspec generation date
2
+
1
3
  ------------------
2
- 0.2.3
4
+ 0.3.0 (2018-10-09)
3
5
  ------------------
4
6
 
7
+ * Fix support for commit messages containing double quotes
8
+ * Fix --base-version and --branch-suffix
9
+ * Add completion support for --version
10
+ * Fix --no-travis
11
+ * Customizable behaviour for travis/emails in Addons
12
+ * Allow branch action to be run on user-specified branches (instead of the stable pattern)
13
+ * Add hpc-testing addon
14
+ * Add git-maintain addon
15
+
5
16
  ------------------
6
17
  0.2.2 (2018-07-13)
7
18
  ------------------
data/README.md CHANGED
@@ -27,9 +27,11 @@ 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
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
31
32
  - the 'origin' remote should be the official repo in read-only mode to avoid any accidental pushes
32
33
  - 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
33
35
 
34
36
  ## Stealing commits
35
37
 
@@ -22,6 +22,10 @@ _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
+ ;;
25
29
  esac
26
30
  }
27
31
 
@@ -88,6 +92,9 @@ _git_maintain(){
88
92
  case "$prev" in
89
93
  *)
90
94
  __gitcomp_nl "$OPT_LIST"
95
+ # Override default completion with specific branch completion (if it matches)
96
+ _complete_git_maintain_branch
97
+
91
98
  esac
92
99
  fi
93
100
  fi
data/lib/branch.rb CHANGED
@@ -52,6 +52,10 @@ 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
55
59
  case action
56
60
  when :cp
57
61
  optsParser.banner += "-c <sha1> [-c <sha1> ...]"
@@ -68,7 +72,7 @@ module GitMaintain
68
72
  when :push_stable
69
73
  optsParser.banner += "[-T]"
70
74
  optsParser.on("-T", "--no-travis", "Ignore Travis build status and push anyway.") {
71
- |val| opts[:no_travis] = val}
75
+ |val| opts[:no_travis] = true}
72
76
  end
73
77
  end
74
78
 
@@ -89,19 +93,26 @@ module GitMaintain
89
93
  repo.stableUpdate()
90
94
  end
91
95
 
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
-
96
+ branchList=[]
97
+ if opts[:manual_branch] == nil then
98
+ branchList = repo.getStableList(opts[:br_suff]).map(){|br|
99
+ branch = Branch::load(repo, br, travis, opts[:br_suff])
100
+ case branch.is_targetted?(opts)
101
+ when :too_old
102
+ puts "# Skipping older v#{branch.version}"
103
+ next
104
+ when :no_match
105
+ puts "# Skipping v#{branch.version} not matching #{opts[:version].to_s()}"
106
+ next
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|
103
114
  puts "###############################"
104
- puts "# Working on v#{branch.version}"
115
+ puts "# Working on #{branch.verbose_name}"
105
116
  puts "###############################"
106
117
 
107
118
  if NO_CHECKOUT_ACTIONS.index(action) == nil then
@@ -115,21 +126,31 @@ module GitMaintain
115
126
  GitMaintain::checkDirectConstructor(self.class)
116
127
 
117
128
  @repo = repo
118
- @version = version
119
129
  @travis = travis
130
+ @version = version
120
131
  @branch_suff = branch_suff
121
132
 
122
- @local_branch = "dev/stable-v#{@version}/#{@branch_suff}"
123
- @head = @repo.runGit("rev-parse #{@local_branch}")
133
+ if version =~ /^[0-9]+$/
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
124
143
 
125
- @remote_branch ="stable-v#{@version}"
126
- @remote_ref = "#{Repo::STABLE_REPO}/#{@remote_branch}"
144
+ @head = @repo.runGit("rev-parse #{@local_branch}")
145
+ @remote_ref = "#{@repo.stable_repo}/#{@remote_branch}"
127
146
  @stable_head = @repo.runGit("rev-parse #{@remote_ref}")
128
147
  @stable_base = @repo.findStableBase(@local_branch)
148
+
129
149
  end
130
- attr_reader :version, :local_branch, :head, :remote_branch, :remote_ref, :stable_head
150
+ attr_reader :version, :local_branch, :head, :remote_branch, :remote_ref, :stable_head, :verbose_name
131
151
 
132
152
  def is_targetted?(opts)
153
+ return true if @branch_type == :user_specified
133
154
  if @version.to_i < opts[:base_ver] then
134
155
  return :too_old
135
156
  end
@@ -188,7 +209,7 @@ module GitMaintain
188
209
 
189
210
  # Push the branch to the validation repo
190
211
  def push(opts)
191
- @repo.runGit("push #{opts[:push_force] == true ? "-f" : ""} #{Repo::VALID_REPO} #{@local_branch}")
212
+ @repo.runGit("push #{opts[:push_force] == true ? "-f" : ""} #{@repo.valid_repo} #{@local_branch}")
192
213
  end
193
214
 
194
215
  # Monitor the build status on Travis
@@ -216,14 +237,14 @@ module GitMaintain
216
237
 
217
238
  # Push branch to the stable repo
218
239
  def push_stable(opts)
219
- if opts[:no_travis] != true &&
240
+ if (opts[:no_travis] != true && @NO_TRAVIS != true) &&
220
241
  @travis.checkValidState(@head) != true then
221
242
  puts "Build is not passed on travis. Skipping push to stable"
222
243
  return
223
244
  end
224
245
  rep = GitMaintain::checkLog(opts, @local_branch, @remote_ref, "submit")
225
246
  if rep == "y" then
226
- @repo.runGit("push #{Repo::STABLE_REPO} #{@local_branch}:#{@remote_branch}")
247
+ @repo.runGit("push #{@repo.stable_repo} #{@local_branch}:#{@remote_branch}")
227
248
  else
228
249
  puts "Skipping push to stable"
229
250
  return
@@ -404,6 +425,7 @@ module GitMaintain
404
425
 
405
426
  def steal_one(opts, commit)
406
427
  subj=@repo.runGit("log -1 --format=\"%s\" #{commit}")
428
+ subj.gsub!(/"/, '\"')
407
429
  msg=''
408
430
 
409
431
  # 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
- VALID_REPO = "github"
4
- STABLE_REPO = "stable"
5
- SUBMIT_BINARY="git-release"
3
+ @@VALID_REPO = "github"
4
+ @@STABLE_REPO = "stable"
5
+ @@SUBMIT_BINARY="git-release"
6
6
 
7
7
  ACTION_LIST = [
8
8
  :list_branches,
@@ -47,10 +47,16 @@ module GitMaintain
47
47
  if path == nil
48
48
  @path = Dir.pwd()
49
49
  end
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//'")
50
+
51
+ @valid_repo = runGit("config maintain.valid-repo 2> /dev/null").chomp()
52
+ @valid_repo = @@VALID_REPO if @valid_repo == ""
53
+ @stable_repo = runGit("config maintain.stable-repo 2>/dev/null").chomp()
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//'")
54
60
  @stable_base_patterns=
55
61
  runGit("config --get-regexp stable-base | egrep '^stable-base\.' | "+
56
62
  "sed -e 's/stable-base\.//' -e 's/---/\\//g'").split("\n").inject({}){ |m, x|
@@ -59,7 +65,7 @@ module GitMaintain
59
65
  m
60
66
  }
61
67
  end
62
- attr_reader :path, :remote_valid, :remote_stable
68
+ attr_reader :path, :remote_valid, :remote_stable, :valid_repo, :stable_repo
63
69
 
64
70
  def run(cmd)
65
71
  return `cd #{@path} && #{cmd}`
@@ -86,7 +92,7 @@ module GitMaintain
86
92
 
87
93
  def stableUpdate()
88
94
  puts "# Fetching stable updates..."
89
- runGit("fetch #{STABLE_REPO}")
95
+ runGit("fetch #{@stable_repo}")
90
96
  end
91
97
  def getStableList(br_suff)
92
98
  return @stable_list if @stable_list != nil
@@ -110,8 +116,8 @@ module GitMaintain
110
116
  return @suffix_list
111
117
  end
112
118
 
113
- def submitReleases()
114
- remote_tags=runGit("ls-remote --tags #{STABLE_REPO} |
119
+ def submitReleases(opts)
120
+ remote_tags=runGit("ls-remote --tags #{@stable_repo} |
115
121
  egrep 'refs/tags/v[0-9.]*$'").split("\n").map(){
116
122
  |x| x.gsub(/.*refs\/tags\//, '')
117
123
  }
@@ -124,47 +130,49 @@ module GitMaintain
124
130
  end
125
131
 
126
132
  puts "This will officially release these tags: #{new_tags.join(", ")}"
127
- rep = GitMaintain::confirm("release them")
133
+ rep = GitMaintain::confirm(opts, "release them")
128
134
  if rep != 'y' then
129
135
  raise "Aborting.."
130
136
  end
131
137
 
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}'`
138
+ if @NOTIFY_RELEASE != false
139
+ mail_path=`mktemp`.chomp()
140
+ mail = File.open(mail_path, "w+")
141
+ mail.puts "From " + runGit("rev-parse HEAD") + " " + `date`.chomp()
142
+ mail.puts "From: " + runGit("config user.name") +
143
+ " <" + runGit("config user.email") +">"
144
+ mail.puts "To: " + runGit("config patch.target")
145
+ mail.puts "Date: " + `date -R`.chomp()
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"
148
151
  mail.puts ""
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()
152
+ mail.puts "Here's the information from the tags:"
153
+ new_tags.sort().each(){|tag|
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:"
158
+ mail.puts ""
159
+ mail.puts "git://github.com/#{@remote_stable}"
160
+ mail.puts "https://github.com/#{@remote_stable}/releases"
161
+ mail.close()
155
162
 
156
- puts runGitImap("< #{mail_path}; rm -f #{mail_path}")
163
+ puts runGitImap("< #{mail_path}; rm -f #{mail_path}")
164
+ end
157
165
 
158
166
  puts "Last chance to cancel before submitting"
159
- rep= GitMaintain::confirm("submit these releases")
167
+ rep= GitMaintain::confirm(opts, "submit these releases")
160
168
  if rep != 'y' then
161
169
  raise "Aborting.."
162
170
  end
163
- puts `#{SUBMIT_BINARY}`
171
+ puts `#{@@SUBMIT_BINARY}`
164
172
  end
165
173
  def findStableBase(branch)
166
174
  @stable_base_patterns.each(){|pattern, base|
167
- return base if branch =~ /#{pattern}\//
175
+ return base if branch =~ /#{pattern}\// || branch =~ /#{pattern}$/
168
176
  }
169
177
  raise("Could not a find a stable base for branch #{branch}")
170
178
  end
@@ -176,7 +184,7 @@ module GitMaintain
176
184
  puts getSuffixList()
177
185
  end
178
186
  def submit_release(opts)
179
- submitReleases()
187
+ submitReleases(opts)
180
188
  end
181
189
  end
182
190
  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.2.2
4
+ version: 0.3.0.pre.1.g1a642bd
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: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2018-10-09 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: '0'
63
+ version: 1.3.1
64
64
  requirements: []
65
65
  rubyforge_project:
66
66
  rubygems_version: 2.7.7