pindo 5.5.1 → 5.5.2

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
  SHA256:
3
- metadata.gz: e7216e7a8f2c6ecb513af66ce6c9af8243a0bf44bb8c30da88f72cf54071c045
4
- data.tar.gz: 851f40c6daea10f4e900ff7e284d375841d9526ce62244bb5620eda7be188239
3
+ metadata.gz: 8fc0da63e03341f38c7ab8ba1978d58d6777e81150487c11bce90a15cced9115
4
+ data.tar.gz: 14497a37c91a7dd3203c1a67ab9e21b771b4e1d1803fda9ea4236e0838f502e1
5
5
  SHA512:
6
- metadata.gz: bf176d3955cf177f0e587792d12aaf48d886d4febf59a87fa194f01c07ebaece91834b3aece211eca8dde2351a354371dff2a0f1bf976060213b8153d1ecfb55
7
- data.tar.gz: b57c2269d259384cccffd35be8b728e17bb52f8221b807148bbb3dfa29e4e381fdbd5c3caca3e3d68b3e512488c74d0566619421de2a689036028e6fe9a3f7ea
6
+ metadata.gz: d6e87f354dfa085b2469505bf593e753036ad889bd5f78c4e2014fd0e5ece208c92fdec1c5f2cd74e7533351216f26b13e6070ff7943a9667ab6f2c9b3628025
7
+ data.tar.gz: 947663c7599d2f4a866632cf3102f4414863c41e70feb7a8994b20002b269faa929c77399c11ac7a3239b8b231a9f3cb50860b996495bb5073bc4328f2e3b091
@@ -133,7 +133,7 @@ module Pindo
133
133
  Funlog.instance.fancyinfo_start("开始合并到#{release_branch}分支")
134
134
  if !coding_branch.eql?(release_branch)
135
135
  coding_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{coding_branch})).strip
136
- release_branch_commit_id = "111"
136
+ release_branch_commit_id = nil
137
137
 
138
138
  if remote_branch_exists?(local_repo_dir: current_project_dir, branch: release_branch)
139
139
  Funlog.instance.fancyinfo_update("存在#{release_branch}远程分支")
@@ -141,7 +141,6 @@ module Pindo
141
141
  Funlog.instance.fancyinfo_update("存在#{release_branch}本地分支")
142
142
  git!(%W(-C #{current_project_dir} checkout #{release_branch}))
143
143
  else
144
- Funlog.instance.fancyinfo_update("存在#{release_branch}远程分支")
145
144
  Funlog.instance.fancyinfo_update("不存在#{release_branch}本地分支")
146
145
  git!(%W(-C #{current_project_dir} checkout -b #{release_branch} origin/#{release_branch}))
147
146
  end
@@ -150,8 +149,10 @@ module Pindo
150
149
  git!(%W(-C #{current_project_dir} fetch origin #{release_branch}))
151
150
  git!(%W(-C #{current_project_dir} merge origin/#{release_branch}))
152
151
 
153
- res_data = Executable.capture_command('git', %W(merge #{coding_branch}), :capture => :out)
152
+ # 执行合并操作,捕获输出以便后续检查冲突
153
+ stdout, exit_status = Executable.capture_command('git', %W(-C #{current_project_dir} merge #{coding_branch}), :capture => :out)
154
154
 
155
+ # 检查是否有冲突(git merge 在有冲突时返回非0状态)
155
156
  conflict_filelist = git!(%W(-C #{current_project_dir} diff --name-only --diff-filter=U --relative))
156
157
  if !conflict_filelist.nil? && conflict_filelist.size > 0
157
158
  puts "合并代码冲突, 冲突文件如下:"
@@ -159,7 +160,14 @@ module Pindo
159
160
  else
160
161
  git!(%W(-C #{current_project_dir} push))
161
162
  Funlog.instance.fancyinfo_success("代码已经合并到#{release_branch}分支")
162
- release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
163
+ # 获取 release_branch commit ID(处理空分支情况)
164
+ begin
165
+ release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
166
+ rescue => e
167
+ # 分支可能存在但没有提交(空分支),此时使用 coding_branch 的 commit
168
+ Funlog.instance.fancyinfo_update("#{release_branch}分支为空或获取commit失败,将使用当前分支commit")
169
+ release_branch_commit_id = coding_branch_commit_id
170
+ end
163
171
  end
164
172
 
165
173
  else
@@ -180,14 +188,22 @@ module Pindo
180
188
  git!(%W(-C #{current_project_dir} branch --set-upstream-to=origin/#{release_branch} #{release_branch}))
181
189
 
182
190
  Funlog.instance.fancyinfo_success("代码已经合并到#{release_branch}分支")
183
- release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
191
+ # 获取 release_branch commit ID(处理空分支情况)
192
+ begin
193
+ release_branch_commit_id = git!(%W(-C #{current_project_dir} rev-parse #{release_branch})).strip
194
+ rescue => e
195
+ # 新创建的分支,commit ID 应该与 coding_branch 相同
196
+ release_branch_commit_id = coding_branch_commit_id
197
+ end
184
198
  end
185
199
 
186
200
  git!(%W(-C #{current_project_dir} checkout #{coding_branch}))
187
- if !release_branch_commit_id.eql?(coding_branch_commit_id)
201
+ if release_branch_commit_id && !release_branch_commit_id.eql?(coding_branch_commit_id)
188
202
  git!(%W(-C #{current_project_dir} merge #{release_branch}))
189
203
  Funlog.instance.fancyinfo_success("已将#{release_branch}合并到#{coding_branch}")
190
204
  end
205
+ git!(%W(-C #{current_project_dir} push origin #{coding_branch}))
206
+ Funlog.instance.fancyinfo_success("已推送#{coding_branch}分支到远程")
191
207
  else
192
208
  Funlog.instance.fancyinfo_success("代码处于#{coding_branch}分支,无需合并")
193
209
  end
@@ -138,7 +138,7 @@ module Pindo
138
138
  latest_tag = get_latest_version_tag(project_dir: current_git_root_path)
139
139
 
140
140
  unless is_tag_at_head?(git_root_dir: current_git_root_path, tag_name: latest_tag)
141
- if auto_mode || !$stdin.tty?
141
+ if auto_mode
142
142
  # 在自动化模式或没有交互式终端时,默认选择新增版本号打新Tag
143
143
  puts "检测到当前代码没有打Tag,在自动模式下将自动新增版本号并打新Tag"
144
144
  tag_action_parms = []
data/lib/pindo/version.rb CHANGED
@@ -6,7 +6,7 @@ require 'time'
6
6
 
7
7
  module Pindo
8
8
 
9
- VERSION = "5.5.1"
9
+ VERSION = "5.5.2"
10
10
 
11
11
  class VersionCheck
12
12
  RUBYGEMS_API = 'https://rubygems.org/api/v1/gems/pindo.json'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pindo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.1
4
+ version: 5.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - wade
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: claide
@@ -475,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
475
475
  - !ruby/object:Gem::Version
476
476
  version: '0'
477
477
  requirements: []
478
- rubygems_version: 3.6.3
478
+ rubygems_version: 3.6.9
479
479
  specification_version: 3
480
480
  summary: easy work
481
481
  test_files: []