显示git仓库信息
(site_path)
| 64 | return {'site': site, 'path': site_path} |
| 65 | |
| 66 | def 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 | |
| 86 | def execute_deploy_script(site_path, deploy_script): |
| 87 | """执行部署脚本""" |
no test coverage detected