57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/m-git/repo/sync_helper.rb', line 57
def __sync_remote_repo(light_repo, root, link_git:true)
output, repo = nil, nil
clone_url = light_repo.clone_url(root)
Utils.execute_shell_cmd(clone_url) { |stdout, stderr, status|
if status.success?
repo = Repo.generate_strictly(root, light_repo)
begin
manage_git = MGitConfig.query_with_key(root, :managegit)
Utils.link_git(repo.path, light_repo.git_store_dir(root)) if manage_git && link_git
rescue Error => _
end
msg = ''
error_message = sync_lock_point(repo, light_repo)
msg += error_message if !error_message.nil?
output = msg.length > 0 ? msg : nil
else
output = "同步仓库\"#{light_repo.name}\"时clone失败,如果远程仓库不存在,请在配置文件中删除该仓库并重试。原因:\n#{stderr}"
end
}
[output, repo]
end
|