ggsm 1.7.0 → 1.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05c8795b96d0aa91153b1ba4e4d78aa378f49261
4
- data.tar.gz: e00c2d488a3cb08f3936e3bf063ce7573b8393e9
3
+ metadata.gz: 996c39374cb11250d79913de7faf12ae2730290b
4
+ data.tar.gz: 5045631bff91d67cf68cf1595869b5dc0715094d
5
5
  SHA512:
6
- metadata.gz: cf1bfd574589d40f400b6f87765d8192505dfa0551542d0cfd1e4ce14a4115d27129ca0f8c61ddec4c9ae2cd28e7bc8e357a8eca3c0039ef40581edf48fb93f5
7
- data.tar.gz: f1593b8be071bf1b649519b1439bc173fb8d3e7daf8bf8b920aa0e2e7d9ca3fade2473e1fc1131f4010eb439482ea27b77006b2c3dca99b5eff11e53e7877f54
6
+ metadata.gz: fd593cfc4cb21c7fc66f51fcacb431ab913f44fd4f58bd95449ec0323de2a3f00e34776a7ac1e50939d62a4df68bb0f1d0226b90f1b367d1335cfd30f9067c8e
7
+ data.tar.gz: 648ea7a0822727659814fdb4938a1767a1368f955d0b78a2dbf52d055d39990ad254c11edc6a2c169049f286fc841319660499b0819ce35287550ac0d0752da7
@@ -29,9 +29,9 @@ module GGSM
29
29
  end
30
30
 
31
31
  desc 'merge <branch> [-r|--rebase]', 'Merge,开发完成后执行; --rebase:主工程强制rebase'
32
- option :rebase, :default => false, :type => :boolean, aliases: '-r'
32
+ option :can_rebase, :default => false, :type => :boolean, aliases: '-r'
33
33
  def merge(branch)
34
- rebase = options[:rebase]
34
+ rebase = options[:can_rebase]
35
35
  merge_flow(branch, rebase)
36
36
  end
37
37
 
@@ -29,9 +29,9 @@ module GGSM
29
29
  end
30
30
 
31
31
  if force
32
- system "git push origin #{get_current_branch} -f"
32
+ system "git push -u origin #{get_current_branch} -f"
33
33
  else
34
- system "git push origin #{get_current_branch}"
34
+ system "git push -u origin #{get_current_branch}"
35
35
  end
36
36
  end
37
37
  end
@@ -69,20 +69,31 @@ module GGSM
69
69
  pattern = /[0-9a-z]{7}(?=\s)/
70
70
  current_branch = get_current_branch
71
71
 
72
- remote = `git config --get branch.#{current_branch}.remote`
73
- if remote == ''
74
- return true
75
- end
76
-
77
- diff_logs = `git log --oneline #{branch}..#{current_branch}`.split("\n").reverse
72
+ can_rebase(current_branch) {|remote|
73
+ diff_logs = `git log --oneline #{branch}..#{current_branch}`.split("\n").reverse
74
+
75
+ if diff_logs.length > 0
76
+ commit = pattern.match(diff_logs[0].strip)[0]
77
+ result = `git log #{remote}/#{current_branch} |grep #{commit}`
78
+ if `git log --oneline #{current_branch}..#{branch}`.split("\n").length > 0 && result.strip != ''
79
+ return false
80
+ end
81
+ end
82
+ }
83
+ end
78
84
 
79
- diff_logs.each do |log|
80
- commit = pattern.match(log.strip)[0]
81
- result = `git log #{remote}/#{current_branch} |grep #{commit}`
85
+ def can_rebase(current_branch)
86
+ remote = `git config --get branch.#{current_branch}.remote`
82
87
 
83
- if result.strip != ''
84
- return false
88
+ if remote == ''
89
+ `git branch -r`.split("\n").each do |branch|
90
+ if branch.strip == "origin/#{current_branch}"
91
+ remote = 'origin'
92
+ yield remote
93
+ end
85
94
  end
95
+ else
96
+ yield remote
86
97
  end
87
98
  true
88
99
  end
@@ -1,3 +1,3 @@
1
1
  module GGSM
2
- VERSION = '1.7.0'
2
+ VERSION = '1.7.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ggsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YoKey