git_commands 3.2.4 → 3.2.5
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/lib/git_commands/branch.rb +3 -2
- data/lib/git_commands/command.rb +10 -24
- data/lib/git_commands/prompt.rb +1 -1
- data/lib/git_commands/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdad6f742ea09e2b50d560714ee7a74b7848ffc5
|
4
|
+
data.tar.gz: 88697a5add19a72d6cbb0602e1ee423aa6bcbb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90a1dbe956bb86468132c4993d2443ead432a6998dcaf6f1e64f320971a97bf466bbdee99dc81ae7b854f40782299bab8ad357bc5644adfceca07fe20db4483f
|
7
|
+
data.tar.gz: 38774eda256e02d2e4ba318de4e031862392ab9ecbb785121b0525dd8df05331627e42ba68e02ebeaf51f5f8da9f9156a389fb43aacc2215266f1ae6f930fdf3
|
data/lib/git_commands/branch.rb
CHANGED
@@ -59,8 +59,9 @@ module GitCommands
|
|
59
59
|
@name == MASTER
|
60
60
|
end
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
def exists?(remote = true)
|
63
|
+
origin = ORIGIN if remote
|
64
|
+
`git rev-parse --verify #{origin}#{@name} 2> /dev/null`.match(/^[0-9a-z]+/)
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
data/lib/git_commands/command.rb
CHANGED
@@ -16,7 +16,6 @@ module GitCommands
|
|
16
16
|
def initialize(repo:, branches:, repo_klass: Repository, branch_klass: Branch, out: STDOUT)
|
17
17
|
@out = out
|
18
18
|
@repo = repo_klass.new(repo)
|
19
|
-
@conflictual = []
|
20
19
|
Dir.chdir(@repo) do
|
21
20
|
@branches = branch_klass.factory(branches)
|
22
21
|
@timestamp = Time.new.strftime("%Y-%m-%d")
|
@@ -26,12 +25,10 @@ module GitCommands
|
|
26
25
|
|
27
26
|
def purge
|
28
27
|
enter_repo do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
`git branch -D #{branch}`
|
33
|
-
end
|
34
|
-
confirm("Remove remote branch") do
|
28
|
+
confirm("Proceed removing these branches") do
|
29
|
+
@branches.each do |branch|
|
30
|
+
warning("Removing branch: #{branch}")
|
31
|
+
`git branch -D #{branch}` if branch.exists?(false)
|
35
32
|
`git push origin :#{branch}`
|
36
33
|
end
|
37
34
|
end
|
@@ -45,13 +42,12 @@ module GitCommands
|
|
45
42
|
warning("Rebasing branch: #{branch}")
|
46
43
|
`git checkout #{branch}`
|
47
44
|
`git pull origin #{branch}`
|
48
|
-
|
45
|
+
next unless rebase_with_master
|
49
46
|
`git push -f origin #{branch}`
|
50
47
|
`git checkout #{Branch::MASTER}`
|
51
48
|
`git branch -D #{branch}`
|
52
|
-
success
|
49
|
+
success("Rebased successfully!")
|
53
50
|
end
|
54
|
-
delete_conflictual
|
55
51
|
end
|
56
52
|
end
|
57
53
|
end
|
@@ -65,16 +61,14 @@ module GitCommands
|
|
65
61
|
@branches.each do |branch|
|
66
62
|
warning("Merging branch: #{branch}")
|
67
63
|
`git checkout -b #{temp} origin/#{branch} --no-track`
|
68
|
-
|
64
|
+
exit unless rebase_with_master
|
69
65
|
`git rebase #{aggregate}`
|
70
66
|
`git checkout #{aggregate}`
|
71
67
|
`git merge #{temp}`
|
72
|
-
`git branch -
|
68
|
+
`git branch -D #{temp}`
|
73
69
|
end
|
74
|
-
`git checkout #{Branch::MASTER}`
|
75
70
|
end
|
76
|
-
|
77
|
-
success "#{aggregate} branch created"
|
71
|
+
success("#{aggregate} branch created")
|
78
72
|
end
|
79
73
|
end
|
80
74
|
|
@@ -82,7 +76,7 @@ module GitCommands
|
|
82
76
|
fail GitError, "No branches loaded!" if @branches.empty?
|
83
77
|
size = @branches.to_a.size
|
84
78
|
plural = size > 1 ? "es" : ""
|
85
|
-
success
|
79
|
+
success("Successfully loaded #{size} branch#{plural}:")
|
86
80
|
@out.puts @branches.each_with_index.map { |branch, i| "#{(i+1).to_s.rjust(2, "0")}. #{branch}" } + [""]
|
87
81
|
end
|
88
82
|
|
@@ -98,14 +92,6 @@ module GitCommands
|
|
98
92
|
error("Got conflicts, aborting rebase!")
|
99
93
|
end
|
100
94
|
|
101
|
-
private def delete_conflictual
|
102
|
-
return if @conflictual.empty?
|
103
|
-
`git checkout #{Branch::MASTER}`
|
104
|
-
@conflictual.each do |branch|
|
105
|
-
`git branch -D #{branch}`
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
95
|
private def enter_repo
|
110
96
|
Dir.chdir(@repo) do
|
111
97
|
pull_master
|
data/lib/git_commands/prompt.rb
CHANGED
data/lib/git_commands/version.rb
CHANGED