export-pull-requests 0.2.2 → 0.3.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 +4 -4
- data/Changes +28 -0
- data/README.md +14 -3
- data/bin/epr +37 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88245d15b5031425be423a98f42b42451a5e7810
|
4
|
+
data.tar.gz: 1d60dce9efefbb4d282110b537756ac31a8d6a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49af965c7fb6817c8bf8dcdbfbf07608e4b384abf35b2af56692b1f04dcdac63378e8f01bcb015b3d3af78395b431c1a5a5c4090b0199045a15516b5b15c9e49
|
7
|
+
data.tar.gz: c3f868be0eaeb4a760ae8e71f5a49d3a855dba2662149b361b8ef5e6fcdbfe9316f1b458bcce5bead831a629966edb3a8007724fff77d40823ddeb7f63fb5404
|
data/Changes
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
v0.3.4 2021-02-12
|
2
|
+
--------------------
|
3
|
+
Bug Fixes:
|
4
|
+
* Bitbucket username not exported for PRs under 2.0 API (#20)
|
5
|
+
|
6
|
+
v0.3.3 2019-05-01
|
7
|
+
--------------------
|
8
|
+
Bug Fixes:
|
9
|
+
* GitHub PR only exports were output as an "issue" instead of "PR"
|
10
|
+
|
11
|
+
v0.3.2 2019-02-09
|
12
|
+
--------------------
|
13
|
+
Bug Fixes:
|
14
|
+
* Don't supply assignee or milestone for GitHub if nil
|
15
|
+
|
16
|
+
--------------------
|
17
|
+
v0.3.1 2019-01-28
|
18
|
+
--------------------
|
19
|
+
Enhancements:
|
20
|
+
* Add support for filtering on milestones and labels to GitLab
|
21
|
+
|
22
|
+
--------------------
|
23
|
+
v0.3.0 2019-01-10
|
24
|
+
--------------------
|
25
|
+
Enhancements:
|
26
|
+
* Add support for filtering on milestones and labels (GitHub only)
|
27
|
+
* Add support for filtering on assignees (GitHub only, thanks Caroline Boyden)
|
28
|
+
|
1
29
|
--------------------
|
2
30
|
v0.2.2 2018-11-30
|
3
31
|
--------------------
|
data/README.md
CHANGED
@@ -16,10 +16,13 @@ This installs the `epr` executable.
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
usage: epr [
|
19
|
+
usage: epr [options] user/repo1 [user/repo2...]
|
20
20
|
-b, --body Include the issue/pr body description in the output (GitHub only)
|
21
21
|
-c, --creator=USER1,USER2,... Export PRs created by given username(s); prepend `!' to exclude user
|
22
22
|
-e, --endpoint=URL Endpoint URL for 'enterprise', etc... repositories
|
23
|
+
-m, --milestone=WHAT Export items assigned to the given milestone (GitHub/GitLab only)
|
24
|
+
-a, --assignee=USER Export items assigned to the given user (GitHub/GitLab only)
|
25
|
+
-l, --labels=LABEL(S) Export items with the given label(s) (GitHub/GitLab only)
|
23
26
|
-h, --help Show this message
|
24
27
|
-p, --provider=NAME Service provider: bitbucket, github, or gitlab; defaults to github
|
25
28
|
-s, --state=STATE Export items in the given state, defaults to open
|
@@ -63,12 +66,16 @@ Export all issues from a GitLab project:
|
|
63
66
|
|
64
67
|
## Service Notes
|
65
68
|
|
66
|
-
To connect to a custom/"Enterprise" installation of any of the supported services use the endpoint option (`-e`)
|
69
|
+
To connect to a custom/"Enterprise" installation of any of the supported services use the endpoint option (`-e`).
|
70
|
+
|
71
|
+
The provided URL must point the API endpoint, not the user-facing site. For GitHub this is `http(s)://YOUR-SITE/api/v3`.
|
67
72
|
|
68
73
|
### Bitbucket
|
69
74
|
|
70
75
|
You can use [app passwords](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) for the API token.
|
71
|
-
Just provide your token
|
76
|
+
Just provide your token info in `bitbucket_username:app_password` format:
|
77
|
+
|
78
|
+
epr -p bitbucket -t bitbucket_username:app_password user/repo1
|
72
79
|
|
73
80
|
### GitLab
|
74
81
|
|
@@ -76,6 +83,10 @@ Authentication can be done via a [personal access token](https://gitlab.com/prof
|
|
76
83
|
|
77
84
|
Enterprise editions of GitLab have an [issue export feature](https://docs.gitlab.com/ee/user/project/issues/csv_export.html).
|
78
85
|
|
86
|
+
## See Also
|
87
|
+
|
88
|
+
- [Batch Labels](https://github.com/sshaw/batchlabels) - Add/remove labels in batches to/from GitHub issues and pull requests.
|
89
|
+
|
79
90
|
## Author
|
80
91
|
|
81
92
|
Skye Shaw [skye.shaw AT gmail]
|
data/bin/epr
CHANGED
@@ -9,7 +9,7 @@ require "github_api"
|
|
9
9
|
require "gitlab"
|
10
10
|
require "bitbucket_rest_api"
|
11
11
|
|
12
|
-
VERSION = "0.
|
12
|
+
VERSION = "0.3.4"
|
13
13
|
SERVICES = %w[github gitlab bitbucket]
|
14
14
|
GIT_CONFIGS = %w[epr.token github.oauth-token]
|
15
15
|
|
@@ -70,13 +70,14 @@ def bitbucket(user, repo)
|
|
70
70
|
|
71
71
|
prs = $bitbucket.repos.pull_request.all(user, repo, :page => page, :state => $filter.upcase)
|
72
72
|
prs["values"].each do |pr|
|
73
|
-
next if pr.author && skip_user?(pr.author.
|
73
|
+
next if pr.author && (skip_user?(pr.author.display_name) || skip_user?(pr.author.nickname))
|
74
74
|
|
75
75
|
rows << [
|
76
76
|
repo_name,
|
77
77
|
TYPE_PR,
|
78
78
|
pr.id,
|
79
|
-
|
79
|
+
# With the 2.0 API is this check necessary?
|
80
|
+
pr.author ? pr.author.display_name : no_user,
|
80
81
|
pr.title,
|
81
82
|
pr.state,
|
82
83
|
localtime(pr.created_on),
|
@@ -138,7 +139,13 @@ def github(user, repo)
|
|
138
139
|
options[:endpoint] = $endpoint if $endpoint
|
139
140
|
|
140
141
|
$gh ||= Github.new(options)
|
141
|
-
|
142
|
+
|
143
|
+
options = { :user => user, :repo => repo, :state => $filter, :labels => $labels }
|
144
|
+
options[:milestone] = $milestone if $milestone
|
145
|
+
options[:assignee] = $assignee if $assignee
|
146
|
+
|
147
|
+
$gh.public_send(method).list(options).each_page do |page|
|
148
|
+
|
142
149
|
next if page.size.zero? # Needed for auto_pagination
|
143
150
|
|
144
151
|
page.each do |item|
|
@@ -148,7 +155,9 @@ def github(user, repo)
|
|
148
155
|
|
149
156
|
rows << [
|
150
157
|
"#{user}/#{repo}",
|
151
|
-
item.pull_request
|
158
|
+
# If we're only retrieving PRs then item.pull_request will be nil
|
159
|
+
# It's only populated when retrieving both (issues method).
|
160
|
+
item.pull_request || method == :pull_requests ? TYPE_PR : TYPE_ISSUE,
|
152
161
|
item.number,
|
153
162
|
item.user.login,
|
154
163
|
item.title,
|
@@ -184,10 +193,18 @@ def gitlab(user, repo)
|
|
184
193
|
|
185
194
|
# Do we care about this differing in output?
|
186
195
|
state = $filter == "open" ? "opened" : $filter
|
196
|
+
options = {
|
197
|
+
:milestone => $milestone,
|
198
|
+
:labels => $labels,
|
199
|
+
:state => state
|
200
|
+
}
|
201
|
+
|
202
|
+
# If assignee_id is nil an error is raised
|
203
|
+
options[:assignee_id] = $assignee if $assignee
|
187
204
|
|
188
205
|
$gitlab ||= Gitlab.client(:auth_token => $token, :endpoint => $endpoint || "https://gitlab.com/api/v4")
|
189
206
|
methods.each do |method|
|
190
|
-
$gitlab.public_send(method, "#{user}/#{repo}",
|
207
|
+
$gitlab.public_send(method, "#{user}/#{repo}", options).auto_paginate do |item|
|
191
208
|
next if skip_user?(item.author.username)
|
192
209
|
|
193
210
|
rows << [
|
@@ -239,13 +256,14 @@ $exclude_users = []
|
|
239
256
|
$include_users = []
|
240
257
|
$export = "all"
|
241
258
|
$endpoint = nil
|
259
|
+
$milestone = $labels = $assignee = nil
|
242
260
|
$filter = "open"
|
243
261
|
$provider = ENV["EPR_SERVICE"] || SERVICES[0]
|
244
262
|
$token = lookup_token
|
245
263
|
$body = false
|
246
264
|
|
247
265
|
parser = OptionParser.new do |opts|
|
248
|
-
opts.banner = "usage: #{File.basename($0)} [
|
266
|
+
opts.banner = "usage: #{File.basename($0)} [options] user/repo1 [user/repo2...]"
|
249
267
|
|
250
268
|
opts.on "-b", "--body", "Include the issue/pr body description in the output (GitHub only)" do
|
251
269
|
$body = true
|
@@ -260,6 +278,18 @@ parser = OptionParser.new do |opts|
|
|
260
278
|
$endpoint = url
|
261
279
|
end
|
262
280
|
|
281
|
+
opts.on "-m", "--milestone=WHAT", "Export items assigned to the given milestone (GitHub/GitLab only)" do |m|
|
282
|
+
$milestone = m
|
283
|
+
end
|
284
|
+
|
285
|
+
opts.on "-a", "--assignee=USER", "Export items assigned to the given user (GitHub/GitLab only)" do |a|
|
286
|
+
$assignee = a
|
287
|
+
end
|
288
|
+
|
289
|
+
opts.on "-l", "--labels=LABEL(S)", "Export items with the given label(s) (GitHub/GitLab only)" do |l|
|
290
|
+
$labels = l
|
291
|
+
end
|
292
|
+
|
263
293
|
opts.on "-h", "--help", "Show this message" do
|
264
294
|
puts opts
|
265
295
|
exit
|
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.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Skye Shaw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|