fcom 0.10.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -6
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +10 -10
- data/bin/githooks/pre-push +8 -0
- data/lib/fcom/querier.rb +83 -30
- data/lib/fcom/version.rb +1 -1
- data/lib/fcom.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e7928ac7aa3b85318f701ea1758c3d5ea6b66abedede5d30ffdde4a57e101d7
|
4
|
+
data.tar.gz: eccc91bfb11cae5d9d5c624c8d402261e09e7ae1bd49815ad815411431926a88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69d76ea1e442afcd6d9921745ec71a1e4b825dd4a1df8d172a925f61ae55d73729eac97153f2ba413001fc410a7e4e8291942ab83c68559d0c92e94f5c751abe
|
7
|
+
data.tar.gz: bf57c916fba57fd8c2cb8cf522d369fce057b43b6b3d73492613d25657f7a3c693372a73968573aae8921bb569535a5650c510aaed782f061bec76d702f4a245
|
data/.github/dependabot.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
---
|
1
2
|
version: 2
|
2
3
|
updates:
|
3
|
-
- package-ecosystem: bundler
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
- package-ecosystem: bundler
|
5
|
+
directory: "/"
|
6
|
+
schedule:
|
7
|
+
interval: daily
|
8
|
+
time: "04:04"
|
9
|
+
timezone: America/Chicago
|
10
|
+
allow:
|
11
|
+
- dependency-type: all
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## v0.12.0 (2024-07-21)
|
2
|
+
- Default `--rg-options` to `--max-columns=2000`
|
3
|
+
|
4
|
+
## v0.11.0 (2024-07-16)
|
5
|
+
- Search back through renames
|
6
|
+
|
1
7
|
## v0.10.0 (2024-06-28)
|
2
8
|
- Enforce only major and minor parts of required Ruby version (loosening the
|
3
9
|
required Ruby version from 3.3.3 to 3.3.0)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fcom (0.
|
4
|
+
fcom (0.12.0)
|
5
5
|
activesupport (>= 6, < 8)
|
6
6
|
memo_wise (>= 1.7, < 2)
|
7
7
|
rainbow (>= 3.0, < 4)
|
@@ -35,10 +35,10 @@ GEM
|
|
35
35
|
language_server-protocol (3.17.0.3)
|
36
36
|
memo_wise (1.9.0)
|
37
37
|
method_source (1.1.0)
|
38
|
-
minitest (5.24.
|
38
|
+
minitest (5.24.1)
|
39
39
|
mutex_m (0.2.0)
|
40
40
|
parallel (1.25.1)
|
41
|
-
parser (3.3.
|
41
|
+
parser (3.3.4.0)
|
42
42
|
ast (~> 2.4.1)
|
43
43
|
racc
|
44
44
|
prism (0.30.0)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rainbow (3.1.1)
|
53
53
|
rake (13.2.1)
|
54
54
|
regexp_parser (2.9.2)
|
55
|
-
rexml (3.3.
|
55
|
+
rexml (3.3.2)
|
56
56
|
strscan
|
57
57
|
rspec (3.13.0)
|
58
58
|
rspec-core (~> 3.13.0)
|
@@ -67,13 +67,13 @@ GEM
|
|
67
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
68
|
rspec-support (~> 3.13.0)
|
69
69
|
rspec-support (3.13.1)
|
70
|
-
rubocop (1.
|
70
|
+
rubocop (1.65.0)
|
71
71
|
json (~> 2.3)
|
72
72
|
language_server-protocol (>= 3.17.0)
|
73
73
|
parallel (~> 1.10)
|
74
74
|
parser (>= 3.3.0.2)
|
75
75
|
rainbow (>= 2.2.2, < 4.0)
|
76
|
-
regexp_parser (>=
|
76
|
+
regexp_parser (>= 2.4, < 3.0)
|
77
77
|
rexml (>= 3.2.5, < 4.0)
|
78
78
|
rubocop-ast (>= 1.31.1, < 2.0)
|
79
79
|
ruby-progressbar (~> 1.7)
|
@@ -85,15 +85,15 @@ GEM
|
|
85
85
|
rubocop-ast (>= 1.31.1, < 2.0)
|
86
86
|
rubocop-rake (0.6.0)
|
87
87
|
rubocop (~> 1.0)
|
88
|
-
rubocop-rspec (3.0.
|
88
|
+
rubocop-rspec (3.0.3)
|
89
89
|
rubocop (~> 1.61)
|
90
90
|
ruby-progressbar (1.13.0)
|
91
|
-
runger_release_assistant (0.
|
91
|
+
runger_release_assistant (0.10.0)
|
92
92
|
activesupport (>= 6, < 8)
|
93
93
|
memo_wise (>= 1.7, < 2)
|
94
94
|
rainbow (>= 3.0, < 4)
|
95
95
|
slop (~> 4.8)
|
96
|
-
runger_style (2.
|
96
|
+
runger_style (2.12.0)
|
97
97
|
prism (>= 0.24.0)
|
98
98
|
rubocop (>= 1.38.0, < 2)
|
99
99
|
slop (4.10.1)
|
@@ -120,7 +120,7 @@ DEPENDENCIES
|
|
120
120
|
runger_style
|
121
121
|
|
122
122
|
RUBY VERSION
|
123
|
-
ruby 3.3.
|
123
|
+
ruby 3.3.4p94
|
124
124
|
|
125
125
|
BUNDLED WITH
|
126
126
|
2.5.11
|
data/lib/fcom/querier.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative 'options_helpers.rb'
|
|
5
5
|
# This class executes a system command to retrieve the git history, which is passed through `rg`
|
6
6
|
# (ripgrep), and then ultimately is fed back to `fcom` for parsing.
|
7
7
|
class Fcom::Querier
|
8
|
+
prepend MemoWise
|
8
9
|
include ::Fcom::OptionsHelpers
|
9
10
|
|
10
11
|
def initialize(options)
|
@@ -13,6 +14,7 @@ class Fcom::Querier
|
|
13
14
|
|
14
15
|
# rubocop:disable Metrics/CyclomaticComplexity
|
15
16
|
# rubocop:disable Metrics/PerceivedComplexity
|
17
|
+
# rubocop:disable Metrics/MethodLength
|
16
18
|
def query
|
17
19
|
expression_to_match = search_string
|
18
20
|
expression_to_match = Regexp.escape(expression_to_match).gsub('\\ ', ' ') unless regex_mode?
|
@@ -24,37 +26,88 @@ class Fcom::Querier
|
|
24
26
|
|
25
27
|
quote = expression_to_match.include?('"') ? "'" : '"'
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
29
|
+
commands =
|
30
|
+
filename_by_most_recent_containing_commit.map do |commit, path_at_commit|
|
31
|
+
<<~COMMAND.squish
|
32
|
+
git log
|
33
|
+
--format="commit %s|%H|%an|%cr (%ci)"
|
34
|
+
--patch
|
35
|
+
--full-diff
|
36
|
+
--no-textconv
|
37
|
+
#{%(--author="#{author}") if author}
|
38
|
+
#{"--since=#{days}.day" unless days.nil?}
|
39
|
+
#{commit}
|
40
|
+
--
|
41
|
+
#{path_at_commit}
|
42
|
+
|
|
43
|
+
|
44
|
+
rg #{quote}(#{expression_to_match})|(^commit )|(^diff )#{quote}
|
45
|
+
--color never
|
46
|
+
#{'--ignore-case' if ignore_case?}
|
47
|
+
#{@options[:rg_options]}
|
48
|
+
|
|
49
|
+
|
50
|
+
#{'exe/' if development?}fcom #{quote}#{search_string}#{quote}
|
51
|
+
#{"--days #{days}" if days}
|
52
|
+
#{'--regex' if regex_mode?}
|
53
|
+
#{'--debug' if debug?}
|
54
|
+
#{'--ignore-case' if ignore_case?}
|
55
|
+
--path #{path_at_commit}
|
56
|
+
--parse-mode
|
57
|
+
--repo #{repo}
|
58
|
+
COMMAND
|
59
|
+
end
|
60
|
+
|
61
|
+
previous_command_generated_output = false
|
62
|
+
|
63
|
+
commands.each do |command|
|
64
|
+
Fcom.logger.debug("Executing command: #{command}")
|
65
|
+
output = `#{command}`
|
66
|
+
|
67
|
+
if output.empty?
|
68
|
+
previous_command_generated_output = false
|
69
|
+
else
|
70
|
+
if previous_command_generated_output
|
71
|
+
puts("\n\n") # print blank lines for spacing
|
72
|
+
end
|
73
|
+
|
74
|
+
previous_command_generated_output = true
|
75
|
+
|
76
|
+
puts(output)
|
77
|
+
end
|
78
|
+
end
|
57
79
|
end
|
80
|
+
# rubocop:enable Metrics/MethodLength
|
58
81
|
# rubocop:enable Metrics/PerceivedComplexity
|
59
82
|
# rubocop:enable Metrics/CyclomaticComplexity
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
memo_wise \
|
87
|
+
def filename_by_most_recent_containing_commit
|
88
|
+
{
|
89
|
+
most_recent_commit_with_file => path,
|
90
|
+
}.merge(renames.transform_keys { "#{_1}^" })
|
91
|
+
end
|
92
|
+
|
93
|
+
memo_wise \
|
94
|
+
def most_recent_commit_with_file
|
95
|
+
if system(%(test -e "#{path}"))
|
96
|
+
'HEAD'
|
97
|
+
else
|
98
|
+
`git log --all -1 --format="%H" -- "#{path}"`.rstrip
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
memo_wise \
|
103
|
+
def renames
|
104
|
+
`git log HEAD --format=%H --name-status --follow --diff-filter=R -- '#{path}'`.
|
105
|
+
split(/\n(?=[0-9a-f]{40})/).
|
106
|
+
to_h do |sha_and_name_info|
|
107
|
+
sha_and_name_info.
|
108
|
+
match(/(?<sha>[0-9a-f]{40})\n\nR\d+\s+(?<previous_name>\S+)?/).
|
109
|
+
named_captures.
|
110
|
+
values_at('sha', 'previous_name')
|
111
|
+
end
|
112
|
+
end
|
60
113
|
end
|
data/lib/fcom/version.rb
CHANGED
data/lib/fcom.rb
CHANGED
@@ -75,7 +75,7 @@ class Fcom
|
|
75
75
|
options.string(
|
76
76
|
'--rg-options',
|
77
77
|
'additional options passed directly to `rg` (e.g. `--rg-options "--max-columns 1000"`)',
|
78
|
-
default: '',
|
78
|
+
default: '--max-columns=2000',
|
79
79
|
)
|
80
80
|
options.bool('--debug', 'print debugging info', default: false)
|
81
81
|
options.bool('--parse-mode', 'whether we are in parse mode', default: false, help: false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fcom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Runger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- Rakefile
|
109
109
|
- bin/_guard-core
|
110
110
|
- bin/console
|
111
|
+
- bin/githooks/pre-push
|
111
112
|
- bin/guard
|
112
113
|
- bin/release
|
113
114
|
- bin/rspec
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
- !ruby/object:Gem::Version
|
146
147
|
version: '0'
|
147
148
|
requirements: []
|
148
|
-
rubygems_version: 3.5.
|
149
|
+
rubygems_version: 3.5.15
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: CLI tool for parsing git history
|