MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / display_git_info

Function display_git_info

mod/project/git/scripts/deploy.py:66–84  ·  view source on GitHub ↗

显示git仓库信息

(site_path)

Source from the content-addressed store, hash-verified

64 return {'site': site, 'path': site_path}
65
66def display_git_info(site_path):
67 """显示git仓库信息"""
68 try:
69 # 获取当前分支
70 result = subprocess.run(f"cd {site_path} && git rev-parse --abbrev-ref HEAD",
71 shell=True, capture_output=True, text=True, env=env)
72 if result.returncode == 0:
73 current_branch = result.stdout.strip()
74 log(f"当前分支: {current_branch}")
75
76 # 获取最新commit信息
77 result = subprocess.run(f"cd {site_path} && git log -1 --pretty=format:'%h|%s|%an'",
78 shell=True, capture_output=True, text=True, env=env)
79 if result.returncode == 0:
80 commit_info = result.stdout.strip().split('|')
81 if len(commit_info) >= 3:
82 log(f"最新提交: {commit_info[0]} - {commit_info[1]} (by {commit_info[2]})")
83 except:
84 pass
85
86def execute_deploy_script(site_path, deploy_script):
87 """执行部署脚本"""

Callers 3

auto_deployFunction · 0.85
manual_branch_deployFunction · 0.85
manual_rollback_deployFunction · 0.85

Calls 3

logFunction · 0.70
runMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected