git_curate 1.2.0.beta2 → 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 +4 -4
- data/CHANGELOG.md +1 -1
- data/VERSION +1 -1
- data/lib/git_curate.rb +1 -0
- data/lib/git_curate/branch.rb +18 -26
- data/lib/git_curate/commit.rb +5 -0
- data/lib/git_curate/version.rb +1 -1
- metadata +3 -3
- data/play.rb +0 -31
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
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.0.
|
1
|
+
1.2.0.beta3
|
data/lib/git_curate.rb
CHANGED
data/lib/git_curate/branch.rb
CHANGED
@@ -2,12 +2,8 @@ require "rugged"
|
|
2
2
|
|
3
3
|
module GitCurate
|
4
4
|
|
5
|
-
UpstreamInfo = Struct.new(:upstream, :status)
|
6
|
-
|
7
5
|
class Branch
|
8
6
|
|
9
|
-
@@repo = Rugged::Repository.new(".")
|
10
|
-
|
11
7
|
# Regex for determining whether a "raw" branch name is the name of the current branch
|
12
8
|
# on this or another worktree.
|
13
9
|
CURRENT_BRANCH_REGEX = /^[+*]\s+/
|
@@ -48,29 +44,28 @@ module GitCurate
|
|
48
44
|
end
|
49
45
|
|
50
46
|
def last_commit_date
|
51
|
-
|
52
|
-
@last_commit_date
|
47
|
+
last_commit.date
|
53
48
|
end
|
54
49
|
|
55
50
|
def hash
|
56
|
-
|
57
|
-
@hash
|
51
|
+
last_commit.hash
|
58
52
|
end
|
59
53
|
|
60
54
|
def last_author
|
61
|
-
|
62
|
-
@last_author
|
55
|
+
last_commit.author
|
63
56
|
end
|
64
57
|
|
65
58
|
def last_subject
|
66
|
-
|
67
|
-
@last_subject
|
59
|
+
last_commit.subject
|
68
60
|
end
|
69
61
|
|
70
62
|
# Returns the local branches
|
71
63
|
def self.local
|
72
|
-
|
73
|
-
|
64
|
+
toplevel_dir = Util.command_output("git rev-parse --show-toplevel").strip
|
65
|
+
repo = Rugged::Repository.new(toplevel_dir)
|
66
|
+
|
67
|
+
rugged_branches = repo.branches
|
68
|
+
repo_head_target = repo.head.target
|
74
69
|
|
75
70
|
Util.command_to_a("git branch").map do |line|
|
76
71
|
raw_branch_name = line.strip
|
@@ -80,7 +75,7 @@ module GitCurate
|
|
80
75
|
upstream_data =
|
81
76
|
if upstream
|
82
77
|
target_id = rugged_branch.target_id
|
83
|
-
ahead, behind =
|
78
|
+
ahead, behind = repo.ahead_behind(target_id, upstream.target_id)
|
84
79
|
parts = []
|
85
80
|
parts << "ahead #{ahead}" if ahead != 0
|
86
81
|
parts << "behind #{behind}" if behind != 0
|
@@ -94,7 +89,7 @@ module GitCurate
|
|
94
89
|
end
|
95
90
|
|
96
91
|
target = rugged_branch.resolve.target
|
97
|
-
merged = (
|
92
|
+
merged = (repo.merge_base(repo_head_target, target) == target.oid)
|
98
93
|
|
99
94
|
new(
|
100
95
|
raw_branch_name,
|
@@ -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.2.0.
|
4
|
+
version: 1.2.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Harvey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -177,12 +177,12 @@ files:
|
|
177
177
|
- lib/git_curate/app.rb
|
178
178
|
- lib/git_curate/branch.rb
|
179
179
|
- lib/git_curate/cli_parser.rb
|
180
|
+
- lib/git_curate/commit.rb
|
180
181
|
- lib/git_curate/copyright.rb
|
181
182
|
- lib/git_curate/exceptions.rb
|
182
183
|
- lib/git_curate/runner.rb
|
183
184
|
- lib/git_curate/util.rb
|
184
185
|
- lib/git_curate/version.rb
|
185
|
-
- play.rb
|
186
186
|
homepage: https://github.com/matt-harvey/git_curate
|
187
187
|
licenses:
|
188
188
|
- MIT
|
data/play.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require "rugged"
|
2
|
-
|
3
|
-
repo = Rugged::Repository.new(".")
|
4
|
-
|
5
|
-
current_branch_name = repo.head.name.sub(/^refs\/heads\//, '')
|
6
|
-
|
7
|
-
repo.branches.each_name(:local) do |branch_name|
|
8
|
-
branch_reference = repo.references["refs/heads/#{branch_name}"]
|
9
|
-
branch = repo.branches[branch_name]
|
10
|
-
is_current = current_branch_name == branch_name
|
11
|
-
target_id = branch.target_id
|
12
|
-
top_commit = branch_reference.log.first
|
13
|
-
commit = repo.lookup(target_id)
|
14
|
-
|
15
|
-
target = branch.resolve.target
|
16
|
-
merged = repo.merge_base(repo.head.target, target) == target.oid
|
17
|
-
|
18
|
-
puts "Branch: #{is_current ? '* ' + branch_name : branch_name}"
|
19
|
-
puts "date: #{commit.time}"
|
20
|
-
puts "hash: #{target_id}"
|
21
|
-
puts "author: #{top_commit[:committer][:name]}"
|
22
|
-
puts "subject: #{commit.message.split($/, -1)[0]}"
|
23
|
-
if branch.upstream
|
24
|
-
puts "upstream: #{branch.upstream.name}"
|
25
|
-
ahead, behind = repo.ahead_behind(target_id, branch.upstream.target_id)
|
26
|
-
puts "ahead: #{ahead}"
|
27
|
-
puts "behind: #{behind}"
|
28
|
-
end
|
29
|
-
puts "merged: #{merged ? 'Merged' : 'Not merged'}"
|
30
|
-
puts "*****************"
|
31
|
-
end
|