Method: MGit::Rebase#refresh_config

Defined in:
lib/m-git/command/rebase.rb

#refresh_config(repo, context, auto) ⇒ Object

刷新配置表



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/m-git/command/rebase.rb', line 229

def refresh_config(repo, context, auto)
  begin
    Workspace.update_config(strict_mode:false) { |missing_repos|
      if missing_repos.length > 0
        # 这里分支引导仅根据主仓库来进行,如果使用all_repos来作为引导
        # 基准,可能不准确(因为all_repos可能包含merge分支已有的本地
        # 仓库,而这些仓库所在分支可能五花八门,数量也可能多于处于正确
        # 分支的仓库)。
        success_missing_repos = Workspace.guide_to_checkout_branch(missing_repos, [repo], append_message:"拒绝该操作本次执行将忽略以上仓库")
        all_repos.concat(success_missing_repos)
        # success_missing_repos包含新下载的和当前分支已有的新仓库,其中已有仓库包含在@all_repos内,需要去重
        all_repos.uniq! { |repo| repo.name }
      end
    }
    refresh_context(context)
  rescue Error => e
    if e.type == MGIT_ERROR_TYPE[:config_generate_error]
      context.other = {
        PROGRESS_STAGE_KEY => PROGRESS_STAGE[:did_refresh_config],
        PROGRESS_AUTO => auto
      }

      OperationProgressManager.trap_into_progress(Workspace.root, context)
      show_progress_error("配置表生成失败", "#{e.msg}")
    end
  end
end