fue 0.6.0 → 0.6.1
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/CHANGELOG.md +5 -0
- data/README.md +3 -3
- data/bin/fue +2 -2
- data/lib/fue/finder.rb +43 -12
- data/lib/fue/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a982ac35789eec5ee7430052d3ccf22ac09b0527003f42d22bf1bb7ce15a4cb4
|
|
4
|
+
data.tar.gz: 5ef4d96963ce4b5f4a1399dc46a6f1cea30f7de3920fb2eaee0beec2379b4366
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 992dfda49bb3cf00accd6ee738bba0f194aa93887d6e91917a64f2c89f902c64fa8050aaa96272369ba8a4d310be34efdd502744a2b8c3c93767cc7797ad7781
|
|
7
|
+
data.tar.gz: 6e47a95d530ab66e92aa7b2abccf3e81b3014fb4b14e67d2ffafd52c594ee445c3475d7f0868acd0d032ec87b6c5cdc1f2887f1aabfcece16338d2c43100d32f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
### 0.6.1 (2026/11/24)
|
|
2
|
+
|
|
3
|
+
* [#59](https://github.com/dblock/fue/pull/59): Only include `Signed-off-by` addresses of the commit author, and all of them, not just the first - [@dblock](https://github.com/dblock).
|
|
4
|
+
* [#58](https://github.com/dblock/fue/pull/58): Fixed `--breadth` above 100 repeating the first 100 repositories, and GitHub timeouts with large `--depth` by keeping each request small and retrying with fewer repositories, treat `noreply@github.com` as a no-reply address, and `fue find` now defaults to `--breadth=100 --depth=10` - [@dblock](https://github.com/dblock).
|
|
5
|
+
|
|
1
6
|
### 0.6.0 (2026/11/24)
|
|
2
7
|
|
|
3
8
|
* [#54](https://github.com/dblock/fue/pull/54): Added `fue mentions` to list contributors without an e-mail address to @mention - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
|
@@ -74,7 +74,7 @@ $ fue mentions dblock/iex-ruby-client
|
|
|
74
74
|
|
|
75
75
|
#### Exclude No-Reply Emails
|
|
76
76
|
|
|
77
|
-
By default `fue find` and `fue contributors` will include no-reply emails such as `kch@users.noreply.github.com
|
|
77
|
+
By default `fue find` and `fue contributors` will include no-reply emails such as `kch@users.noreply.github.com` and `noreply@github.com`, which GitHub uses for some commits made on github.com. Exclude those with `--no-noreply`.
|
|
78
78
|
|
|
79
79
|
```sh
|
|
80
80
|
fue find --no-noreply kch
|
|
@@ -86,7 +86,7 @@ fue --verbose contributors --no-noreply defunkt/colored
|
|
|
86
86
|
|
|
87
87
|
#### Exclude Emails from Signed-off-by
|
|
88
88
|
|
|
89
|
-
By default `fue find` and `fue contributors` will include emails gathered from `Signed-off-by` text in commit descriptions.
|
|
89
|
+
By default `fue find` and `fue contributors` will include emails gathered from `Signed-off-by` text in commit descriptions. Only sign-offs by the commit author count: those whose name or e-mail address matches the author's name or e-mail address, or the user's GitHub login, ignoring case. Exclude all of them with `--no-signed-off-by`.
|
|
90
90
|
|
|
91
91
|
```sh
|
|
92
92
|
fue find --no-signed-off-by defunkt
|
|
@@ -106,7 +106,7 @@ fue find --no-names defunkt
|
|
|
106
106
|
|
|
107
107
|
#### Specify More Depth
|
|
108
108
|
|
|
109
|
-
By default
|
|
109
|
+
By default `fue find` looks at 10 commits in each of the last 100 repositories, which takes 5 requests to GitHub. `fue contributors` and `fue mentions` search each contributor's last 10 repositories, 1 commit each, in 1 request per contributor. You can look at more repositories (breadth) and more commits (depth). Fue pages through larger values of breadth and depth and keeps each request to GitHub small, so any value works and larger values just take longer. For example, `--breadth=1000 --depth=100` searches all of a user's public repositories; for a user with several hundred repositories this takes a couple of minutes and uses a few hundred of the 5,000 points GitHub allows per hour. `fue contributors` and `fue mentions` run such a search for each contributor.
|
|
110
110
|
|
|
111
111
|
```sh
|
|
112
112
|
$ fue find --breadth=100 --depth=5 defunkt
|
data/bin/fue
CHANGED
|
@@ -36,8 +36,8 @@ class App
|
|
|
36
36
|
desc "Find a GitHub user's e-mail address."
|
|
37
37
|
arg 'username'
|
|
38
38
|
command :find do |c|
|
|
39
|
-
c.flag %i[d depth], desc: 'Maximum search depth in each repository.', default_value:
|
|
40
|
-
c.flag %i[b breadth], desc: 'Maximum number of repositories to search.', default_value:
|
|
39
|
+
c.flag %i[d depth], desc: 'Maximum search depth in each repository.', default_value: 10
|
|
40
|
+
c.flag %i[b breadth], desc: 'Maximum number of repositories to search.', default_value: 100
|
|
41
41
|
c.switch %i[noreply], desc: 'Include @users.noreply.github.com e-mail addresses.', default_value: true
|
|
42
42
|
c.switch %i[signed-off-by], desc: 'Include e-mail addresses from Signed-off-by.', default_value: true
|
|
43
43
|
c.switch %i[names], desc: 'Include names with e-mail addresses.', default_value: true
|
data/lib/fue/finder.rb
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Fue
|
|
4
4
|
class Finder
|
|
5
|
+
# GitHub times out or truncates responses with many more commits, stay well below that
|
|
6
|
+
MAX_COMMITS_PER_REQUEST = 200
|
|
7
|
+
|
|
5
8
|
attr_reader :token
|
|
6
9
|
|
|
7
10
|
def initialize(token, _options = {})
|
|
@@ -121,7 +124,7 @@ module Fue
|
|
|
121
124
|
query = <<-GRAPHQL
|
|
122
125
|
query($login: String!, $author_id: ID!, $depth: Int!, $breadth: Int!, $cursor: String, $is_fork: Boolean!) {
|
|
123
126
|
user(login: $login) {
|
|
124
|
-
repositories(last: $breadth,
|
|
127
|
+
repositories(last: $breadth, before: $cursor, isFork: $is_fork, privacy: PUBLIC) {
|
|
125
128
|
nodes {
|
|
126
129
|
nameWithOwner
|
|
127
130
|
defaultBranchRef {
|
|
@@ -146,6 +149,7 @@ module Fue
|
|
|
146
149
|
}
|
|
147
150
|
pageInfo {
|
|
148
151
|
startCursor
|
|
152
|
+
hasPreviousPage
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
}
|
|
@@ -156,23 +160,29 @@ module Fue
|
|
|
156
160
|
max_breadth = options[:breadth] || 10
|
|
157
161
|
# max number of commits to look into in each repository, GitHub returns at most 100 at a time
|
|
158
162
|
max_depth = query_options[:depth]
|
|
159
|
-
|
|
163
|
+
depth = [max_depth, 100].min
|
|
164
|
+
query_options = query_options.merge(is_fork: options[:is_fork], cursor: nil, depth: depth)
|
|
165
|
+
# repositories per request, fewer when looking into more commits in each
|
|
166
|
+
page_size = (MAX_COMMITS_PER_REQUEST / depth).clamp(1, 100)
|
|
160
167
|
emails = Set.new
|
|
161
168
|
|
|
162
|
-
|
|
163
|
-
query_options[:breadth] = [max_breadth,
|
|
164
|
-
response =
|
|
169
|
+
while max_breadth.positive?
|
|
170
|
+
query_options[:breadth] = [max_breadth, page_size].min
|
|
171
|
+
response = query_with_retry(query, query_options) do
|
|
172
|
+
page_size = [page_size / 2, 1].max
|
|
173
|
+
query_options[:breadth] = [max_breadth, page_size].min
|
|
174
|
+
end
|
|
165
175
|
repositories = response&.data&.user&.repositories
|
|
166
176
|
repositories&.nodes&.each do |repository|
|
|
167
177
|
history = repository.default_branch_ref&.target&.history
|
|
168
178
|
add_history_emails(emails, history, options)
|
|
169
179
|
more_history_emails(emails, repository, history, query_options[:author_id], max_depth - 100, options)
|
|
170
180
|
end
|
|
171
|
-
|
|
172
|
-
break unless
|
|
181
|
+
# repositories are listed oldest first, page backwards from the most recent
|
|
182
|
+
break unless repositories&.page_info&.has_previous_page
|
|
173
183
|
|
|
174
|
-
|
|
175
|
-
|
|
184
|
+
query_options[:cursor] = repositories.page_info.start_cursor
|
|
185
|
+
max_breadth -= query_options[:breadth]
|
|
176
186
|
|
|
177
187
|
$stdout.write '.' if options[:verbose]
|
|
178
188
|
end
|
|
@@ -180,6 +190,17 @@ module Fue
|
|
|
180
190
|
emails
|
|
181
191
|
end
|
|
182
192
|
|
|
193
|
+
# Retries a request that GitHub could not complete, after the block makes it smaller.
|
|
194
|
+
def query_with_retry(query, query_options)
|
|
195
|
+
graphql_client.query(query, query_options)
|
|
196
|
+
rescue Graphlient::Errors::TimeoutError, Faraday::ParsingError, Graphlient::Errors::FaradayServerError => e
|
|
197
|
+
raise if e.is_a?(Graphlient::Errors::FaradayServerError) && e.status_code.to_i < 500
|
|
198
|
+
raise if query_options[:breadth] <= 1
|
|
199
|
+
|
|
200
|
+
yield
|
|
201
|
+
retry
|
|
202
|
+
end
|
|
203
|
+
|
|
183
204
|
# pages through a repository's history beyond the first 100 commits
|
|
184
205
|
def more_history_emails(emails, repository, history, author_id, remaining, options)
|
|
185
206
|
query = <<-GRAPHQL
|
|
@@ -236,21 +257,31 @@ module Fue
|
|
|
236
257
|
|
|
237
258
|
next if options[:exclude_signed_off_by]
|
|
238
259
|
|
|
239
|
-
node.message_body.
|
|
240
|
-
email = m[:email]
|
|
260
|
+
node.message_body.scan(/^Signed-off-by: ([^\r\n]*)$/).flatten.each do |email|
|
|
241
261
|
next if noreply?(email) && options[:exclude_noreply]
|
|
262
|
+
next unless signed_off_by_author?(email, node.author, options[:username])
|
|
242
263
|
|
|
243
264
|
emails << (options[:exclude_names] ? email[/<([^>]+)>/, 1] || email : email)
|
|
244
265
|
end
|
|
245
266
|
end
|
|
246
267
|
end
|
|
247
268
|
|
|
269
|
+
# A Signed-off-by line belongs to the commit author when its name or e-mail address matches
|
|
270
|
+
# the author's name, the author's e-mail address, or the user's GitHub login, ignoring case.
|
|
271
|
+
def signed_off_by_author?(signed_off_by, author, login)
|
|
272
|
+
name = signed_off_by[/\A([^<]*)</, 1]&.strip
|
|
273
|
+
email = signed_off_by[/<([^>]+)>/, 1]
|
|
274
|
+
candidates = [author.name, author.email, login].compact.map(&:downcase)
|
|
275
|
+
([name, email].compact.map(&:downcase) & candidates).any?
|
|
276
|
+
end
|
|
277
|
+
|
|
248
278
|
def format_email(name, email, options)
|
|
249
279
|
options[:exclude_names] ? email : "#{name} <#{email}>"
|
|
250
280
|
end
|
|
251
281
|
|
|
282
|
+
# GitHub's addresses that don't receive e-mail, including noreply@github.com on commits made on github.com
|
|
252
283
|
def noreply?(email)
|
|
253
|
-
email.include?('@users.noreply.github.com')
|
|
284
|
+
email.include?('@users.noreply.github.com') || email.include?('noreply@github.com')
|
|
254
285
|
end
|
|
255
286
|
|
|
256
287
|
def graphql_client
|
data/lib/fue/version.rb
CHANGED