ggsm 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ggsm/command/delete.rb +28 -9
- data/lib/ggsm/command/finish.rb +10 -6
- data/lib/ggsm/command/switch.rb +5 -4
- data/lib/ggsm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd8da8540d6e4e736ff782af1c43fb71b08d95ea
|
4
|
+
data.tar.gz: 571682bd82ddf00beec4397a219c057b83993b0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0a269fc7173ec80d4caa9716ebf5a0f228c520bb4a8067a4dc68f7dc2bc6dd192fbf48bcbc58ee9df6cade109cf447ca63015c634d50c6e86a95923e77db5ca
|
7
|
+
data.tar.gz: c9c6fd2df3576848858315683ba6beefe870e21de8d6f93f7a162a5964363c5dfe071613a4cae3ef7dc6a7e6aa6ac4b0da40ae5ee25090520dc93c783206ceb4
|
data/lib/ggsm/command/delete.rb
CHANGED
@@ -19,19 +19,38 @@ module GGSM
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def delete_branch(all, branch, remote)
|
22
|
+
if branch == get_current_branch
|
23
|
+
puts "无法删除当前所在分支:#{branch},请switch其他分支后再执行\"ggsm delete\"".red
|
24
|
+
exit 0
|
25
|
+
end
|
26
|
+
|
22
27
|
if all
|
23
|
-
|
24
|
-
|
25
|
-
unless result
|
26
|
-
system 'git fetch -p origin'
|
27
|
-
end
|
28
|
+
delete_local_branch(branch)
|
29
|
+
delete_remote_branch(branch)
|
28
30
|
elsif remote
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
delete_remote_branch(branch)
|
32
|
+
else
|
33
|
+
delete_local_branch(branch)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def delete_local_branch(branch)
|
38
|
+
if `git branch | grep -e '\s|*#{branch}$'`.strip == ''
|
39
|
+
puts "warning: branch '#{branch}' not found"
|
40
|
+
else
|
41
|
+
info = `git branch -D #{branch}`
|
42
|
+
if info.strip != ''
|
43
|
+
puts "✓ #{info}"
|
32
44
|
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def delete_remote_branch(branch)
|
49
|
+
if `git branch -r | grep -e '\s|*origin/#{branch}$'`.strip == ''
|
50
|
+
puts "warning: remote branch '#{branch}' not found"
|
33
51
|
else
|
34
|
-
system "git
|
52
|
+
system "git push origin -d #{branch}"
|
53
|
+
`git fetch -p origin`
|
35
54
|
end
|
36
55
|
end
|
37
56
|
end
|
data/lib/ggsm/command/finish.rb
CHANGED
@@ -25,14 +25,18 @@ module GGSM
|
|
25
25
|
if branch.include?('rebas')
|
26
26
|
system 'git rebase --continue'
|
27
27
|
else
|
28
|
-
|
28
|
+
stage = `git diff --cached --name-only`.strip
|
29
|
+
if stage == ''
|
30
|
+
`git commit`
|
31
|
+
else
|
32
|
+
result = system 'git commit'
|
33
|
+
unless result
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
|
-
|
32
|
-
system "git push -u origin #{get_current_branch} -f"
|
33
|
-
else
|
34
|
-
system "git push -u origin #{get_current_branch}"
|
35
|
-
end
|
39
|
+
`git push -u origin #{get_current_branch} #{force ? '-f' : ''}`
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
data/lib/ggsm/command/switch.rb
CHANGED
@@ -17,7 +17,7 @@ module GGSM
|
|
17
17
|
arry_commit_not_exist = []
|
18
18
|
|
19
19
|
need_stash = try_stash
|
20
|
-
|
20
|
+
`git checkout #{branch}`; result=$?.success?
|
21
21
|
if need_stash
|
22
22
|
stash_pop(arry_conflict, '主工程')
|
23
23
|
end
|
@@ -50,12 +50,13 @@ module GGSM
|
|
50
50
|
|
51
51
|
def process_switch(commit_not_exist, arry_conflict, branch, index, sub, sub_commits)
|
52
52
|
need_stash = try_stash
|
53
|
-
|
53
|
+
|
54
|
+
`git checkout #{branch}`; result=$?.success?
|
54
55
|
|
55
56
|
if result
|
56
57
|
commit = sub_commits.fetch(index);
|
57
|
-
|
58
|
-
unless
|
58
|
+
`git reset --hard #{commit}`; result=$?.success?
|
59
|
+
unless result
|
59
60
|
commit_not_exist.push("==> #{sub}模块不存在远程commit:#{commit}")
|
60
61
|
end
|
61
62
|
else
|
data/lib/ggsm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ggsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YoKey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|