export-pull-requests 0.3.3 → 0.4.0

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.
Files changed (5) hide show
  1. checksums.yaml +5 -5
  2. data/Changes +16 -0
  3. data/README.md +8 -2
  4. data/bin/epr +47 -10
  5. metadata +20 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f3ef7be95a92abf1ffcd0eac471f5a3d5251fbe3
4
- data.tar.gz: 99bba99a08631b69bc8174b83bea1e250eeae28e
2
+ SHA256:
3
+ metadata.gz: d0cefccef824b6fde15c18ea2cde47d45add41b80ffe494bccbfedc71581bc94
4
+ data.tar.gz: 1f1ea671cc25edf027d5ab89f4cb97f542d50a3d481fa417c7f040a64bf0260f
5
5
  SHA512:
6
- metadata.gz: 356deeb4db67174cbad7b8b9d3e88a51d004bf6ba10467b26e407478914832da6944060d8a5e0d9a7e67b75622e8c388f22764696418af1d9f5a779001ffcc97
7
- data.tar.gz: 6780a66037eb01f5ce5de3fa9b62a0eb9e3228fb2fd41a8ab2864aa268d8063e87c6ffc029d267ca09ab4292f34a3f224d5a75d6eb46870694a5a7dfda107850
6
+ metadata.gz: 57204a618ac7874b0b7f50c598e538d932b5171ccf44e3a4064143110c78d8c5344aadf1b1269dfc2b6a67f8dc66cd366af667df38a11b1db49e29dbb3b009e6
7
+ data.tar.gz: fc654c6ec9ec407e16239dc6638cb366412f7298f9eec5fa9e5b2a380ea9217c110616ab93f38649e9517dcb75375cf92f2c4ecf05295f07a60e52f2567893e8
data/Changes CHANGED
@@ -1,3 +1,19 @@
1
+ v0.3.6 2021-04-28
2
+ --------------------
3
+ Bug fixes:
4
+ * Require Ruby < 3 (#25)
5
+
6
+ v0.3.5 2021-03-16
7
+ --------------------
8
+ Enhancements:
9
+ * Add Merged column containing PR merge time
10
+ * Exit with failure if attempting to export GitHub milestones for PRs
11
+
12
+ v0.3.4 2021-02-12
13
+ --------------------
14
+ Bug Fixes:
15
+ * Bitbucket username not exported for PRs under 2.0 API (#20)
16
+
1
17
  v0.3.3 2019-05-01
2
18
  --------------------
3
19
  Bug Fixes:
data/README.md CHANGED
@@ -7,7 +7,6 @@ Supports GitHub, GitLab, and Bitbucket.
7
7
  ## Installation
8
8
 
9
9
  [Ruby](https://www.ruby-lang.org/en/documentation/installation/) is required.
10
-
11
10
  With Ruby installed run:
12
11
 
13
12
  gem install export-pull-requests
@@ -66,10 +65,17 @@ Export all issues from a GitLab project:
66
65
 
67
66
  ## Service Notes
68
67
 
69
- To connect to a custom/"Enterprise" installation of any of the supported services use the endpoint option (`-e`)
68
+ To connect to a custom/"Enterprise" installation of any of the supported services use the endpoint option (`-e`).
69
+
70
+ The provided URL must point the API endpoint, not the user-facing site. For GitHub this is `http(s)://YOUR-SITE/api/v3`.
70
71
 
71
72
  ### Bitbucket
72
73
 
74
+ **Due to [various issues with the Bitbucket gem](https://github.com/sshaw/export-pull-requests/issues/26) support for Bitbucket
75
+ requires using a Ruby version < 3 and manually installing the Bitbucket library via `gem install bitbucket_rest_api`.**
76
+
77
+ **Alternatively, on a Ruby version < 3 you can run: gem install export-pull-requests -v=0.3.7**
78
+
73
79
  You can use [app passwords](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) for the API token.
74
80
  Just provide your token info in `bitbucket_username:app_password` format:
75
81
 
data/bin/epr CHANGED
@@ -7,9 +7,8 @@ require "logger"
7
7
 
8
8
  require "github_api"
9
9
  require "gitlab"
10
- require "bitbucket_rest_api"
11
10
 
12
- VERSION = "0.3.3"
11
+ VERSION = "0.4.0"
13
12
  SERVICES = %w[github gitlab bitbucket]
14
13
  GIT_CONFIGS = %w[epr.token github.oauth-token]
15
14
 
@@ -70,13 +69,14 @@ def bitbucket(user, repo)
70
69
 
71
70
  prs = $bitbucket.repos.pull_request.all(user, repo, :page => page, :state => $filter.upcase)
72
71
  prs["values"].each do |pr|
73
- next if pr.author && skip_user?(pr.author.username)
72
+ next if pr.author && (skip_user?(pr.author.display_name) || skip_user?(pr.author.nickname))
74
73
 
75
74
  rows << [
76
75
  repo_name,
77
76
  TYPE_PR,
78
77
  pr.id,
79
- pr.author ? pr.author.username : no_user,
78
+ # With the 2.0 API is this check necessary?
79
+ pr.author ? pr.author.display_name : no_user,
80
80
  pr.title,
81
81
  pr.state,
82
82
  localtime(pr.created_on),
@@ -162,10 +162,20 @@ def github(user, repo)
162
162
  item.title,
163
163
  item.state,
164
164
  localtime(item.created_at),
165
- localtime(item.updated_at),
166
- item.html_url,
165
+ localtime(item.updated_at)
167
166
  ]
168
167
 
168
+ # GitHub issues API returns PRs but not their merged_at time. To get that we need to specifically export PRs
169
+ if item.pull_request && $export != EXPORT_ISSUES
170
+ rows[-1] << "(use `-x pr` option)"
171
+ elsif $export != EXPORT_PRS
172
+ rows[-1] << "N/A"
173
+ else
174
+ rows[-1] << (item.merged_at ? localtime(item.merged_at) : nil)
175
+ end
176
+
177
+ rows[-1] << item.html_url
178
+
169
179
  if $body
170
180
  body = item.body
171
181
  # -3 for "..."
@@ -215,9 +225,16 @@ def gitlab(user, repo)
215
225
  item.title,
216
226
  item.state,
217
227
  localtime(item.created_at),
218
- localtime(item.updated_at),
219
- item.web_url
228
+ localtime(item.updated_at)
220
229
  ]
230
+
231
+ if method == :issues
232
+ rows[-1] << "N/A"
233
+ else
234
+ rows[-1] << (item.merged_at ? localtime(item.merged_at) : nil)
235
+ end
236
+
237
+ rows[-1] << item.web_url
221
238
  end
222
239
  end
223
240
 
@@ -226,17 +243,31 @@ end
226
243
 
227
244
  def export_repos(argv)
228
245
  rows = []
229
- rows << %w[Repository Type # User Title State Created Updated URL]
246
+ rows << %w[Repository Type # User Title State Created Updated Merged URL]
230
247
  rows[-1].insert(4, "Body") if $body
231
248
 
232
249
  repos = parse_repos(argv)
233
250
  repos.each do |user, repo|
234
251
  case $provider
235
252
  when "github"
253
+ abort "milestone filtering can only be used with issues" if $milestone && $export == EXPORT_PRS
236
254
  rows.concat(github(user, repo))
237
255
  when "gitlab"
238
256
  rows.concat(gitlab(user, repo))
239
257
  when "bitbucket"
258
+ begin
259
+ require "bitbucket_rest_api"
260
+ rescue LoadError => e
261
+ # Could be an error due to gem version conflict
262
+ abort e.message unless e.instance_of?(LoadError)
263
+ abort(<<MESSAGE)
264
+ As of v0.4 the Bitbucket API is no longer included by default. To use Bitbucket you must use
265
+ a Ruby version < 3 and install the dependency yourself via: gem install bitbucket_rest_api.
266
+
267
+ Alternatively, on a Ruby version < 3 you can run: gem install export-pull-requests -v=0.3.7
268
+ MESSAGE
269
+ end
270
+
240
271
  rows.concat(bitbucket(user, repo))
241
272
  else
242
273
  abort "unknown service provider: #$provider"
@@ -311,7 +342,13 @@ parser = OptionParser.new do |opts|
311
342
  end
312
343
 
313
344
  opts.on "-v", "--version", "epr version" do
314
- puts "v#{VERSION} (GitHub v#{Github::VERSION}, GitLab v#{Gitlab::VERSION}, Bitbucket v#{BitBucket::VERSION::STRING})"
345
+ begin
346
+ require "bitbucket_rest_api"
347
+ rescue LoadError
348
+ end
349
+
350
+ bb_version = defined?(BitBucket) ? "v#{BitBucket::VERSION::STRING}" : "[Not installed]"
351
+ printf "v#{VERSION} (GitHub v#{Github::VERSION}, GitLab v#{Gitlab::VERSION}, Bitbucket %s)\n", bb_version
315
352
  exit
316
353
  end
317
354
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: export-pull-requests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-01 00:00:00.000000000 Z
11
+ date: 2022-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api
@@ -39,33 +39,39 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bitbucket_rest_api
42
+ name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ - - "<"
46
49
  - !ruby/object:Gem::Version
47
- version: '0.1'
50
+ version: '2'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
- version: '0.1'
57
+ version: '1.3'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '2'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - "~>"
65
+ - - ">="
60
66
  - !ruby/object:Gem::Version
61
- version: '0.9'
67
+ version: 12.3.3
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - "~>"
72
+ - - ">="
67
73
  - !ruby/object:Gem::Version
68
- version: '0.9'
74
+ version: 12.3.3
69
75
  description: Program to export GitHub, GitLab, or Bitbucket pull requests/merge requests
70
76
  and issues to CSV a file.
71
77
  email: skye.shaw@gmail.com
@@ -98,9 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
104
  - !ruby/object:Gem::Version
99
105
  version: '0'
100
106
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.6.14
103
- signing_key:
107
+ rubygems_version: 3.2.3
108
+ signing_key:
104
109
  specification_version: 4
105
110
  summary: Export pull requests and issues to a CSV file.
106
111
  test_files: []