git_curate 1.1.0 → 1.2.0.beta3
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/.gitignore +1 -0
- data/.travis.yml +5 -4
- data/CHANGELOG.md +14 -0
- data/README.md +1 -2
- data/VERSION +1 -1
- data/git_curate.gemspec +3 -2
- data/lib/git_curate.rb +1 -0
- data/lib/git_curate/branch.rb +39 -47
- data/lib/git_curate/commit.rb +5 -0
- data/lib/git_curate/version.rb +1 -1
- metadata +26 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3fc938706457be386083c9441a7c50bebfe7b2cab57171f776b73d3e2aec5e3
|
4
|
+
data.tar.gz: e7bdcb5b6d3569f50e0666ff00b096b7dc3d5be346abf1a3f069504196e34cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1ddd5f0da864679502d13b0e9ab6053abbe9bcbdc5555795da041ce0ffcc8b66af40d9811f0dffe21bdc7d00baa0f042aa5e27b2b3ba4af25c3474197b5ec5a
|
7
|
+
data.tar.gz: a57fcb5ea45588673fdfdbee07fc6de2cd384d64323bed105ee4af363109aaad3b4807ec846bc070ec48ce221b5249f6ddcdf3b2812cc95758c2ada9282fe309
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### v1.2.0.beta, v1.2.0.beta2, v1.2.0.beta3
|
4
|
+
|
5
|
+
* Fix for issue #16: "undefined method upstream" error on MacOS 15.7
|
6
|
+
* Add rugged library
|
7
|
+
|
8
|
+
### v1.1.2
|
9
|
+
|
10
|
+
* Dependency version upgrades
|
11
|
+
* Include Ruby v3 in automated tests
|
12
|
+
|
13
|
+
### v1.1.1
|
14
|
+
|
15
|
+
* Dependency version upgrades
|
16
|
+
|
3
17
|
### v1.1.0
|
4
18
|
|
5
19
|
#### Change that may be breaking for an obscure use case
|
data/README.md
CHANGED
@@ -77,8 +77,7 @@ To run the test suite, run `bundle exec rake spec`. For a list of other Rake tas
|
|
77
77
|
|
78
78
|
## License
|
79
79
|
|
80
|
-
The gem is available as open source under the terms of the [MIT
|
81
|
-
License](http://opensource.org/licenses/MIT).
|
80
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
82
81
|
|
83
82
|
[Gem Version]: https://rubygems.org/gems/git_curate
|
84
83
|
[Build Status]: https://travis-ci.org/matt-harvey/git_curate
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0.beta3
|
data/git_curate.gemspec
CHANGED
@@ -29,8 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
spec.add_runtime_dependency "highline", "2.0.3"
|
32
|
-
spec.add_runtime_dependency "
|
33
|
-
spec.add_runtime_dependency "
|
32
|
+
spec.add_runtime_dependency "rugged", "1.1.0"
|
33
|
+
spec.add_runtime_dependency "tabulo", "2.6.2"
|
34
|
+
spec.add_runtime_dependency "tty-screen", "0.8.1"
|
34
35
|
|
35
36
|
spec.add_development_dependency "bundler"
|
36
37
|
spec.add_development_dependency "coveralls"
|
data/lib/git_curate.rb
CHANGED
data/lib/git_curate/branch.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
require "rugged"
|
2
2
|
|
3
|
-
|
3
|
+
module GitCurate
|
4
4
|
|
5
5
|
class Branch
|
6
6
|
|
@@ -44,68 +44,63 @@ module GitCurate
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def last_commit_date
|
47
|
-
|
48
|
-
@last_commit_date
|
47
|
+
last_commit.date
|
49
48
|
end
|
50
49
|
|
51
50
|
def hash
|
52
|
-
|
53
|
-
@hash
|
51
|
+
last_commit.hash
|
54
52
|
end
|
55
53
|
|
56
54
|
def last_author
|
57
|
-
|
58
|
-
@last_author
|
55
|
+
last_commit.author
|
59
56
|
end
|
60
57
|
|
61
58
|
def last_subject
|
62
|
-
|
63
|
-
@last_subject
|
59
|
+
last_commit.subject
|
64
60
|
end
|
65
61
|
|
66
62
|
# Returns the local branches
|
67
63
|
def self.local
|
68
|
-
|
64
|
+
toplevel_dir = Util.command_output("git rev-parse --show-toplevel").strip
|
65
|
+
repo = Rugged::Repository.new(toplevel_dir)
|
69
66
|
|
70
|
-
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
67
|
+
rugged_branches = repo.branches
|
68
|
+
repo_head_target = repo.head.target
|
74
69
|
|
75
|
-
|
76
|
-
|
77
|
-
# Returns a Hash containing, as keys, the raw names of all local branches and, as values,
|
78
|
-
# a brief description of each branch's status relative to its upstream branch (up to
|
79
|
-
# date, or ahead/behind).
|
80
|
-
def self.branch_info
|
81
|
-
# Double quotes around the format string to ensure Windows compatibility.
|
82
|
-
command = 'git for-each-ref --format="%(refname:short) .. %(upstream:short) .. %(upstream:track)" refs/heads'
|
83
|
-
branches_with_remotes = Util.command_to_a(command).map do |line|
|
84
|
-
parts = line.split("..", -1).map { |s| s.strip! ; s.empty? ? nil : s }
|
85
|
-
[parts[0], UpstreamInfo.new(parts[1], parts[2])]
|
86
|
-
end.to_h
|
87
|
-
|
88
|
-
info = Util.command_to_a("git branch").map do |line|
|
70
|
+
Util.command_to_a("git branch").map do |line|
|
89
71
|
raw_branch_name = line.strip
|
90
72
|
proper_branch_name = raw_branch_name.gsub(CURRENT_BRANCH_REGEX, "")
|
91
|
-
|
73
|
+
rugged_branch = rugged_branches[proper_branch_name]
|
74
|
+
upstream = rugged_branch.upstream
|
92
75
|
upstream_data =
|
93
|
-
if
|
94
|
-
|
95
|
-
|
96
|
-
|
76
|
+
if upstream
|
77
|
+
target_id = rugged_branch.target_id
|
78
|
+
ahead, behind = repo.ahead_behind(target_id, upstream.target_id)
|
79
|
+
parts = []
|
80
|
+
parts << "ahead #{ahead}" if ahead != 0
|
81
|
+
parts << "behind #{behind}" if behind != 0
|
82
|
+
if parts.any?
|
83
|
+
parts.join(", ").capitalize
|
97
84
|
else
|
98
85
|
"Up to date"
|
99
86
|
end
|
100
87
|
else
|
101
88
|
"No upstream"
|
102
89
|
end
|
103
|
-
[raw_branch_name, upstream_data]
|
104
|
-
end
|
105
90
|
|
106
|
-
|
91
|
+
target = rugged_branch.resolve.target
|
92
|
+
merged = (repo.merge_base(repo_head_target, target) == target.oid)
|
93
|
+
|
94
|
+
new(
|
95
|
+
raw_branch_name,
|
96
|
+
merged: merged,
|
97
|
+
upstream_info: upstream_data,
|
98
|
+
)
|
99
|
+
end
|
107
100
|
end
|
108
101
|
|
102
|
+
private
|
103
|
+
|
109
104
|
def self.delete_multi(*branches)
|
110
105
|
Util.command_output("git branch -D #{branches.map(&:proper_name).join(" ")} --")
|
111
106
|
end
|
@@ -118,16 +113,13 @@ module GitCurate
|
|
118
113
|
@upstream_info = upstream_info
|
119
114
|
end
|
120
115
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
@last_commit_data = Util.command_to_a(command)
|
129
|
-
|
130
|
-
@last_commit_date, @hash, @last_author, @last_subject = @last_commit_data
|
116
|
+
def last_commit
|
117
|
+
@last_commit ||= begin
|
118
|
+
# For Windows compatibility we need double quotes around the format string, as well as spaces
|
119
|
+
# between the placeholders.
|
120
|
+
command = %Q(git log -n1 --date=short --format=format:"%cd %n %h %n %an %n %s" #{proper_name} --)
|
121
|
+
Commit.new(*Util.command_to_a(command))
|
122
|
+
end
|
131
123
|
end
|
132
124
|
|
133
125
|
end
|
data/lib/git_curate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_curate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Harvey
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -24,34 +24,48 @@ dependencies:
|
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rugged
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: tabulo
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - '='
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
47
|
+
version: 2.6.2
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - '='
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
54
|
+
version: 2.6.2
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: tty-screen
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - '='
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
61
|
+
version: 0.8.1
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - '='
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
68
|
+
version: 0.8.1
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,6 +177,7 @@ files:
|
|
163
177
|
- lib/git_curate/app.rb
|
164
178
|
- lib/git_curate/branch.rb
|
165
179
|
- lib/git_curate/cli_parser.rb
|
180
|
+
- lib/git_curate/commit.rb
|
166
181
|
- lib/git_curate/copyright.rb
|
167
182
|
- lib/git_curate/exceptions.rb
|
168
183
|
- lib/git_curate/runner.rb
|
@@ -174,7 +189,7 @@ licenses:
|
|
174
189
|
metadata:
|
175
190
|
source_code_uri: https://github.com/matt-harvey/git_curate
|
176
191
|
changelog_uri: https://raw.githubusercontent.com/matt-harvey/git_curate/master/CHANGELOG.md
|
177
|
-
post_install_message:
|
192
|
+
post_install_message:
|
178
193
|
rdoc_options: []
|
179
194
|
require_paths:
|
180
195
|
- lib
|
@@ -185,12 +200,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
200
|
version: 2.4.9
|
186
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
202
|
requirements:
|
188
|
-
- - "
|
203
|
+
- - ">"
|
189
204
|
- !ruby/object:Gem::Version
|
190
|
-
version:
|
205
|
+
version: 1.3.1
|
191
206
|
requirements: []
|
192
207
|
rubygems_version: 3.1.2
|
193
|
-
signing_key:
|
208
|
+
signing_key:
|
194
209
|
specification_version: 4
|
195
210
|
summary: Simple git branch curation tool
|
196
211
|
test_files: []
|