stash_cli 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 931c61d232560cf1f0856f572593ca263678ca6b
4
- data.tar.gz: 893734422c626f819e62a439dc5fcfd7979e3bee
3
+ metadata.gz: f505b77639435a60bae3d100184b246ed1aeaf05
4
+ data.tar.gz: 08596d623cec3e7e1f9e7b721a12d60fe014101e
5
5
  SHA512:
6
- metadata.gz: f9cc90eacaefb56234afac09cf317317987a33924bcf8568ca6b8f61c07508cc8f0418a2cda06890eb5ee15cd5258ad6656684007ddac1b009cacbf0375754e5
7
- data.tar.gz: 726a4ef25274d611fbae04b0fb9077b434296b470c47933e4a47f2c561aa9c2138361971bf254b6b88b1e1c286b19ca34cdc24722e7e6ece0e7769842423747b
6
+ metadata.gz: d38cdd82a8132ed90ec4851047c5d909e27e1fa6ea2e8c658a41e53ad628b959455c5db013245b9cff6a6373a119fdca3a3aa9bb38ce068f735abe95a8fa314b
7
+ data.tar.gz: 5c41740976525594f21beef3832b9b8b2eb748f74ef005d27765916858b710d68c685c1a0f0c54986e6fcbffdedd97092ac807f260763642942a0142575d2628
data/lib/stash_cli/cli.rb CHANGED
@@ -47,6 +47,11 @@ module StashCLI
47
47
  say "verify configuration in #{dest}"
48
48
  end
49
49
 
50
+ desc 'commits SRC_BRANCH', 'list commits since source branch'
51
+ def commits(src_branch)
52
+ say GitUtils.commits_from_branch(src_branch)
53
+ end
54
+
50
55
  desc 'users', 'list users'
51
56
  def users
52
57
  configure
@@ -154,13 +159,22 @@ module StashCLI
154
159
 
155
160
  protected
156
161
 
157
- def get_description
162
+ def get_description(target_branch)
163
+ default_description = GitUtils.commits_from_branch(target_branch)
164
+
158
165
  if options[:long_description]
166
+ if ENV['EDITOR'].nil? or ENV['EDITOR'].empty?
167
+ say 'using --long-description but $EDITOR not set. Aborting.'
168
+ exit 1
169
+ end
170
+
159
171
  if options[:interactive]
160
- say 'getting description via editor'
172
+ say 'getting description via $EDITOR'
161
173
  end
162
174
 
163
175
  tmpfile = File.join('/tmp', "pull_request_desc_#{Time.now.to_i}")
176
+ File.open(tmpfile, 'w') { |f| f.puts default_description }
177
+
164
178
  system(ENV['EDITOR'], tmpfile)
165
179
 
166
180
  if File.exists?(tmpfile)
@@ -168,21 +182,17 @@ module StashCLI
168
182
  File.delete(tmpfile)
169
183
  return contents
170
184
  else
171
- say 'Aborting due to empty description'
185
+ say 'Aborting due to missing description'
172
186
  exit 1
173
187
  end
174
188
  elsif options[:interactive]
175
189
  description = ask("description [#{options[:description]}]:").strip
176
- if description.empty?
177
- return nil
178
- end
179
-
180
- return description
190
+ return description unless description.empty?
181
191
  end
182
192
 
183
-
184
193
  return options[:description] if options[:description]
185
- nil
194
+
195
+ return default_description
186
196
  end
187
197
 
188
198
  def initial_reviewers
@@ -232,18 +242,20 @@ module StashCLI
232
242
  reviewers: reviewers
233
243
  }
234
244
 
235
- description = get_description
245
+ description = get_description(opts[:target_branch])
246
+
236
247
  opts[:description] = description if description
237
248
 
238
249
  opts
239
250
  end
240
251
 
241
252
  def interactive_pr(title)
242
- description = get_description
243
253
 
244
254
  target_branch =
245
255
  ask("target branch [#{configatron.defaults.target_branch}]:").strip
246
256
 
257
+ description = get_description(target_branch)
258
+
247
259
  target_branch = configatron.defaults.target_branch if target_branch.empty?
248
260
 
249
261
  reviewers = initial_reviewers
@@ -3,5 +3,10 @@ module StashCLI
3
3
  def self.current_branch
4
4
  `git rev-parse --abbrev-ref HEAD`.strip
5
5
  end
6
+
7
+ def self.commits_from_branch(source_branch)
8
+ current_branch = GitUtils.current_branch
9
+ `git log --oneline #{source_branch}..#{current_branch} | cat`.strip
10
+ end
6
11
  end
7
12
  end
@@ -1,3 +1,3 @@
1
1
  module StashCli
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stash_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Chun-Lum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configatron